Build your own Arduino on a breadboard using the ATmega8L-8PU and flash an LED

Publisher:王岚枫Latest update time:2020-03-29 Source: eefocusKeywords:ATmega8L-8PU  Arduino  LED Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Step 1: Hardware Preparation


1.ATMEGA8L-8PU avr microcontroller (Figure 1)

figure 1


2. USBasp (a tool for burning bootloader) (Figure 2, top)


3. USB to TTL serial cable (I use the FT232 chip, which has better stability and is used to load programs under Arduino) (Figure 2 below)

figure 2


4. 16M crystal, breadboard, LED, etc., and some Dupont cables


There may be a question here: Why is ATMEGA8L-8PU equipped with a 16M crystal oscillator?


The reason is this: in principle, the ATMEGA8L-8PU uses a maximum 8M crystal oscillator, but the bootloader of the M8 platform used in Arduino is compiled based on ATMEGA8 and uses a 16M crystal oscillator; I don't have an ATMEGA8 chip (note that the chip I use has an "L" at the end), and I don't know how to recompile the bootloader, so I have to equip the existing ATMEGA8L with 16M. Although it is "overclocked", no problems have been found in the current experiment.


Step 2: Software preparation (download from Baidu)


  1.arduino的IDE:arduino-1.0.5-r2


  2. USB asp driver and serial port line driver (please note that you need to download the driver for the chip corresponding to your serial port line)


  3. progisp (this is the software used to burn the bootloader)


Note: After installing USB asp, you must copy the two files libusb0.dll and libusb0.sys in the driver directory to the directory where the burning tool progisp.exe is located. In particular, there are multiple sets of libusb0.dll and libusb0.sys files in the driver file directory of USBasp, and you must choose the file that corresponds to your computer system.


For example, Figure 3 is the x64 driver directory. My computer is x64win7 with AMD CPU, and the two files I copied are under amd64. Of course, the computer with Intel CPU uses the two files in the ia64 folder.

Figure 3


Otherwise, the following problems may occur when burning the program:

Figure 4


Step 3: Build a Minimum System on a Breadboard

Wiring as shown in Figure 5

Figure 5

Actual example Figure 6:

Figure 6

Step 4: Use usbasp to burn the bootloader

After installing and connecting the USBasp driver, open the progisp software as shown in Figure 7

                 

Figure 7


1. Select the chip as ATmega8


2. Open the HEX file of the bootloader, which is located in the Arduino IDE software's arduino-1.0.5-r2hardwarearduinobootloadersatmega8 directory. The file name is ATmegaBOOT-prod-firmware-2009-11-07.hex


3. Configure the fuse bit to 0xCADF. Note that incorrect fuse bit configuration may lock the chip.


4. Check the Program Fuse checkbox


5. Click the automatic button to start programming the chip. After programming is completed, the word "successfully" will appear in the box in the lower left corner of the software.


Step 5: Create the Flashing LED Code in Arduino IDE

/*

  Blink

  Turns on an LED on for one second, then off for one second, repeatedly.

 

  This example code is in the public domain.

 */

 

// Pin 13 has an LED connected on most Arduino boards.

// give it a name:

int led = 13;


// the setup routine runs once when you press reset:

void setup() {                

  // initialize the digital pin as an output.

  pinMode(led, OUTPUT);     

}


// the loop routine runs over and over again forever:

void loop() {

  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)

  delay(1000);               // wait for a second

  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW

  delay(1000);               // wait for a second

}

Figure 8

After entering the code, click the first "check mark" button in the IDE shown in Figure 8 to compile.


Step 6: Load the compiled program into the Atmega8 chip under Arduino IDE

1. Disconnect any connection between USBasp and the breadboard (this is important, otherwise the download will fail. Of course, if the bootloader is downloaded correctly, you can use USB to TTL to download Arduino programs in the future, and USBasp will not be needed).

2. Connect the VCC and GND of USB to TTL to the corresponding pins of Atmega8L chip. Connect the TXD of USB to TTL to the RXD of ATmega8L, and the RXD of USB to TTL to the TXD of ATmega8L, refer to Figure 6.

3 Connect a light-emitting diode on the breadboard: the positive pole of the light-emitting diode is connected to PB5 (pin 19) of ATmega8L, and the negative pole is connected to GND through a current-limiting resistor (about 500 ohms). (Refer to Figure 10, the current-limiting resistor is not connected in Figure 10)

4. Connect USB to TTL to PC. Then in Arduino IDE, click the menu selection Tool->Board->Arduino NG or older /W ATmega8, and then select Tool->Board->Serial Port and select the COM port corresponding to USB to TTL on your computer. See Figure 9.

Fig. 9

Fig.10

5. Finally, click the "→" button on the Ardunio IDE to start loading the program. At the same time, use a DuPont line to short-circuit the RST (first pin) of Atmega8L with GND on the breadboard to reset it (of course, it is most convenient to connect a button), and then wait for the download to complete.

