How to send raw hex over RS-232?
For a project I'm working on, I would to send raw hexadecimal bytes over RS-232. Is there any particularly easy way to do this? Most terminal applications that I've seen can only accept ascii input, and so don't work very well for sending the raw data.
The project involves sending 4 bytes of data at a time to the microcontroller (ATMega16A). The first three bytes control 24 LEDs, and the last byte is used to tell the uC how to interpret the first 3 bytes. Since the first 3 bytes control 24 LEDs, I would like to be able to use the full range of values per byte (0-255) to get individual control over the LEDs.
I realize that I can simply increase the data sent from 4 bytes to 12 bytes, and then process the incoming data on the uC (i.e. sending ascii 2, subtract x30, multiply by 100, store, send ascii 3, subtract x30, multiply by 10, add to total, send ascii 4, subtract x30, add to total), but I figure its probably better to use the PC to do the bulk of the processing, and let the uC sit back and gather the data. I probably have enough clock cycles to spare in between serial data transmissions now (currently operating at 4800 bps w/ 8MHz clock), but if I increase that number later (to 19200 bps, for example), I'm concerned about hitting the uC's processing limit.
Why increase the speed? Because a later version of this project could very well involve sending 1Mb of data (or more), and 1Mb@4800bps = about 218 seconds = about 3.75 minutes. Tripling the data as the proposed solution would of course increase transfer time to almost 11min, a bit of a wait. 19200bps is a much more reasonable (though still not fantastic) 1min/3min for data transfer.