RFID Projects
I guess my last post was in the wrong place since no one replied to it
I am attempting to create a hand held RFID tag reader which will display the tag's key on a 2x16 display without using a computer. As of now, I am am having and issue with the reader code itself. Each digit from the key is saved in a variable tagBuf like in the example code for the reader. I am using tagBuf(idx1) = RX_RFID to read the key 1 digit at a time. For some reason, if I pass the key in front of the reader, the chip "hangs" until I hold the key in front of the reader. It is like the tagBuf(idx1) = RX_RFID is not getting all the information and pauses the whole code till it finishes reading it.
Here is my current code :
Any help would be greatly appreciated!
Here is my current code :
DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
FREQ 4_000_000
ID "RFID"
LcdTx VAR RA.2 ' LCD serial connection
RfidEn VAR RA.1 ' RFID enable control
RfidRx VAR RA.0 ' RFID serial input
Beeper VAR RB.0 ' lock control
TagMax CON 1 ' three tags, (0 - 2)
LcdBaud CON "T19200" ' or T2400, or T9600
RfidBaud CON "T2400"
LcdBkSpc CON $08 ' move cursor left
LcdRt CON $09 ' move cursor right
LcdLF CON $0A ' move cursor down 1 line
LcdCls CON $0C ' clear LCD (need 5 ms delay)
LcdCR CON $0D ' move pos 0 of next line
LcdBLon CON $11 ' backlight on
LcdBLoff CON $12 ' backlight off
LcdOff CON $15 ' LCD off
LcdOn1 CON $16 ' LCD on; no crsr, no blink
LcdOn2 CON $17 ' LCD on; no crsr, blink on
LcdOn3 CON $18 ' LCD on; crsr on, no blink
LcdOn4 CON $19 ' LCD on; crsr on, blink on
LcdLine1 CON $80 ' move to line 1, column 0
LcdLine2 CON $94 ' move to line 2, column 0
Active CON 0 ' for RFID reader
Deactivated CON 1
Open CON 1 ' for lock
Closed CON 0
' -------------------------------------------------------------------------
' Variables
' -------------------------------------------------------------------------
idx1 VAR Byte ' loop control
idx2 VAR Byte
char VAR Byte
tagBuf VAR Byte(10) ' tag bytes from reader
tagNum VAR Byte ' tag number
offset VAR Byte
tmpB1 VAR Byte ' subroutine work vars
tmpB2 VAR Byte
tmpB3 VAR Byte
tmpB4 VAR Byte
tmpB5 VAR Byte
tmpW1 VAR Word
' =========================================================================
PROGRAM Start
' =========================================================================
DELAY SUB 1, 2 ' delay in milliseconds
LCD_OUT SUB 1, 2 ' byte or string to LCD
CLEAR_LCD SUB 0 ' clear LCD, BL is on
RX_RFID SUB 0 ' get char from RFID
print SUB 3, 4
Beep SUB 2
' -------------------------------------------------------------------------
' Program Code
' -------------------------------------------------------------------------
Start:
PLP_B = %00000001 ' pull up unused pins
PLP_C = %00000000
RA = %0011 ' disable reader, lock it up
TRIS_A = %0100
Main:
CLEAR_LCD
Beep 1, 100
print "Present ID.", 1, 1
DELAY 1000
LOW RfidEn
DO
char = RX_RFID
LOOP UNTIL char = $0A
' ************* It is hanging here ****************
Get_Tag:
FOR idx1 = 0 TO 9 ' get RFID bytes
tagBuf(idx1) = RX_RFID
IF tagBuf(idx1) = 0 THEN Next_Tag
'print tagBuf(idx1), 2, 1
print "Test... ", 1, 1
NEXT
Next_Tag:
HIGH RfidEn
GOTO Main
Beep:
tmpB1 = __PARAM1
tmpB2 = __PARAM2
tmpB3 = tmpB2 / 2
FOR tmpB4 = 0 TO tmpB1
HIGH Beeper
DELAY tmpB3
LOW Beeper
DELAY tmpB3
NEXT
RETURN
DELAY:
IF __PARAMCNT = 1 THEN
tmpW1 = __PARAM1 ' save byte value
ELSE
tmpW1 = __WPARAM12 ' save word value
ENDIF
PAUSE tmpW1
RETURN
LCD_OUT:
tmpB1 = __PARAM1 ' save the byte
SEROUT LcdTx, LcdBaud, tmpB1 ' transmit to LCD
RETURN
print:
tmpW1 = __WPARAM12 ' get string offset
tmpB3 = __PARAM3
tmpB4 = __PARAM4
LCD_OUT LcdLine1
IF tmpB3 = 1 THEN
LCD_OUT LcdLine1
ELSEIF tmpB3 = 2 THEN
LCD_OUT LcdLine2
ENDIF
FOR tmpB5 = 1 TO tmpB4
LCD_OUT LcdRt
NEXT
LCD_OUT LcdBkSpc
DO
READ tmpW1, tmpB5 ' read a character
IF tmpB5 = 0 THEN EXIT ' if 0, string complete
SEROUT LcdTx, LcdBaud, tmpB5
INC tmpW1 ' point to next character
LOOP
RETURN
CLEAR_LCD:
LCD_OUT LcdBLon ' backlight on
LCD_OUT LcdOn1 ' no cursor or blink
LCD_OUT LcdCls ' clear the LCD
DELAY 5
RETURN
RX_RFID:
SERIN RfidRx, RfidBaud, tmpB1
RETURN tmpB1
Tags:
DATA "ABCDEF0123456789"
Keys:
DATA "DBAAA0C3AF"
Any help would be greatly appreciated!

Comments
Your question belongs in the SX forum or maybe the sensor forum. You're asking for help with your SX coding rather than how the RFID reader works, so the SX forum might be best. You're not getting answers because not that many forum members use the SX as compared to the Stamps or the Propeller
For projects that don't need to run faster than the internal RC clock and that don't need precice timing the internal clock can work out ok.
If you don't want to do that, use a big heatsink to keep the 7805 cool.
Another option if your budget allows are some of the small DC/DC switching regulators which can act as a drop-in replacement for many older 7805 parts. An example is one that Digikey sells:
http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=945-1038-ND
Robert
Robert