6. After the download is complete: you can see the experimental results. The LED light turns on for one second, turns off for one second, and so on. If this is successful, it means that the bootloader correctly guides the download and operation of the program, and the Ardunio program itself is also correct.

                                        

Fig.11

At this point, a minimal Arduino development board has been made, and the first Arduino introductory program has been run. The implementation of subsequent Arduino programs and system expansion are up to everyone.


Figure: The correspondence between the PIN pins in Arduino and the pins of the Atmega8L chip.

Additional information:

There is a board type configuration file boards.txt in the installation directory arduino-1.0.5-r2hardwarearduino of Ardunio IDE. Some of the configuration codes are as follows

##############################################################


atmega8.name=Arduino NG or older w/ ATmega8


atmega8.upload.protocol=arduino

atmega8.upload.maximum_size=7168

atmega8.upload.speed=19200


atmega8.bootloader.low_fuses=0xdf

atmega8.bootloader.high_fuses=0xca

atmega8.bootloader.path=atmega8

atmega8.bootloader.file=ATmegaBOOT-prod-firmware-2009-11-07.hex

atmega8.bootloader.unlock_bits=0x3F

atmega8.bootloader.lock_bits=0x0F


atmega8.build.mcu=atmega8

atmega8.build.f_cpu=16000000L

atmega8.build.core=arduino

atmega8.build.variant=standard


##############################################################


Here you can see the configuration of the fuse bits, the crystal oscillator frequency, and the HEX file of the specified bootloader. This is why the fuse bits are configured as shown in the fourth step and the crystal oscillator must be selected as 16M.

Keywords:ATmega8L-8PU  Arduino  LED Reference address:Build your own Arduino on a breadboard using the ATmega8L-8PU and flash an LED

Previous article:Production of Arduino minimum system based on atmega8 (Arduino uno as downloader)
Next article:Arduino - Minimal System (Based on ATMEGA8-16PU)

Recommended ReadingLatest update time:2024-11-16 14:36

Leyard revealed a lot of information about Mini/Micro LED and small pitch products
Recently, Leyard revealed a lot of information about Mini/Micro LED and small-pitch products in investor relations activities and transaction interaction platforms.   MiniLED backlight products are expected to start to be mass-produced in the middle of next year. On December 17, Leyard responded to investors' question
[Embedded]
Choosing the right high-efficiency driver solution for different DC-DC LED lighting applications
In recent years, the application areas of high-brightness LEDs have continued to increase, covering a wide range from mobile device backlighting, medium and large-sized LCD backlighting, automotive interior and exterior lighting, and general lighting. Common DC-DC LED lighting applications incl
[Power Management]
Choosing the right high-efficiency driver solution for different DC-DC LED lighting applications
Say goodbye to the era of huge profits and reveal the secrets of LED lamp power supply design
The LED power supply made of constant current control IC represented by 9910 series is actually current limiting and simple to control. Strictly speaking, it does not belong to the mainstream mode of switching power supply control. The mainstream mode of switching power supply control must have a reference and an op
[Power Management]
Say goodbye to the era of huge profits and reveal the secrets of LED lamp power supply design
Button control LED light/dark program
An assembly program that controls the brightness/darkness of LEDs with one button. When the computer is turned on, the first time the first switch is pressed, the 8 LEDs light up, the second time the first switch is pressed, the 8 LEDs darken, the 8 LEDs light up again when the switch is pressed again, and darken agai
[Microcontroller]
51 single chip microcomputer 8 times 8 dot matrix LED display principle and program
Display a column on the 8X8 dot matrix LED, and let it move smoothly from left to right three times, then from right to left three times, then from top to bottom three times, and finally from bottom to top three times, and so on. 1. Programming content 8X8 dot matrix LED working principle description: 8X8 dot matrix
[Microcontroller]
51 single chip microcomputer 8 times 8 dot matrix LED display principle and program
Analysis of High Efficiency Driving Circuit for LED
introduction Incandescent bulbs can emit a variety of light, but in specific applications, only green, red, and yellow light are usually needed - such as traffic lights. If an incandescent bulb is used, a filter is required, which will waste 60% of the light energy, while LEDs can directly produce the
[Power Management]
Analysis of High Efficiency Driving Circuit for LED
Driving circuits for architectural LEDs and indoor LEDs
  LEDs are more efficient than incandescent bulbs and last 100 times longer, but they require specialized electronic drive circuits to avoid overload conditions. The main operating parameter is relatively simple: keep the current through the LED constant and below the specified maximum value.   Traditional power sup
[Power Management]
Driving circuits for architectural LEDs and indoor LEDs
LED lighting power supply circuit design questions and answers
Discussion on LED driver selection 1. LED driver IC features and selection Netizen question: Does LED driver have to use dedicated LED driver IC? What are the advantages and disadvantages compared with ordinary IC? Expert reply: The advantages of LED driver dedicated IC are wide Vin, large output curr
[Power Management]
LED lighting power supply circuit design questions and answers
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号