Tutorial Microcontroller MCS-51 ATMEL ISP
 

 

Super MCS51 Trainer

Standart MCS51 Trainer

Standart AVR Trainer

Programmer USBASP

Standart ARM Trainer

 

 

1. L E D

1.1 Turn On LED

The first step is to build a simple circuit. At this point you should be familiar with the parts used. (1 resistors, and 1 LED). This design is intended for use with an Atmel 89s51 but also posible for others family 8051. Most microcontrollers can handle the current required to turn an LED on and off but. In this lesson we're going to make a LED Blink continously.

Step 1st
Build the circuit as shown in figure 2.1. As you seen on figure 2.1. P0.0..P0.7 is connected to LED's katode. Remember, that all we want to do with this lesson is make eight LED on.

Figure 21. Diagram Skematik LED Blink

 

Step 2nd
In this step, you must tipe the C program to turn on LED, we assume that you have already known the editor, we used KEIL C Microvision to edit the program.

#include <AT89X52.h>
main()
{
while(1)
{
P0=0x00;
}
}

Step 3rd
Safe your C program above, and name it with LED1.c (for example) Compile the program that you have been save by using KEIL C, see the software instruction.


Step 4th
Download your hex file ( LED1.hex ) into the microcontroller by using Microcontroller PROG ISP 16.8 software, see the instruction.After download this hex file you'll see the action of the LED ( of course if your cable connection and your program are corrected ).

1.2. Bit Instruction to write to PORT

#include <AT89x52.h>
void main()
{
while(1)
{
P0_0=0;
P0_7=0;
}
}

1.3. Blink LED with delay time

#include <AT89X52.h>
void delay()
{
unsigned int x;
for(x=0;x<50000;x++);
}
main()
{
while(1)
{
P0=0xff;
delay();
P0=0x00;
delay();
}
}