[/code]"> [/code]"> [/code]">
[code]
#include<htc.h>
#include <pic.h>
__CONFIG ( 0x3F32 );
#define data PORTD //Pins to the LCD D0-D7
#define rs RC2 //rs of LCD
#define rw RC0 //rw of LCD
#define en RC3 //e of LCD
#define in RE0 //input for RFID
// The above pins can be changed according to whicheva u choose
void initialize();
void busy();
void display(unsigned char one[], unsigned char two[]);
void command(unsigned char var);
void send_data(unsigned char var);
void string(unsigned char *var);
unsigned char text1[]={"RFID PROJECT"};
unsigned char text2[]={"PLACE YOUR CARD"};
unsigned char text3[]={"CARD ACCEPTED"};
unsigned char text4[]={"CARD REJECTED"};
unsigned char text5[]={" "};
//Additional text can be placed above. and can be called according to how
//u the calling in the code
void main(void)
{
int i, d;
ADCON1 = 0x06;
TRISC=0x00;
TRISD=0X00;
TRISE=0x01;
initialize();
display(text1, text2);
while(1)
{
if (in==1)
{
RC1=1;
display(text3, text5);
busy();
}
else
{
RC1=0;
display(text4, text5);
busy();
}
}
}
void initialize()
{
data=0x38; rs=0; rw=0; en=1; en=0; busy();
data=0x0E; rs=0; rw=0; en=1; en=0; busy();
data=0x01; rs=0; rw=0; en=1; en=0; busy();
data=0x06; rs=0; rw=0; en=1; en=0; busy();
}
void busy()
{
unsigned char i,j;
for(i=0;i<50;i++)
for(j=0;j<255;j++);
}
void command(unsigned char var)
{
data=var; rs=0; rw=0; en=1; en=0;busy();
}
void send_data(unsigned char var)
{
rs=1;rw=0; en=1; data=var; en=0; busy();
}
void string(unsigned char *var)
{
while(*var)
send_data(*var++);
}
void display(unsigned char one[], unsigned char two[])
{
command(0x80);
string(one);
command(0xC0);
string(two);
busy();
}
[/code]
JLCPCB – Prototype 10 PCBs for $2 (For Any Color)
China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily
How to Get PCB Cash Coupon from JLCPCB: https://bit.ly/2GMCH9w