Sending HEX bytes
Franklin
Posts: 4,747
I have a device that need to be communicated with in a specific format. To write data to a memory location I need to send (In the spacific case I'm trying to accomplish) three bytes of info, a hex 81, a hex 0 (I know, it's the same as a decimal or binary 0) and the conversion of an ascii "70" that I get from another serial port. I can get the data OK and if I do
DEBUG HEX 128, HEX 0, HEX 70
I see 80038 in the debug window but what I really need is the actual HEX bytes. What is it I need to do to get this?
Thanks,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
Post Edited (Franklin) : 2/27/2007 3:50:34 AM GMT
DEBUG HEX 128, HEX 0, HEX 70
I see 80038 in the debug window but what I really need is the actual HEX bytes. What is it I need to do to get this?
Thanks,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
Post Edited (Franklin) : 2/27/2007 3:50:34 AM GMT
Comments
Can you show an example of exactly what the format is that is needed by your device?
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
StampPlot - GUI and Plotting, and XBee Wireless Adapters
Southern Illinois University Carbondale, Electronic Systems Technologies
Sends objects from the device to SitePlayer. Write has a single byte of address covering object addresses of 0 to 255 (00FFh), WriteX has an eXtended address of two bytes or 0 to 65535 (0FFFFh). Various models of SitePlayer have various object memory block sizes. The smallest SitePlayer has 768 bytes of objects covering addresses 0 to 2FFh. The Write or WriteX command also contains the count of bytes to send from 1 to 16 within the command byte in the bottom 4 bits. Zero meaning one byte and 15 meaning 16 bytes. As an example, to send two bytes of the number 1023 (3FFh) to object location 47h the Write command is used:
80h+2-1=81h |·47h |·0FFh |·03h
Since the value of Write is 80h by adding the number 2 to it for the number of bytes you are sending then subtracting 1 which is the character offset, makes the command byte 81h.
Hope that gives you a little more info in my case i need to send three bytes so I think I need to send 80h | 0h | 38h
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen