Design of pneumatic marker control system based on ATmega16

Publisher:吉州古玩斋Latest update time:2011-08-11 Keywords:ATmega16 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction

Pneumatic marking machines are widely used in nameplates, various parts and automobile beams, but as demand changes, higher requirements are placed on the stability, portability and multi-tasking of marking machines. The marking software has been upgraded from the previous DOS system to Win98, Win2000, WinXP and other versions, and the functions are becoming more and more complex, however, the hardware design has hardly changed.

Since the marking software of the ordinary marking machine control system converts the graphic information into pulse information, it needs to be output to the drive control board through the I/O interface (ISA, PC expansion card or parallel port), and then the drive circuit actuator works. However, most personal PCs and laptops currently cancel the expansion I/O card configured with parallel and serial ports, and use the IJSB interface. The PWM signal of the ordinary marking machine uses a 555 oscillator and multiple resistors and capacitors to form a non-steady-state multivibrator with adjustable duty cycle and frequency. When adjusting the PWM signal, open the control box, and adjust the frequency and duty cycle of the PWM signal by adjusting two adjustable resistors. In order to solve the shortcomings of the above-mentioned marking machine control system, the single-chip microcomputer ATmegal6 and the USB to RS232 interface device CH341T are used to form a communication interface, and the marking control system is upgraded to the USB interface: the phase-frequency correction PWM of ATmegal6 is used to replace the 555 oscillation circuit, and the frequency and duty cycle of the PWM signal can be directly corrected through the PC software, making the PWM signal adjustment convenient.

2 ATmegal6 Phase and Frequency Correction PWM Mode

ATmegal6 phase and frequency correction PWM mode is a PWM signal with accurate frequency and duty cycle. It adopts a fixed TOP value working mode, that is, mode 8 of the 16 PWM waveform generation modes, referred to as phase and frequency correction PWM mode.

The phase-frequency correction PWM mode is based on dual slope operation, and its working sequence is shown in Figure 1. TCNTn repeatedly counts from BOTTOM to TOP, and then returns from TOP to BOTTOM. In the general comparison output mode, when TCNTn counts to TOP, if TCNTn matches OCRlx, OClx is cleared and set to a low level; when TCNTn counts to BOTTOM, if TCNTn matches OCRlx, OC1x is set to a high level, which is exactly the opposite when working in reverse output comparison. The comparison unit outputs a PWM waveform at the OClx pin, and the frequency of its output PWM is

formula

The variable N is the frequency division factor (1, 8, 64, 256 or 1024); the variable fclk is the CPU clock; the variable TOP is the maximum value of the counter. If the PWM operating frequency is known,

formula

[page]

