Page 1 of 1

decoding control characters from serial port

Posted: Fri Feb 10, 2012 5:39 pm
by tcbcats
I need to receive and transmit control chrs (01,04 03 etc. In Hex). Are there any examples on how to detect or parse out or add these non printable chrs to my received or transmit strings?
The text message windows seem to show these but they are just little squares. I need to use these characters in my application to do terminal emulation.
The only control chr I see is the EOF but this is not using the EOF real control character.

Thanks,
tcbcats

Re: decoding control characters from serial port

Posted: Fri Feb 10, 2012 6:38 pm
by mwieder
Something like

Code: Select all

switch chartonum(tChar)
   case 1
      -- do something with char 0x01 here
      break
   case 3
      -- do something with char 0x03 here
      break
   case 4
      -- do something with char 0x04 here
      break
   default
end switch
seems like it oughta do the trick...