Hello everyone,
I'm seeking comment to validate the code I'm using are 'ok as is' or can be edited for faster running.
The code use an 20x2 at 64Mhz, with the hserin to receive a UPC-A (0 59749 96859 1) from a barcode scanner.
After receiving, the left digits 2~6 (59749) are converted to a decimal value and assigned to w11 variable, later w11 will be use as address for an EEPROM.
Thanks to all.
I'm seeking comment to validate the code I'm using are 'ok as is' or can be edited for faster running.
The code use an 20x2 at 64Mhz, with the hserin to receive a UPC-A (0 59749 96859 1) from a barcode scanner.
After receiving, the left digits 2~6 (59749) are converted to a decimal value and assigned to w11 variable, later w11 will be use as address for an EEPROM.
Thanks to all.
Code:
#picaxe 20x2
#NO_DATA
#no_table
setfreq m64
hsersetup B9600_64, %00001
#terminal 76800
let dirsB = %00000100
let dirsC = %00000000
DO
;scan 12 digits UPC-A barcode : 0 59749 96859 1
hserin 0,12
;get & assign to var
get 0,b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11
;ascii digit 2~6 "59749" to decimal value
w6=b1-48*10000
w7=b2-48*1000
w8=b3-48*100
w9=b4-48*10
w10=b5-48
;assign w11 decimal value 59749
w11=w6+w7+w8+w9+w10
;debug
;Send to Terminal barcode & w11
sertxd (b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,13,10,#w11,13,10)
LOOP