EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Replies / the above rfid interfacing to

the above rfid interfacing to

|

Microcontroller › PIC › RFID interfacing with pic › the above rfid interfacing to

March 15, 2014 at 8:56 am #11304
aniruddha
Participant
the above rfid interfacing to pic18f4550 code is not working …please suggest the right code as fast u can 
 
 
 
 
 
 
#include <p18f4550.h>
/*The following lines of code perform interrupt vector relocation to work with the USB bootloader. These must be used with every application program to run as a USB application.*/
 
#pragma code
 
#pragma code _HIGH_INTERRUPT_VECTOR = 0x000808
void _high_ISR (void)
{
    _asm goto change _endasm
}
#pragma code _LOW_INTERRUPT_VECTOR = 0x000818
void _low_ISR (void)
{
     ;
}
#pragma code
 
void change(void)
{
 
INTCON3bits.INT1IF = 0;
}
#define FREQ 12000000
#define baud 9600
#define spbrg_value (((FREQ/64)/baud)-1)
#define rs PORTAbits.RA0
#define rw PORTAbits.RA1
#define en PORTAbits.RA2
#define lcdport LATB
 
unsigned char rx_data();
void lcd_ini(void);
void lcdcmd(unsigned char);
void lcddata(unsigned char);
void MsDelay(unsigned int delay); 
unsigned char data[] =”unique ID No.”;
unsigned char card_id[12];
unsigned int i=0,pos;
void main()
 
{
TRISB=0; // set port B as output port 
LATB=0;
TRISA=0;
LATA=0;
SPBRG=spbrg_value; // fill SPBRG reg to set the baud rate 
RCSTAbits.SPEN=1;  // to activate serial port (Tx and Rx pins)
RCSTAbits.CREN=1;   // to enable continuous reception 
PIE1bits.RCIE=1; // to enable the reception (RX)interrupt
INTCONbits.GIE=1;
INTCONbits.PEIE=1;
lcd_ini();      // lcd initialization 
while(data!=’’)
{
lcddata(data);  // to send characters one by one from data array
i++;
}
while(1)
{
i=0;
while(i<12);
lcdcmd(0xc0);
i=0;
while(i<12)
{
lcddata(card_id); // print the 12 byte receiverd data 
i++;
}
   }
}
void interrupt()
{
card_id=RCREG;  // store the receicer data byte by byte 
i++;
}
void lcd_ini()
{
lcdcmd(0x38); // configure th lcd in 8 bit mode 
lcdcmd(0x0c); // display on and cursor off
lcdcmd(0x01);// clear displayscreen 
lcdcmd(0x06);//increment cursor 
lcdcmd(0x80);//set cursor position to 1st line 1st coloum
}
void lcdcmd(unsigned char cmdout)
{
lcdport= cmdout;// send command to lcdport=PORTB
rs=0;
rw=0;
en=1;
MsDelay(10);
en=0;
}
void lcddata(unsigned char dataout)
{
lcdport=dataout;// send data to lcdport =PORTB
rs=1;
rw=0;
en=1;
MsDelay(10);
en=0;
}
void MsDelay(unsigned int time)
{
unsigned int i,j;
for(i=0;i<time;i++)
   for(j=0;j<710;j++);
}

RSS Recent Posts

  • Phone Charger 5v to 12v May 17, 2026
  • reviving old swordfish program but? May 17, 2026
  • Assistance locating a 'trail' camera gadget, please ? May 16, 2026
  • Analog multiplexer has gone obselete May 16, 2026
  • Difference between TTL, RS232 and RS485 May 16, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise