[/code]"> [/code]"> [/code]">
Hi all,
I am trying to make an animated relay work to switch on the bulb in my circuit. When a input is given to the pic16f877A, it is to make the relay on the bulb. I have fixed everything correctly( according to me...). But i can't make the relay work when i execute (F12). The lcd included works well though. Pls help. I will include the coding and the picture of the circuit. Also what do the blue and red square lights that appear in the proteus simulation.
Pls do help me.
Thanks
S.Trinetra

p.s
relay is set to 5V. It is still not working.
Do u notice the power terminal connected to one part of the relay and diode. Must have a certain value? I can't seem to insert any value.
Do u think that there is something wrong with the code in Mplab?
Must ac source and bulb be connected to the transistor and ground?
[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

Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir