This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

[ouestion on rs232]

Hi ,
I have designed a circuit with µPSD3200 which communicates with PC , µPSD3200 data to pc and gets data from pc with rs232 .
i want to send and receive numbers from zero two FF , not ascii , just hex code from 00 to FF (in decimal : 0 to 255) .
but , i have read that the computer and micro sends ascii code , and ascii codes does not support the whole range of 00 to FF , so what shall i do ?

omid

  • i want the answer and not bad humor!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • How about a little patience?

    If you demand a premium service, you must expect to pay for it!

    Try: http://www.keil.com/condb/

  • Sorry but I was away on other business, so I couldn't respond to your question earlier. I hoped that other stand-in posters may have been able to help you with your enquiry, but unfortunately it would appear that, once again, the onerous task has fallen to me.

    You do not yet understand your situation fully enough. ASCII is a way of interpreting binary data.

    Set up your board to transmit serial communications at your chosen baud rate and "N,8,1" communication parameters (that is to say, no parity, 8 data bits, 1 stop bit.)

    Remember that the transmit pin of one device must be connected to the receive pin of the other and vice-versa. They are different pins on 9-pin connectors vs. 25-pin connectors. Watch out.

    On the PC side you need to configure the serial port to match the speed and communication parameters of the board. You may also need to tell your compiler or application to treat the data as binary and to declare no "flow control."

    RS-232 serial communication is simple in theory. In practice there are a number of snags and pitfalls like baud, parameters, wiring, hardware/software flow control, error control, etc.

    You should study Jan Axelson's serial communications book. Its widely available from all good book stores.

  • It's been about 10 minutes since I gave you a response.

    I would appreciate it if you had the courtesy to acknowledge my efforts!

  • Hi,

    Answer and humor.

    I accept it now from you for the advice and support.

  • "i have read that the computer and micro sends ascii code"

    Either you mis-read, or mis-interpreted, or it was wrong!

    The UART in a computer or a microcontroller can just send arbitrary bytes - it doesn't necessarily care about ASCII.

    "ascii codes does not support the whole range of 00 to FF"

    ASCII does use the codes from 00 to 1F - which is where the problem may lie:
    The ASCII Codes from 00 to 1F are used as Control codes - in particular, XON and XOFF (codes 13 and 11) can be used for so-called "Software Flow Control"

    Therefore, if you want to send binary data over an RS232 link, you have to ensure that nothing is configured for "software" flow control - or anything else that might unintentionally be triggered by binary data values

    Alternatively, you could encode your data so that it uses only printable ASCII codes - which is why we have formats such as Intel Hex, Motorola S-Records, MIME, UUENCODE, etc, etc...