The 8051 microcontroller have been using for along time ago. ATMEL 8051 is a popular 8051 architecture compare to its original vendor Intel. The AT89S52 is a flash ISP version with ease of use.
I made a basic test board for this device with low component counts. This prototyping board contains:
Digital Volt Meter (DVM) could be built from scratch using any ADC IC such as ICL7107 or ICL7135. However those IC have a large pin counts requiring us more time to wire.
Using a microcontroller we can reduce the number of pin count for the display. A common way is using multiplexed display.
In this project I use PIC16F818 with a 10-bit built-in ADC to read analog voltage range from 0 to +40V DC.
ADC work only with +5V. So I use the voltage divider rule to reduce the scale of input voltage. As show in the schematic below, the resistors R3 and R2 are use for voltage divider. From voltage divider rule I get the scale factor of 0.13.
In this program I am writing a C code in KEIL for 8051 printing a “Hello World” message on serial port terminal. The baud rate is 2400.
C Code:
#include <reg51.h>#include <stdio.h>void main(void) { SCON=0x52; // SET SERIAL PORT TO MODE 1 TMOD=0x20; // TIMER1 MODE 2 TH1=-13; // RELOAD COUNTER FOR 2400 BAUD RATE TR1=1; // START TIMER1 // Write your code here while (1) printf("Hello World\n"); }
LED chasing is funny. We can chase LED on a simple counter such as CD4017 but it’s limited. AT89S52 is a simple microcontroller at ATMEL (now Microchip) with Intel 8051 architecture. The programming is popular KEIL uVision C51 compiler. I use embedded C for 8051.
The program I wrote function may LED chasing mode such shift righ/left and flow right/left. Those modes are selected using a DIP switch. If it’s not in this mode it will blink all LEDs.