Design of multifunctional experimental instrument based on ATmega8 single chip microcomputer

Publisher:雅逸之风Latest update time:2011-11-18 Keywords:ATmega8 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

O Introduction
Due to the continuous development of embedded system application technology, the requirements for core processor performance are getting higher and higher. Some traditional 51 series control chips are no longer competent for many complex tasks. Therefore, through research and analysis, we have developed a set of experimental development systems based on ATmega8 high-performance series microcontrollers. ATMEL's ATmegs8 microcontroller is an 8-bit RISC CPU with a unique structure. Its online self-programming Flash and single clock instructions, instruction system settings optimized for C language and Basic language, and rich on-chip peripheral interface circuits make the powerful ATmegs8 microcontroller a highly flexible and cost-effective chip, providing an excellent solution for many high-end embedded system designs.

1 System overall design
The overall design principle block diagram of the single-chip multi-function experimental instrument hardware is shown in Figure 1:

a.JPG


In the single-chip microcomputer experimental development application system, the ATmega8 MCU core module communicates with the PC host computer through RS-232, making full use of the PC's resources. The power supply part uses USB to connect to the PC and uses the power supply of the host computer. In addition, the experimental development system is designed with a downloader, which only needs a download line to start working, without the need to purchase an expensive programmer, which is easy to use and saves costs. It can ensure that the experimental system has a high cost performance.
In the experimental software, both C language and BASCOM-AVR programming software can be used. BASCOM-AVR programming software provides a powerful, simple and convenient software platform for the development of AVR single-chip microcomputers. Its BASIC language, which is highly compatible with QB, is easy to understand and learn; the fully functional hardware simulation platform makes the learning, experimentation, and development of single-chip microcomputers simple, easy and fun, and the results of many designs can be known in computer simulation. With BASCOM-AVR, it is possible to popularize AVR single-chip microcomputers on a large scale, providing excellent solutions for many high-end embedded system designs. [page]

2 Hardware Circuit Design
2.1 Design of CPU Module
ATmegs8 is a new AVR high-end microcontroller launched by ATMEL in the first quarter of 2002. ATmegs8 integrates rich hardware interface circuits and two 8-bit timer/counters with separate prescalers in comparison mode. 1 prescaler, 16-bit timer/counter with comparison and capture mode, 1 asynchronous real-time clock (RTC) with independent oscillator, 3 PWM channels, which can realize any PWM pulse width modulation output with adjustable phase and frequency <16 bits, 8-channel A/D conversion (TQFP, MLF package), 6-channel 10-bit A/D + 2-channel 8-bit A/D, 6-channel A/D conversion (PDIP package), 4-channel 10-bit A/D + 2-channel 8-bit A/D, 1 I2C serial interface, supporting master/slave, transceiver and four working modes, supporting automatic bus arbitration, 1 programmable serial USART interface, supporting synchronous, asynchronous and multi-machine communication automatic address recognition, 1 SPI synchronous serial interface supporting master/slave, transceiver and receive, programmable watchdog timer with on-chip RC oscillator, on-chip analog comparator. The CPU module designed around the core chip is shown in Figure 2.

b.JPG


The reset circuit RESET in the figure has two options: external reset, J10 must be plugged into a short-circuit block; or PC6 is used as an I/O port, and J10 is unplugged from the short-circuit block.
The crystal oscillator circuit XTAL1 and XTAL2 in the figure are the input and output ends of the reverse amplifier of the on-chip oscillator, respectively. An external crystal oscillator is connected. By programming the fuse bit CKOPT and setting the value range of C9 and C10 (12μm~22μm), ATmega8 has a wider operating frequency range (3.0 MHz~8.0 MHz). There are two options for the crystal oscillator: an external 8 MHz passive crystal oscillator (an external 8 MHz active crystal oscillator can also be connected. When the external passive crystal oscillator cannot start oscillation, the active crystal oscillator can solve the problem and can also start oscillation with overclocking), or an internal RC oscillator. When J11 and J12 are plugged into short-circuit blocks, an external passive crystal oscillator is used; when J11 and J12 are not plugged into short-circuit blocks, the internal oscillator of ATmega8 is used.
In addition, the module is also designed with JTAG interface and ISP programming interface (ISP stands for in-System Programmable). The JTAG interface can connect the microcontroller to the parallel interface of the microcomputer through a downloader. The ISP programming interface is used to download or read the internal program of the chip online. The meaning of each pin is shown in Figure 3. Among them, pin 1 is connected to PB3 of ATmega8. 4, 6, 8, and 10 are grounded, pin 5 is connected to PC6 of ATmega8, pin 7 is connected to PB5 of ATmesa8, and pin 9 is connected to PB4 of ATmega8.

