Hi there...
I am trying to count the no of object pass in a conveyor systems and it need to be displayed in a LCD every time a object passes through it. I used IR for this purpose... wen ir detect the Object the led gets turned off and vice versa. Now the problem is wen LED turned off the counter keeps on counting till it get turned on
And also the counter counts only upto value 10 and it gets return to 1...
can any one pls help me.
check the program below
while(True) { if (LED1 == 0) { Count = Count+1; //LED1 = 1; }
// UserMessageStorage[4] = Count; // UserMessageStorage[1]+= 1;
UserMessageStorage[4]= Count/1000; Count=(Count-(UserMessageStorage[4]*100)); UserMessageStorage[4]+=0x30;
UserMessageStorage[5]= Count/100; Count=(Count-(UserMessageStorage[5]*10)); UserMessageStorage[5]+=0x30;
UserMessageStorage[6]= Count%100; UserMessageStorage[6]+=0x30;
TotalCount[0] = UserMessageStorage[4]; TotalCount[1] = UserMessageStorage[5]; TotalCount[2] = UserMessageStorage[6];
// u8Temp = (TotalCount[0] - 0x30) * 100; // u8Temp += (TotalCount[1] - 0x30) * 10; // u8Temp += (TotalCount[2] - 0x30) * 1; //
//TotalCount[0] = UserMessageStorage[1];
// SerTx(TotalCount[0]); // SerTx(TotalCount[1]); // SerTx(TotalCount[2]);
ArrayBasePtr="Total Objects= "; DisplayLCD(1,0,ArrayBasePtr); ArrayBasePtr=&TotalCount[0]; DisplayLCD(2,0,ArrayBasePtr); ArrayBasePtr=" Objects"; DisplayLCD(2,3,ArrayBasePtr); TimeDelay(1000); LCD_CLEAR();
Thanks in advance guys
Might it help if we write that as "re-arm"?
Another fundamental requirement for a programmer is the ability to analyse a problem.
You need to have done this before you even start to think about coding!
There are many techniques - including flowcharts, etc.
Once you have analysed the problem, you can then start thinking about and then designing a solution to the problem - again, this is before you even start to think about coding!
Finally, once you have a design, you can implement it - which is where the coding starts...