You are on page 1of 2

COUNTER PROGRAMING

LAB # 06
Required Components:
♦ AT89C51
♦ Counter
♦ Keil Software
♦ Proteus

Write a C program for counter 1 in mode 1 (alternative method) to count the pulses .
Program :
#include <reg51.h>
void main()
{
char a,b;
while(1)
{
TMOD=0x06;
TH0=0x00;
TL0=0x00;
TR0=1;
do
{
a=TL0/10;
b=TL0%10;
A=a<<4;
P2=a+b;
}
While (TF0==0);
TR0=0;
TF0=0;
}}

Proteus Implementation:

You might also like