c.JPG

2.2 Downloader Module
The downloader consists of an interface board and a connecting cable. The schematic diagram of the interface board is shown in Figure 4. In the figure, U201 is an 8-buffer 74HC244 circuit, which is used as a buffer isolation between the computer parallel port and the microcontroller. Connector CN202 is a universal DB25 pin plug, which is connected to the host computer for communication; pins 4 and 5 control the U201 chip, allowing data to be transmitted normally when it is low, and the output of 74HC244 is in a high-impedance state when it is high; pin 7 outputs data to the microcontroller; pin 6 is a clock signal; pin 9 is an output reset signal; and pin 10 is used to receive data read from the microcontroller. The download cable uses a 10-core flat cable with IDC plugs pressed on both ends. One end is connected to the downloader, and the other end is connected to the ISP port JP1 on the minimum system board.

[page]

d.JPG

2.3 Other circuit designs of the experimental instrument
2.3.1 A/D conversion circuit
Figure 5 shows the A/D conversion circuit. There is a 10-bit A/D converter inside ATmega8, with an accuracy of ±2LSB, a nonlinearity of 0.5 LSB, and a conversion time of 65μs to 260μs. The conversion accuracy of the PC0 to PC3 analog input channels is 10 bits, and the conversion accuracy of the PC4 to PC5 analog input channels is 8 bits. This experimental instrument uses PC5 input, and the reference voltage Vref uses the reference voltage provided inside the chip. Using capacitors C5 and C6 to ground the pins externally can improve the anti-interference ability of the ADC part. The input voltage can be changed by adjusting W1. CZ4 is the external A/D conversion interface.

e.JPG

[page]

2.3.2 LED display and pulse width modulation circuit
In order to meet the basic I/O port design requirements of students, the experimental instrument is expanded with LED/LCD display interface circuit and pulse width modulation circuit, as shown in Figure 6.
The pulse width modulation circuit uses an output terminal OC2 of the ATmega8 microcontroller, which is the second function of the PB3 pin and can be used as a comparison match output or PWM output. Disconnecting the jumper J6 on the experimental board is the PWM output. In addition to directly driving the PWM drive signal of the DC motor, the output PWM can also be used for digital/analog conversion after RC smoothing filtering. In addition, using PWM drive, the power consumption of power semiconductor devices is much lower than that of analog signal drive.
2.3.3 Design of I2C circuit and serial interface
The I2C circuit is formed by connecting the AT24C02 chip with the serial TWI bus (PC4, PC3). Among them, PC4 is the SCL clock line, PC2 is the SDA data line, and the I2C bus 1/4 is formed through the AT24C02 chip (Figure omitted). The serial interface circuit is divided into the communication interface with the PC and the communication interface between the two single-chip microcomputers, see CZ3 (CON3 single-chip microcomputer serial communication interface) and CZ4 (CON2 single-chip microcomputer and PC serial communication interface) in Figure 7. CZ2 is an RS232 interface, which can be used for asynchronous serial UART communication between the PC and ATmega8. The PC screen can be used as a user display terminal, which can make full use of PC resources.

f.JPG
When using this interface to communicate with a microcomputer, an RS-232 interface line is used. RS-232 is a single-ended signal transmission, which is suitable for short-distance or modem communication.
After the above circuit design, the PCB board is made according to the circuit principle, and the corresponding components are welded and debugged to form the experimental instrument hardware development board as shown in Figure 8.

f.JPG

3 BASCOM-AVR integrated development software
ATMEL's AVR series of single-chip microcontrollers are based on the new reduced instruction RISC structure. The purpose of its development is to be able to use high-level language programming, so as to efficiently develop target products. At present, many companies in the world have launched AVR development software and platforms based on high-level programming languages ​​such as C and Basic.
The BASCOM-AVR development platform based on the ATmega8 experimental development board uses the BASIC language as a means to develop a platform. Its program design is simple and convenient, dedicated to various general interfaces, and has powerful statements, physical graphical simulation platform and other characteristics. With the advantages of the AVR single-chip microcontroller program memory that can be programmed multiple times and downloaded online, it makes it very easy to learn and use the AVR single-chip microcontroller.

