how to make 8051 to recognise i/p only greater than a specified voltage? | EngineersGarage
Close or Esc Key

Arduino Projects   |   Raspberry Pi   |   Electronic Circuits   |   AVR   |   PIC   |   8051   |   Electronic Projects

how to make 8051 to recognise i/p only greater than a specified voltage?

1 post / 0 new
Greeshma N D
Greeshma N D's picture
Offline
Last seen: 2 years 3 months ago
Joined: 20/01/2016 - 21:33
how to make 8051 to recognise i/p only greater than a specified voltage?

My project is on blood leakage monitoring system.It uses TCST110 photointerrupter. Curently in proteus i've used pc817d and some resistors instead of tcst110.i can make 8051 detect the photointerrupter's on condition, but unable to make it to respond only when photointerruprt's o/p is above specified vlg(.03V ).what changes should i make in the code.

code is as follows:

#include "REG51.h"
#include <stdio.h>
#define buz P1
sbit LED_pin = P2^0; //Defining LED PIN
sbit sensor_pin = P0^0; //Defining output of sensor  PIN
void Delay(int); //Function prototype declaration
void main (void)
{ buz=0x00;  //buzzer off
  sensor_pin = 1; // if sensor is low 
  LED_pin=0; //LED off 
  while(1) //infinite loop
  {
    if(sensor_pin == 0 ) //If sensor is high 
    {
      LED_pin = 1; //LED ON
buz=0x01;      // ON Buzzer
Delay(6000); //Delay
buz=0x00; // OFF Buzzer
      LED_pin = 0; //LED OFF
 Delay(6000);
    }}}
 void Delay(int k)
{ int j;
  int i;
  for(i=0;i<k;i++)
  {
    for(j=0;j<100;j++)
    { } }
}
 
]]>]]>