RS232 dec to hex conversion

I am wrtting a program that sends data to a spray jet printer via a RS232 port.  I have been sending commands with 1 byte hex data and it works fine ie. 1B 02 14 1B 03  (decimal 27 2 20 27 3)

Now I need to send command data with 2 bytes in hex ie.  143 (decimal 323).  How do I send this type of hex value? The command allows 2 bytes for this data, I tried 01 43 but this is interpreted incorrectly? Any help would be greatly appreciated.
terrencegAsked:
Who is Participating?
 
TimCotteeConnect With a Mentor Head of Software ServicesCommented:
Hi terrenceg,

It probably expects lowbyte/highbyte order so reversing your 01 43 to 43 01 will probably work.

Tim Cottee
0
 
terrencegAuthor Commented:
Thanks Tim, can you tell me which is the most significant part.  I read somewhere in the manual that I should transmit the most significant part first
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.