thannara123
Advanced Member level 5
I am tried to make a rotation counter (for measuaring the rotation of a wheel) by IR TX and RX based. I am using 8051 controller using keil c51 compiler
My problem some time the measuring or counting is not detecting . Some times shows 3 roation for seeing one rotation
I am using to display in LCD
please correct me . the code and proteus file is following.
My problem some time the measuring or counting is not detecting . Some times shows 3 roation for seeing one rotation
I am using to display in LCD
please correct me . the code and proteus file is following.
Code:
#include <REGX51.H>
#include<stdio.h>
#include "lcd.h"
sbit RX=P1^0;
sbit TX=P1^1;
void main(){
unsigned char buffer[8];
unsigned int count = 0 ;
P1 =0x00;
lcd_init();
string("Lcd Testing ");
lcd_cmd(0x01);
string(" Counter ");
while(1)
{
if (RX == 1) // detected
{
count++;
while(RX==1); // relased
}
else
{
LINE2
string("rotated : ");
sprintf(buffer,"%d",count);
string(buffer);
}
}
}