RS232 using the RCM3200

hello,

I am using the RCM3200 RS232 port C to read values coming from a UART. The UART is set to 8 Bit, No stop, No parity. 3 Wire communication.

Everthing works fine except reading the data coming in. The UART is sending integers and I am using the RCM3200 sample program called SIMPLE3WIRE to read the data. Here is what is happening;

the program uses serCgets to read the value. the data read is the decimal value of the character read. For example it reads the value zero as 48, a value of one as 49, a value of 2 as 50 and so on. Any value over 9 goes back to zero. I think the reason is that it treats the data coming in as charcters so it sees 10 as a zero.

I also have tried using the serCread function but I can not make that work either.

All I need to do is to read the data coming in from the UART. This data is an INT, preferably a float or long integer. But if the Dynamic C or in my case Dynamic C Premier V 7.32P have problem reading FLOAT or LONG, I can change the UART so it always sends INT.

Any Ideas. Thank You…
Best Regards

bobby

You don’t say what the device is that is sending the data to the Rabbit. Based on what you describe, you are getting ASCII characters that represent the data. For example, Decimal 50 (Hex 32) is a ‘2’ character in ASCII.

You need to buffer the character data into a string and convert the string to the equivalent float value. There should be some delimiting character between the values. If the device sending only supports ASCII, this is your only choice.

Mark

I would be interested in how you solved this problem as I am programming a similar application

Hello Chris,

I used the command “serCread” to read the data values coming into the Rabbit as STRINGs.
Then you need to convert them into INTEGER values because they are ASCII.
Good Luck

Bobby

Thanks any code samples would be appreciated