Hi Folks,
I started to play with this RFID reader. For beginning I try to create a simple TAG reader and show the tag number on NOKIA LCD. I can read the tag and display it, but I can't extract the decimal value from readed HEX string. For example: TAG number written on tag is 0008201470 (dec) readed as 34007D24FE (HEX).
My question is how to convert this HEX to DEC?
Reading the TAG as HEX string:
Code:
'****************************************************************
'*  Name    : RDM6300 RFID Reader, nokia LCD                    *
'*  Notes   : PIC16F1829                                        *
'****************************************************************
;@ errorlevel -306  
#CONFIG
  __config  _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_ON & _CLKOUTEN_OFF & _IESO_ON & _FCMEN_OFF
  __config  _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_ON & _BORV_19 & _LVP_OFF
#ENDCONFIG

DEFINE OSC 16     ; Use a 16 MHZ internal clock 
OSCCON = %01111010
OSCTUNE = %111111
CLKRCON = 0
APFCON0 = 0   
APFCON1 = 0
CM1CON0 = 0
FVRCON = %11000011
ADCON1 = %00010000
ADCON0 = %00000000

CCP1CON = %00000000
CCP2CON = %00000000
ANSELA = %00000000 
ANSELB = %00000000
ANSELC = %00000000
TRISA =  %00100000
TRISB =  %00100000     
TRISC =  %00000000
CM1CON0 = 0       ; Disable comparator 1
CM2CON0 = 0       ; Disable comparator 2 
OPTION_REG.6=0
OPTION_REG.7=1    ;  weak pull ups 

clear

DEFINE HSER_RCSTA 90h       ; Set receive register to receiver enabled
DEFINE HSER_TXSTA 24h       ; Set transmit register to transmitter enabled 
DEFINE HSER_CLROERR 1 ' Clear overflow automatically                          
DEFINE HSER_BAUD 9600 

BUFF VAR BYTE [11] bank1
#DEFINE PIC16 1            
lcdheight  con 5                  ; 6 PAGES   
lcdwidth  con 83                  ; 84 PIXELS WIDE
LCD_CLK     var     portC.0       
LCD_DIN     var     portC.1       
LCD_RST     var     portC.2 
LCD_DC      var     portC.3
LCD_CE      var     portC.4
LCD_LIGHT   var     portC.5
sw1         var     porta.5

buf	        VAR	    byte [10]

include "nokia_ds2.INC"  
include "font7x5_16.bas"

gosub lcd_init
pause 100  
LCDCLR
pause 100
 
Main: 
;TAG No. Decimal: 0008201470
hserin 100,main,[wait ($02), STR buf\10] ;wait for $02, then read 10 bytes ascii hex

;Reading in HEX: 34007D24FE  
bigtxt = 0
ARRAYWRITE BUFF,[str buf] ;display on NOKIA LCD
LCDSTR  0,0,BUFF 
goto main
Reading the TAG as five individual HEX byte:
Code:
'****************************************************************
'*  Name    : RDM6300 RFID Reader, nokia LCD                    *
'*  Notes   : PIC16F1829                                        *
'****************************************************************
;@ errorlevel -306  
#CONFIG
  __config  _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_ON & _CLKOUTEN_OFF & _IESO_ON & _FCMEN_OFF
  __config  _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_ON & _BORV_19 & _LVP_OFF
#ENDCONFIG

DEFINE OSC 16     ; Use a 16 MHZ internal clock 
OSCCON = %01111010
OSCTUNE = %111111
CLKRCON = 0
APFCON0 = 0   
APFCON1 = 0
CM1CON0 = 0
FVRCON = %11000011
ADCON1 = %00010000
ADCON0 = %00000000

CCP1CON = %00000000
CCP2CON = %00000000
ANSELA = %00000000 
ANSELB = %00000000
ANSELC = %00000000
TRISA =  %00100000
TRISB =  %00100000     
TRISC =  %00000000
CM1CON0 = 0       ; Disable comparator 1
CM2CON0 = 0       ; Disable comparator 2 
OPTION_REG.6=0
OPTION_REG.7=1    ;  weak pull ups 

clear

DEFINE HSER_RCSTA 90h       ; Set receive register to receiver enabled
DEFINE HSER_TXSTA 24h       ; Set transmit register to transmitter enabled 
DEFINE HSER_CLROERR 1 ' Clear overflow automatically                          
DEFINE HSER_BAUD 9600 

BUFF VAR BYTE [10] bank1
#DEFINE PIC16 1            
lcdheight  con 5                  ; 6 PAGES   
lcdwidth  con 83                  ; 84 PIXELS WIDE
LCD_CLK     var     portC.0       
LCD_DIN     var     portC.1       
LCD_RST     var     portC.2 
LCD_DC      var     portC.3
LCD_CE      var     portC.4
LCD_LIGHT   var     portC.5
sw1         var     porta.5

b0 var byte 
b1 var byte
b2 var byte
b3 var byte
b4 var byte

include "nokia_ds2.INC"  
include "font7x5_16.bas"

gosub lcd_init
pause 100  
LCDCLR
pause 100

Main:
;TAG No. Decimal: 0008201470                                  
hSERIN 100,main,[wait ($02),hex2 b0, hex2 b1, hex2 b2, hex2 b3, hex2 b4] ; ;wait for $02, then read 10 bytes ascii hex

;Reading in HEX: 34007D24FE
ARRAYWRITE BUFF,[hex2 b0, hex2 b1,hex2 b2, hex2 b3,hex2 b4] ;display on NOKIA LCD
LCDSTR  0,0,BUFF 

gOTO main