All:
Compressed Alphanumeric Code, or CAN code, allows a 16 bit value to represent 3 characters from the set A-Z, 0-9 and the colon, period and dollar sign symbols.
HEX CAN HEX CAN HEX CAN
0 0 0
640 A 28 A 1 A
C80 B 50 B 2 B
12C0 C 78 C 3 C
1900 D A0 D 4 D
1F40 E C8 E 5 E
2580 F F0 F 6 F
2BC0 G 118 G 7 G
32C0 H 140 H 8 H
3800 I 168 I 9 I
3E40 J 190 J A J
4480 K 1B8 K B K
4B00 L 1E0 L C L
5140 M 208 M D M
5780 N 230 N E N
5DC0 O 258 O F O
6400 P 280 P 10 P
6A40 Q 2A8 Q 11 Q
7080 R 2D0 R 12 R
76C0 S 2F8 S 13 S
7D00 T 320 T 14 T
8340 U 348 U 15 U
8980 V 370 V 16 V
8FC0 W 398 W 17 W
9600 X 3C0 X 18 X
9C40 Y 3E8 Y 19 Y
A280 Z 410 Z 1A Z
A8C0 0 438 0 1B 0
AF00 1 460 1 1C 1
B540 2 488 2 1D 2
BB80 3 4B0 3 1E 3
C1C0 4 4D8 4 1F 4
C800 5 500 5 20 5
CE40 6 528 6 21 6
D480 7 550 7 22 7
DAC0 8 578 8 23 8
E100 9 5A0 9 24 9
E740 : 5C8 : 25 :
ED80 . 5F0 . 26 .
F3C0 $ 618 $ 27 $
Sample Conversions For "EVI"
To convert to CAN code from ASCII, locate the letter in the tables from left to right, and summing the values indicated. For example:
E = 1F40
V = 370
I = 9
22A9
To convert from CAN code to ASCII, start with the left most column and locate the largest value that does not exceed the CAN code value. Subtract the indicated value and repeat using the remainder for the second and last columns. For example, given the value #35A5:
35A5
-3200 H
3A5
-398 W
D M
The CAN code value #35A5 results in the letters HWM.
OK - So, for the really smart ones - can you hint at a structure that can figure that out in PicBasic? I really don't want to load the whole table into memory!!
I need to take in the CAN code, and return the 3-letter result....
TG
Bookmarks