User manual
37
The coding above shows that ADC for the sensor that needed to make sure
the output of sensor converted to digital before microprocessor can understand the
data. This call function used for sensor 1 and sensor 2.
Function to calculate height of visitor:
Figure 3.14 : Call function to calculate height of visitor
Function to display the updated total visitor inside laboratory:
Figure 3.15 : Call function to display total visitor
void calculateHight(void)
{
Vout=(s3_value*500000)/1024;
if ((Vout > 43945)&&(Vout < 279785)) // read only from 0.4V = 80cm
to 2.8V = 8cm
{
Range_an=(Vout-19000)/2099;
Range=1000/Range_an;
Hight=210-Range;
}
}
void displayLCD(int y)
{
char txt[7];
IntToStr(y,txt);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,7,txt);
Lcd_Out(1,1,"Occupant: ");
}