Then when TOP is determined, adjust the OCRlx value. That is, adjust the duty cycle to obtain the required PWM waveform. When using the fixed TOP value working mode, it is recommended to use the ICRl register to define TOP, so that OCRlA can use the PWM output by OC1A (sharing the same 4 Pneumatic marking machine control system software design The software design of the improved marking machine control system is divided into a human-computer interaction interface installed on the PC and a real-time control software burned into ATmegal6. The former is responsible for converting graphic information into pulse information and setting marking machine motion-related parameters, such as speed, PWM frequency and duty cycle; the latter is responsible for receiving information sent by the PC, performing relevant processing, and then returning the current hardware information to the PC. Transmission The information is divided into two categories: one is a normal data frame with a fixed information header and a fixed information tail; the other is a pulse data frame signal without an information header and an information tail. This can greatly reduce the amount of data sent during the marking process, reduce the number of times ATmegal6 interrupts the pulse output task processing to receive serial port data during the real-time marking process, and make the actuator move more smoothly. The data frame structure with information header and information tail is: the main task data frame structure shown in Table 1 and the sub-task data frame structure shown in Table 2. The number of bytes of the parameter information in Table 2 is the number of characters that distinguish whether it has parameters or not based on the sub-task identification information.

Working sequence

Main task data frame structure and secondary task data frame structure

Data Frame

The stepping interval of the stepper motor is discrete. The speed control is essentially to control the stepping interval of the stepper motor so that the stepper motor works at a given speed. If Ti is the time interval between two consecutive steps (seconds), Vi is the final speed after one step (steps/second), and a is the acceleration of the next step.

formula

Equation, calculate the time interval between two adjacent steps. Because the calculation is cumbersome, online calculation is generally not used to control the speed. Instead, offline calculation is used to obtain each Ti, and Ti is programmed into the program through a delay time table. Then, the value of the next feed is taken out in sequence according to the table address. The given time interval is generated by the delay program or timer, and the corresponding walking command is issued to calculate the time interval between two adjacent steps. Figure 4 shows the software flow of the tag control system.

High frequency solenoid valve drive circuit and USB to RS232 interface circuit

Marking the software flow of the control system

The reference clock of ATmegal6 uses 11.059 2 MHz passive crystal oscillator. The serial communication protocol is baud rate 19 200 bit/s, 8 data bits, 1 stop bit, no parity bit. The driver uses M542 type (64 subdivisions), 57BYG stepper motor. The maximum marking format meets 260 mm×260 mm, and the writing speed of numbers/letters (4 mm high) is 3-6 per second. The system is suitable for plane, rotation, and plane-rotation mixed marking.

5 Conclusion

The improved marking machine control system based on ATmegal6 and CH341T greatly relieves the workload of PC; the phase-frequency correction PWM mode based on ATmegal6 can be used to adjust the PWM signal required by the high-frequency solenoid valve through software; after replacing the DC relay with TIPl22 transistor, the drive circuit is simpler and cheaper. The marking control software has been upgraded from the commonly used parallel port mode or expansion card mode to USB mode, which is suitable for desktop PCs and laptops. Now it has realized the asynchronous operation of multiple marking heads under the control of a PC.

Keywords:ATmega16 Reference address:Design of pneumatic marker control system based on ATmega16

Previous article:Design of self-adaptive electric water boiler based on single chip microcomputer
Next article:Application design method based on PLC in beverage filling machine control system

Recommended ReadingLatest update time:2024-11-16 20:22

ATmega16 Timer 1 Time Setting
I feel more comfortable writing programs in the Atmel Studio 7 environment. Purpose: Trigger an interrupt according to the set time. Once triggered, the variable is accumulated once. Interrupts are used, so #include is needed at the beginning Variable: unsigned char time = 0; Timer 1 configuration: void Con
[Microcontroller]
AVR microcontroller (ATMEGA16) perpetual calendar (temperature alarm clock year month day hour minute second week)
Function Description: LCD1602 liquid crystal displays year, month, day, hour, minute, second, day of the week, temperature, three buttons control time and date adjustment and alarm setting.   Three buttons: 1. "Time Adjustment" button, each press corresponds to adjusting seconds, minutes, hours, weekday, day, month, y
[Microcontroller]
AVR microcontroller (ATMEGA16) perpetual calendar (temperature alarm clock year month day hour minute second week)
ATmega16 reference voltage enable signal and startup time
ATmega16 has an on-chip bandgap reference source for brownout detection or as an input to an analog comparator or ADC. The 2.56V reference voltage of the ADC is generated by this on-chip bandgap reference source. The startup time of a voltage reference may affect how it operates. The startup times are listed in Table
[Microcontroller]
ATmega16 reference voltage enable signal and startup time
ATmega16 Stack Pointer
The stack pointer points to the data SRAM stack area. The subroutine stack and interrupt stack are gathered here. The stack space must be defined before calling a subroutine and enabling interrupts, and the stack pointer must point to an address space higher than 0x60. When data is pushed onto the stack using the PUSH
[Microcontroller]
ATmega16 Stack Pointer
Atmega16 reset circuit RC oscillation period calculation
Usually, AVR microcontrollers use a low level that generates two machine cycles for reset. A simple reset circuit can use power-on reset, with the reset pin connected to a pull-up resistor and the capacitor leading out of the reset pin connected to ground (resistors and capacitors are connected in series, with the n
[Microcontroller]
ATmega16 Fuse bit setting error chip lockup repair
I recently made an ATmega16 board for fun, and downloaded ISP. The 16M crystal oscillator was not set up properly at the beginning, and the internal clock source was used, so the crystal oscillator was useless. After searching for a while, I found that the fuse bit of ATmega16's 16M crystal oscillator is set to high b
[Microcontroller]
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号