Friday, April 19, 2024

RPM Counter Using Microcontroller AT89C4051

2. Int1 is an interrupt-based function that is called automatically when there is a negative edge on external interrupt 1 pin (P3.3). As soon as the first negative edge arrives, the counter starts counting the external pulses for one second. After one second, the content of TL0 is compared with A6h (166d). For any number greater than 166, multiplication with 60 will yield a number that is longer than four digits, which is out of the display range. This means RPM of max. 9960 (166×60) can be displayed. Otherwise, the LCD will show the message “RPM Out of Range”.

3. Display function performs three tasks one by one:

(i) Converts hex number in TL0 into decimal and multiplies it by 60.

(ii) Converts the final decimal number into equivalent ASCII characters one by one.

(iii) Displays all the ASCII characters one by one on the LCD.

- Advertisement -

4. write cmd function sends command byte to the LCD. It takes one argument byte and sends it to P1

5. write data function sends the data byte to be displayed on the LCD. It also takes one argument byte and sends it to port P1

6. write str function writes the entire string (message) on the LCD. It takes the pointer as an argument that points the address of the first character of the string. Then through the pointer, it sends all the characters one by one to P1

- Advertisement -

7. busy function checks the status of the busy flag of the LCD. If the flag is set, that means the LCD is not ready and the program remains within the loop. When the flag is reset, the LCD is ready and the program comes out of the loop

8. delay function generates a fixed delay of one second using timer 0. The basic delay is of 50 milliseconds, which is rotated in the loop for 20 times to generate total delay of
20×50 ms=1000 ms =1 second

Download PCB and component layout PDFs: click here

EFY note. The source code and other relevant files of this article are included in the link below:

Download Source code: click here

SHARE YOUR THOUGHTS & COMMENTS

Unique DIY Projects

Electronics News

Truly Innovative Tech

MOst Popular Videos

Electronics Components

Calculators