PDA

View Full Version : How to convert a HSERIN string to a hex value?



ShortBus
- 22nd October 2009, 03:34
This is probably an obvious newbie question, but my Google-Fu is failing me.

I have a PIC connected to a PC via a serial interface. When I type "42" on my keyboard and press enter, I would like to store the integer value of 42 (or, preferably it's hex value of 2A) into a PBP variable. How do I do this? I've only been able to figure out how to store the ASCII value of the "4" and "2" characters. Thanks!

Archangel
- 22nd October 2009, 04:40
This is probably an obvious newbie question, but my Google-Fu is failing me.

I have a PIC connected to a PC via a serial interface. When I type "42" on my keyboard and press enter, I would like to store the integer value of 42 (or, preferably it's hex value of 2A) into a PBP variable. How do I do this? I've only been able to figure out how to store the ASCII value of the "4" and "2" characters. Thanks!
Not so obvious . . . I do not use the hyper term in windows . . I use real Term, http://realterm.sourceforge.net/ , from which you can select the option of sending the ascii representation or the real number to your PIC from the PC. The PIC can use any format you choose ascii, hex, dec, http://www.melabs.com/resources/pbpmanual/ look under hserin.

ShortBus
- 22nd October 2009, 04:41
Nevermind. I found what I needed:

HSERIN 10000, main, [DEC2 MyVar]