May 1, 2014 #1 K kmdineshece Member level 1 Joined Dec 17, 2013 Messages 36 Helped 0 Reputation 0 Reaction score 0 Trophy points 6 Activity points 384 Hi all!............... pls, anyone help me!..... I'm doing automatic welcome screen project, when a person arrive, the screen should be open automatically, harware connection was made, but my software has many malfunctions!........ pls help me for pin declaration, assigning input and output pins!........ when PIR goes high it maintains the same state for few seconds, how can rectify this problem I need HiTech C compiler based program
Hi all!............... pls, anyone help me!..... I'm doing automatic welcome screen project, when a person arrive, the screen should be open automatically, harware connection was made, but my software has many malfunctions!........ pls help me for pin declaration, assigning input and output pins!........ when PIR goes high it maintains the same state for few seconds, how can rectify this problem I need HiTech C compiler based program
May 4, 2014 #2 udayan92 Full Member level 5 Joined Mar 2, 2014 Messages 284 Helped 40 Reputation 80 Reaction score 39 Trophy points 28 Location India Activity points 1,496 Can you share the circuit diagram and the code,which you have written till now..?
May 4, 2014 #3 K kmdineshece Member level 1 Joined Dec 17, 2013 Messages 36 Helped 0 Reputation 0 Reaction score 0 Trophy points 6 Activity points 384 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 86 87 #include <pic.h> #include <math.h> __CONFIG(0X1F71); #include "lcd.h" #define sensor_1 RB0 #define sensor_2 RB1 #define motor_1 RB2 #define motor_2 RB3 #define led RB4 void delay(unsigned int time) // Delay { unsigned int i, j; for(i=0;i<time;i++) for(j=0;j<time;j++); } void main(void) { unsigned int result,temp,unit,a,b,c,d,x,y,z; x = 0; y = 0; // TRISA = 1; // AN0 ADC channel as input TRISB0 = 1; // port B as output TRISB1=1; TRISB2=0; TRISB3=0; //PORTB=0xF0; TRISB4=0; TRISC = 0; // port C is used for switches and relay TRISD = 0; // port D as output lcdint(); // intialised LCD cmm(0x01); // clear display cmm(0x80); // 1'st line of LCD data_str(" SCIENTRIK ENGG "); delay(100); cmm(0xC0); // 2'nd line of LCD data_str(" SOLUTIONS "); delay(100); cmm(0x01); // clear display cmm(0x80); // 1'st line of LCD data_str(" WELCOME SCREEN "); delay(100); motor_1=0; motor_2=0; delay(300); led=0; while(1) { if((RB1==1) || (RB0==1)) { cmm(0x01); // clear display cmm(0x80); // 1'st line of LCD data_str(" SENSOR 1&2 "); motor_1=1; delay(170); motor_1=0; led=1; while((RB1==1) || (RB0==1)) data_str(" SENSOR 1&2 "); cmm(0x01); // clear display cmm(0x80); // 1'st line of LCD data_str(" SENSOR_out "); led=0; motor_2=1; delay(170); motor_2=0; } if((RB1==0) && (RB0==0)) { motor_1=0; motor_2=0; cmm(0x01); // clear display cmm(0x80); // 1'st line of LCD data_str(" NO MOTION "); led=0; } } } Last edited by a moderator: May 4, 2014
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 86 87 #include <pic.h> #include <math.h> __CONFIG(0X1F71); #include "lcd.h" #define sensor_1 RB0 #define sensor_2 RB1 #define motor_1 RB2 #define motor_2 RB3 #define led RB4 void delay(unsigned int time) // Delay { unsigned int i, j; for(i=0;i<time;i++) for(j=0;j<time;j++); } void main(void) { unsigned int result,temp,unit,a,b,c,d,x,y,z; x = 0; y = 0; // TRISA = 1; // AN0 ADC channel as input TRISB0 = 1; // port B as output TRISB1=1; TRISB2=0; TRISB3=0; //PORTB=0xF0; TRISB4=0; TRISC = 0; // port C is used for switches and relay TRISD = 0; // port D as output lcdint(); // intialised LCD cmm(0x01); // clear display cmm(0x80); // 1'st line of LCD data_str(" SCIENTRIK ENGG "); delay(100); cmm(0xC0); // 2'nd line of LCD data_str(" SOLUTIONS "); delay(100); cmm(0x01); // clear display cmm(0x80); // 1'st line of LCD data_str(" WELCOME SCREEN "); delay(100); motor_1=0; motor_2=0; delay(300); led=0; while(1) { if((RB1==1) || (RB0==1)) { cmm(0x01); // clear display cmm(0x80); // 1'st line of LCD data_str(" SENSOR 1&2 "); motor_1=1; delay(170); motor_1=0; led=1; while((RB1==1) || (RB0==1)) data_str(" SENSOR 1&2 "); cmm(0x01); // clear display cmm(0x80); // 1'st line of LCD data_str(" SENSOR_out "); led=0; motor_2=1; delay(170); motor_2=0; } if((RB1==0) && (RB0==0)) { motor_1=0; motor_2=0; cmm(0x01); // clear display cmm(0x80); // 1'st line of LCD data_str(" NO MOTION "); led=0; } } }