Microcontroller › 8051 › Object counting on conveyor system
- This topic has 2 replies, 3 voices, and was last updated 8 years, 1 month ago by Ashutosh Bhatt.
-
AuthorPosts
-
June 7, 2011 at 6:52 am #983praveenParticipant
Guys i m trying to count the no of objects passing in a conveyor belt. for that purpose i am using IR sensor. When sensor goes low it have increase the count by 1.
Now the problem is in the debugger mode it increments the count properly. but while displaying in LCD it increment the count twice…
And i want to know whether i had followed correct procedure.. since i am new to this programming field. i had include my code below.P3 = 0x00;
LED1 = 1;
/* LCD initialization */
InitializeLCD();
/* Display project titles */
DisplayProjectTitle();
*ArrayBasePtr=&UserMessageStorage;
EA = 1;
EX0 = 1;
IT0 = 1;
while(True)
{
/* Serial bit transmissions */
SerTx(TotalCount[0]);
SerTx(TotalCount[1]);
SerTx(TotalCount[2]);
ArrayBasePtr=" TOTAL OBJECTS ";
DisplayLCD(1,0,ArrayBasePtr);
ArrayBasePtr=&TotalCount[0];
DisplayLCD(2,5,ArrayBasePtr);
TimeDelay(850);
LCD_CLEAR();
void Extint0 (void) interrupt 0
{
// IE0=0;
value++;
Count = value;
UserMessageStorage[4]= Count/100;
Count=(Count-(UserMessageStorage[4]*100));
UserMessageStorage[4]+=0x30;
UserMessageStorage[5]= Count/10;
Count=(Count-(UserMessageStorage[5]*10));
UserMessageStorage[5]+=0x30;
UserMessageStorage[6]= Count%10;
UserMessageStorage[6]+=0x30;
TotalCount[0] = UserMessageStorage[4];
TotalCount[1] = UserMessageStorage[5];
TotalCount[2] = UserMessageStorage[6];
ArrayBasePtr=" TOTAL OBJECTS ";
DisplayLCD(1,0,ArrayBasePtr);
ArrayBasePtr=&TotalCount[0];
DisplayLCD(2,5,ArrayBasePtr);
TimeDelay(850);
LCD_CLEAR();
}
thanks for you help
October 22, 2016 at 3:48 pm #14211GANEEV SINGHParticipantHi Praveen
I do not see any problem in the code, according to the knowledge that I have. It could be related to any hardware problem as well, like there is a possibility that IR sensor might be interrupting the controller twice whenever it detects any object under itself. Try out more methods of debugging this problem and do share with me the solution/mistake, once you find it.
Good Luck
November 14, 2016 at 6:24 am #14241Ashutosh BhattParticipantits not the problem with your HW or SW
it is due to low speed of object passing through conveyor.
by the time only one object passes through belt, the sensor is interrupted twice – so it counts two objects
so either
1) you incresease the speed of conveyor
or
2) you apply delay in SW between every object pass
-
AuthorPosts
- You must be logged in to reply to this topic.