4 Summary and Outlook
Based on the ATmega8 single-chip microcomputer experimental instrument, LCD display module, LED digital tube display module, keyboard module, A/D and D/A conversion module, general I/O interface module, communication interface module and other common experimental modules are integrated. The basic experimental system developed by AVR single-chip microcomputer can complete some basic experiments and meet the requirements of students' basic experiments. At the same time, there is an expandable space between the boards to meet the practical training requirements of students' innovative design, comprehensive course design, extracurricular science and technology activities and graduation design courses. The experimental system has been tried by students of the 2007 and 2008 grades of the mechanical and electrical majors and the 2007 and 2008 grades of the electronic technology majors, and the effect is quite significant. It not only realizes the move of the laboratory into the dormitory, but also stimulates students' interest in learning, cultivates students' hands-on ability and innovation ability, and lays a solid foundation for rapid adaptation to jobs in the future.

Keywords:ATmega8 Reference address:Design of multifunctional experimental instrument based on ATmega8 single chip microcomputer

Previous article:Design and implementation of fire-fighting robot based on AVR microcontroller
Next article:Design of digital sinusoidal inverter power supply based on AVR microcontroller

Recommended ReadingLatest update time:2024-11-16 16:39

msp430 PWM period calculation
example:   P4DIR |= BIT1+BIT2+BIT3;                  // P4.1 - P4.3 output   P4SEL |= BIT1+BIT2+BIT3;                  // P4.1 - P4.3 TBx options      TBCCR0 = 512-1;                           // PWM Period   TBCCTL1 = OUTMOD_7;                       // CCR1 reset/set   TBCCR1 = LightCDPM;                       // CCR
[Microcontroller]
Design strategy of dual-axis solar tracker based on ATmega8
    As a clean energy, solar energy has attracted much attention, so improving the utilization rate of solar energy has become a research hotspot. Theoretical analysis shows that the energy receiving efficiency of precise tracking and non-tracking of the sun is 37.7% different. Therefore, precise tracking of the sun c
[Microcontroller]
Design strategy of dual-axis solar tracker based on ATmega8
Principle Analysis of PWM Chopper AC Voltage Stabilized Power Supply
Abstract: The basic working principle and method of PWM chopper type AC voltage regulated power supply are described. Keywords: PWM; chopper; AC regulated power supply PrincipleAnalysisofaPWMChopperTypeACRegulatedPowerSupply LIU Fengjun Abstract:The basic work principle and method of a PWM chop
[Power Management]
Principle Analysis of PWM Chopper AC Voltage Stabilized Power Supply
11.STC15W408AS MCU CCP/PCA/PWM Application
The STC15W408AS MCU integrates 3-way programmable counter array (CCP/PCA) modules that can be used for software timer, external pulse capture, high-speed pulse output and pulse width modulation (PWM) output. 1. Special function registers related to CCP/PWM/PCA applications STC15 Series 1T 8051 MCU CCP/PCA/PWM Specia
[Microcontroller]
11.STC15W408AS MCU CCP/PCA/PWM Application
About PWM Mode
First of all, although I am a beginner in STM32, I strongly oppose a misleading view: "For MCUs of the level of STM32, there is no need to look at how registers are operated if there are library functions!" Okay, let's get back to the topic. Recently, I have seen many friends have a lot of doubts about the PWM experi
[Microcontroller]
Embedded ARM Learning Summary (V) --RTC-TIME-PWM-Watchdog-AD-TP
RTC Commonly used RTC modules: PCF8563 IIC Interface DS302 SPI Interface DS87887 has many functions but is more expensive BCD code: Decimal number Compressed BCD code, a BCD code from 0 to 9 requires 4 bits of binary storage For example, 0X59 means 59 seconds (directly the BCD value, i.e. decimal number) Tim
[Microcontroller]
ATmega8 reads the DIP switch program connected to 165
/***********74HC165 parallel input and serial output example program************/  // MCU ATmega8 reads the address of the dip switch of 165 serial input //   // Crystal oscillator: internal 1M //   // Author: wanghu //  // AVRGCC @2008.6.1 //  /**************************************************/  #include avr/io.h  
[Microcontroller]
A New Design of Double Closed-loop PI Regulator for Three-phase PWM Rectifier
PWM rectifier technology has strong advantages in suppressing harmonics and reactive power compensation. It has the advantages of grid-side current input close to sine, controllable grid-side power factor, bidirectional energy transmission, and fast dynamic response speed. At present, the PWM rectifier based on volt
[Power Management]
A New Design of Double Closed-loop PI Regulator for Three-phase PWM Rectifier
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号