You might like to take a look at similar projects for counting bees entering a hive.
Someone might have devised a method to avoid counting bees exiting.
Jpetals does your design have sufficient debounce filter and sensor dither rejection? range 1 ft? 1m? with crosstalk or isolated channels with Fluorescent light noise or without?
I used my design to detect shopping carts and rejected skirts , hands and people across an aisle in full sunlight or full Fluorescent light hum. It was design for low mistake-ability and low error rate.
You might like to take a look at similar projects for counting bees entering a hive.
Someone might have devised a method to avoid counting bees exiting.
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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 ////////////////////////Include Header Files///////////////////// #include<p18f4520.h> #include<stdlib.h> #include<XLCD.h> #include<delays.h> ///////////////////////Pragma Files///////////////////////////// #pragma config WDT = OFF // Watch timer off #pragma config OSC = HS // External High Speed crystal #pragma config PBADEN = OFF // Analogue I/O port B disabled #pragma config MCLRE = ON // Master clear enabled //////////////////////Defines LCD functions/////////////////////// #define CLR_LCD 1 // Clear LCD command code #define HOME_LCD 2 // Cursor home command code #define LINE2_LCD 0xC0 // Position cursor on line 2 command #define CURS_OFF 0x0c // Cursor off command code #define CURS_L 0x10 // Cursor left command code #define CURS_R 0x14 // Cursor right command code #define SHIFT_L 0x18 // Scroll display left command code #define SHIFT_R 0x1C // Scroll display right command code ///////////////////////FUNCTION PROTOTYPE///////////////////////// void increment(void); void decrement(void); /////////////////////LCD Delays//////////////////////////////// void DelayFor18TCY(void) // This particular LCD needs longer than the suggested 18 cycle delay { Delay1KTCYx(2); } void DelayPORXLCD(void) { Delay10KTCYx(50); // 15ms delay suggested , however longer delay is used here } void DelayXLCD(void) { Delay10KTCYx (30); // 5ms delay suggested, however longer delay is used here } ////////////////////////////////DEFINING THE PORTS/////////////////////////////// #define S1 PORTAbits.RA0; #define S2 PORTAbits.RA1; #define LCD PORTD; ////////////////////////////////GLOBAL VARIABLES////////////////////////////// int flag=1,flag1,flag2; int total; char ch[10]; int counter; int cntr; ////////////////////////////////MAIN PROGRAM/////////////////////////////// void main() { TRISA=0xFF;//setting the port A as input TRISD=0x00;//setting the portD as output OpenXLCD(FOUR_BIT & LINES_5X7); // Set LCD for 4-bit 5x7 matrix while(1) //repeats the loop forever { while(flag == 1) //repeats the loop forever { char msg[] = "WELCOME"; // Define message string 1 OpenXLCD(FOUR_BIT & LINES_5X7); // Set LCD for 4-bit 5x7 matrix WriteCmdXLCD(CLR_LCD); // Clear LCD display while(BusyXLCD()); // wait till ready putsXLCD(msg); // Sent message Press Button Delay10KTCYx(1000); flag1= S1; flag2= S2; if (flag1!=1)// when sensor 1 S1 is active { increment(); } if(flag2!=1)//when sensor 2 S2 is active { decrement(); } } total = counter - cntr;// calculates the total number of people in the hall OpenXLCD(FOUR_BIT & LINES_5X7); // Set LCD for 4-bit 5x7 matrix WriteCmdXLCD(CLR_LCD); // Clear LCD display while(BusyXLCD()); // wait till ready putsXLCD(ch);// displays the total number of people in the hall } } ///////////////////////////////////INCREMENT//////////////////////////// void increment() { int counter; int entry; while(1) { if((flag1&&flag2)==1) { counter++; entry = counter[B];//i've a doubt in this line, will the incremented counter value is stored in entry??[/B] OpenXLCD(FOUR_BIT & LINES_5X7); WriteCmdXLCD(CLR_LCD); while(BusyXLCD()); putsXLCD(ch);//displays the incremented number Delay10KTCYx(50); } else { char msg1[]= " False entry "; OpenXLCD(FOUR_BIT & LINES_5X7); WriteCmdXLCD(CLR_LCD); while(BusyXLCD()); putsXLCD(msg1);//displays the false entry Delay10KTCYx(50); } } } //////////////////////////////////DECREMENT///////////////////////////// void decrement() { int cntr; while(1) { if((flag2&&flag1)==1)// [B]is this intruction same as if((flag1&&flag2)==1)??[/B] { cntr--; OpenXLCD(FOUR_BIT & LINES_5X7); WriteCmdXLCD(CLR_LCD); while(BusyXLCD()); putsXLCD(ch);//displays the decremented number Delay10KTCYx(50); } else { char msg2[]= " False exit "; OpenXLCD(FOUR_BIT & LINES_5X7); WriteCmdXLCD(CLR_LCD); while(BusyXLCD()); putsXLCD(msg2);//displays the false exit Delay10KTCYx(50); } } }
like this
OFF1= min,max(1,10);
OFF2 = min,max(2,12);
[code\]
is this syntax correct??? does sunnyskyguy mean this?? plz correct me if i'm wrong...
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?