Why don't you just check for the additional hex value (i.e. non-zero) in
the upper byte prior to entering the case statement.  If it is non-zero
extract the upper byte as the first character received and the lower
byte as the second character received.

Kevin P. Aretha


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Conrad
Spiteri
Sent: Wednesday, February 26, 2003 5:16 AM
To: Palm Developer Forum
Subject: Hex Character conversion

Hi All,
I am writing an application which receives data from
the IR port (which in turn is stored in a buffer) and
then the Palm (Running OS 3.5) interprets and executes
the received commands.

The data I receive in hex and is then converted to
specific characters by a switch/case routine. Hence
the hex data 0x002D would be converted as follows:
// Part of the program

char* y;
switch (y[0])
// the rest of the values
case 0x002D:
   {
   value[0] = '2';
   value[1] = 'D';
   break;
   }
// the rest of the values
default:
   {
   value[0] = 'X';
   value[1] = 'X';
   break;
   }
However, I am getting the XX value every now and then,
when it should never happen as I am covering all the
values from 0x0000 to 0x00FF.
I have noted that when this happens 2 values are being
sent in 1 hex format (eg. 0x06D1) instead of one
containing 0x0006 and another containing 0x00D1.

Any ideas on how I should convert the 0x06D1 to 2 hex
digits as above, or is this a wrong approach to
transposing this data?

Any help would be greatly appreciated, as I am still a
novice at this stuff!!
Thank you for your time!
Conrad.


__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

-- 
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to