This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Transmitting Signed Integers or Multi-Byte Integers over SCI



Hi,

I've got the SCI transmitting 8 data bits, 1 stop bit, no parity.  I am receiving by the same method.  When I try to transmit certain values I don't seem to get the same thing on the other side.  If I transmit 0xFF I get back 0x3F on the other side.  I played around with it a bit and transmitted 0 - 255 and -255 to 255 and I found that the largest value that got through was 127.  I didn't get any negatives through and I did verify what I was putting in the buffer.  Values between 128 and 255 were received as 63 decimal = 3Fh.  I would like to have full use of the whole byte that I am transmitting instead of just 7 bits.  Is there a possible cause for this?  Is it intended?

My main issue is that I need to transmit longs and floats (4 bytes) and when I bitmask them I end up with a lot of garbage.  If I were to try to transmit 2^24 - 1 (FF FF FF FF) I get 3F 3F 3F 3F on the other side.  How can I send these floats/longs and successfully read them on the other side?  Do I need to mask them to only use 7 bits?

Is the NRZ format not capable of transmitting these bytes?  Is the start bit actually the leading bit in the 8 data bits?

Thanks!

  • David,

    The SCI doesn't know anything about signed or unsigned.  All it does is send 8 bit data.  You've got something else going on here.  Maybe a baud-rate mis-match.  The data is transmitted in this order:

    start, LSB, ..., MSB, parity, stop.

    Double check your baud rate settings on both devices, as well as no parity.  Confirm proper transmission using a scope, including baud rate.  Try a very slow baud rate as well.

    Regards,

    David

  • Baud rate, parity, stop bits, etc. all match on both devices. I will scope it when I have the opportunity but it may be a few days.