EXP 10 AIM: interface 89C51/AVR microcontroller and write the c program to display numbers from 0 to 9 on 7-segment display with specified delay
Flowchart:
Algorithm:
Diagram:
Program:
#include<reg51.h> /*Special function register declarations*/
/* for the intended 8051 derivative */
sbit watertankempty=P2^0;
sbit watertankfull=P2^7;
void main (void)
{
watertankempty=1; //Make port 2.0 input. watertankfull=1; //Make port 2.7 input. P1=0x00; //Make port 1 as output. while(1) //Infinite while loop { if (watertankempty = 0) { P1=0x86; //Hex code to display 'E' on 7 segment. }
P1=0xff; else if (watertankfull = 0) { P1=0x8E; //Hex code to display 'F' on 7 segment. }
else P1=0xff; }
}
or