Thank you for looking at this... I am attempting to use a EM4100 Reader to read some cards and light some leds on the bench...
I have stolen some code and added some code... The original worked and still works
However mine doesn't... I susspect it is foing astraty in the for/next loop
Any advise before i go back to Ibuttons.... I thought this might be easier :-)
Hardware and Fuses are all fine.... 4 tags/ four doors !
Thank you
Code:
'****************************************************************
'* Name : UNTITLED.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2014 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 24/08/2014 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
adcon1 = 7
DEFINE OSC 12 'Set oscillator in MHz
'OSCCON = $70
' -----[ Variables ]-------------------------------------------------------
buf VAR Byte(10) ' RFID bytes buffer
tagNum VAR Byte ' from EEPROM table
idx VAR Byte ' tag byte index
char VAR Byte ' character from table
' -----[ EEPROM Data ]-----------------------------------------------------
Tag1 DATA "1400434B9C"
Tag2 DATA "1500649EC3"
Tag3 DATA "150063C82C"
Tag4 DATA "X50064A4CA"
' -----[ Program Code ]----------------------------------------------------
Main:
SERIN2 portb.1,84, [WAIT($02), STR buf\10] ' Read RFID
Check_List:
FOR tagNum = 1 to 4 ' scan through known tags
FOR idx = 0 TO 9 ' scan bytes in tag
READ (((tagNum-1) * 10) + idx), char ' get tag data from table
IF (char = buf(idx)) THEN loc1
IF (char = buf(idx)) THEN loc2
IF (char = buf(idx)) THEN loc3
IF (char = buf(idx)) THEN loc4
Next
Next
goto main
loc1:
high PortB.4
PAUSE 1000
LOW PortB.4
PAUSE 1000
GOTO Main
loc2:
high PortB.5
PAUSE 1000
LOW PortB.5
PAUSE 1000
GOTO Main
loc3:
high PortB.6
PAUSE 1000
LOW PortB.6
PAUSE 1000
GOTO Main
loc4:
high PortB.7
PAUSE 1000
LOW PortB.7
PAUSE 1000
GOTO Main
End
Bookmarks