Anwarullah
Newbie level 1
Greetings friends,
I am a student doing my Btech.EEE, I am assigned to make a project compiling smart home automation using android devices, I just need some help to convert a 8051 program to pic16F877a.
hereby in this mail I send the main program of 8051 and circuit diagram
please help me in completing the project friends.
Regards,
Anwarullah
I am a student doing my Btech.EEE, I am assigned to make a project compiling smart home automation using android devices, I just need some help to convert a 8051 program to pic16F877a.
hereby in this mail I send the main program of 8051 and circuit diagram
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 #include<reg51.h> sbit Fan=P2^0; sbit Light=P2^1; sbit TV=P2^2; char str; char Charin=0; void delay(int time) { unsigned int i,j; for(i=0;i<time;i++) for(j=0;j<1275;j++); } void Serialwrite(char byte) { SBUF=byte; while(!TI); TI=0; } void Serialprintln(char *p) { while(*p) { Serialwrite(*p); p++; } Serialwrite(0x0d); } void Serialbegin() { TMOD=0x20; SCON=0x50; TH1=0xfd; TR1=1; } void main() { P2=0x00; Serialbegin(); Serialprintln("System Ready..."); delay(50); while(1) { while(!RI); Charin=SBUF; str=Charin; RI=0; if(str=='1') { Fan=1; Serialprintln(" Fan ON"); delay(50); } else if(str=='2') { Fan=0; Serialprintln(" Fan OFF"); delay(50); } else if(str=='3') { Light=1; Serialprintln(" Light ON"); delay(50); } else if(str=='4') { Light=0; Serialprintln(" Light OFF"); delay(50); } else if(str=='5') { TV=1; Serialprintln(" TV ON"); delay(50); } else if(str=='6') { TV=0; Serialprintln(" TV OFF"); delay(50); } str=0; } }
please help me in completing the project friends.
Regards,
Anwarullah
Attachments
Last edited by a moderator: