|
|
View previous topic :: View next topic |
Author |
Message |
jasmine126 Guest
|
#int_rda interrupt for RFID reader |
Posted: Sat Jun 07, 2008 12:25 pm |
|
|
i'm using a parallax rfid reader to read tags and display on a LCD screen. here's my code:
Code: |
#include <18F4550.h>
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV2,VREGEN
#use delay(clock=48000000)
#include <lcd.c>
#define LCD_E PIN_D0
#define LCD_RS PIN_D1
#define LCD_RW PIN_D2
#define LCD_DB4 PIN_D4
#define LCD_DB5 PIN_D5
#define LCD_DB6 PIN_D6
#define LCD_DB7 PIN_D7
#use rs232 (baud=2400, xmit=PIN_C6, rcv=PIN_C7, stream=RFID)
#int_rda
void rda_isr(void)
{
char val;
val = fgetc(RFID);
putc(val);
if (val=fgetc(RFID)=="0F02A670DF"){
lcd_putc("\f tag detected");
output_high(PIN_C6); //deactivate reader
}
}
void main(){
lcd_init();
lcd_putc("\f Start");
enable_interrupts(int_rda);
enable_interrupts(global);
output_low(PIN_C6); //activate reader
while(1);
}
|
It doesn't work! The reader has to be pulled low to be activated. But when i measured the voltage (ground to pinc6 which is connected to the reader's enable pin), i get 5V instead. Can i compare like this? val=fgetc(RFID)=="0F02A670DF" even though i didn't save any data in my pic. seriously need help! :(
thanks! |
|
|
meereck
Joined: 09 Nov 2006 Posts: 173
|
|
Posted: Sun Jun 08, 2008 4:02 am |
|
|
for comparing strings, you should use strcmp function. Look it up in the CCS compiler manual or search this forum. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|