|
| |||||||
|
Опубликовано 2010-02-04 11:18:36 автором Ruslan "Hello World" on the microcontroller in ironIn the previous lesson we did hello worl emulator Proteusand in this tutorial we will do everything in iron. To repeat this lesson we will need a
the Scheme is very simple: the atmega8 microcontroller, the R1 resistor 100 Ohm up to 500 Ohm, led any. All this connect as shown in the diagram below:
Next, we need to write a simple program that will change the status of some legs MK. The program will create the environment CodeVisioAVR. After startup, the environment, click File->New Project further click OK. Further expose all as shown on the screenshot
Delete all of the code and paste in the following
void main(void)
{
PORTD is set=0x00; //Set all outputs port D is 0 (turn off the whole port D
DDRD=0xFF; //Make port D as output to the port outputs a voltage of 5V
while (1) //Organize an infinite loop
{
PORTD.0=1; //Switch the led on 0 the output port D
delay_ms(500); //Make the latency of 500 milliseconds
PORTD.0=0; //Disable the led on 0 the output port D
delay_ms(500); //Make the latency of 500 milliseconds
};
}
Now we need to connect the programmer to the microcontroller (simple programmer can gather on this patternor штото more solid. Fill firmware into the microcontrollerAfter we connected a programmer, I used avr910 usb, the system should detect it. And he appears in device Manager авторизоваться.
|
|||||||