Joined: 10 Jun 2005 Posts: 13 Location: London, UK
I have a a PIC X(4) field containg (for example X?F0F0F2F6?. ? character ?0026?. I need to be able to take this as the Hex value X?0026? and ?convert? it to a binary values of 38.
basically with HEX ON, the i/p would look like
FFFF
0026
This should be treated as
02
06
is there a way to convey DFSORT/ICETOOL to treat i/p character as hex value and convert it ZD value of 38? .
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
If you packed the four bytes into three bytes, I think that the first two digits could be referenced by 3,y2v and the second two by 3,y2y....
But you would have to stick them together again.....
If you have the manual, take a look, appendix C I think, Data Format Descriptions.
Joined: 10 Jun 2005 Posts: 13 Location: London, UK
Frank ,
just got to know the input hex string can consist of A-F also along with 1-9 in which case the above arithmatic fails. Any ideas about how to achive the conversion in this case ?
e.g.
input 01E0
o/p 480
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Here's a DFSORT job that will do that. The trick is to convert '0'-'9' to X'00'-X'09' and 'A'-'F' to X'0A'-X'0F' and use those BI values for the arithmetic.