Due to its wonderful piezoelectric effect, piezoelectric ceramics are used by scientists in fields closely related to people's lives to achieve functions such as energy conversion, sensing, and driving. The deformation of piezoelectric ceramics under the action of an electric field is very small, and at most does not exceed one ten-millionth of its own size. This tiny change can be used to make a precise control mechanism - a piezoelectric driver, which plays a huge role in the control of precision instruments and machinery. Piezoelectric drivers have high displacement resolution and anti-interference ability, and the control method is simple. They are very suitable for micro-displacement driving and have been widely used in defense, biomedicine, optoelectronics and many other fields [1-2]. The voltage on piezoelectric ceramics can be adjusted manually or by computer control. With the application of high-performance D/A chips, computer control has become more precise. Communication between computers and external circuits (including single-chip microcomputers) can be achieved through serial ports. Due to the characteristics of serial communication [3], such as high efficiency, reliability, low price, and compliance with unified standards, serial communication has always occupied an extremely important position in the field of system control [4-5]. Visual Basic 6.0 provides serial communication controls that can easily realize serial port data exchange. This article introduces the design of piezoelectric ceramic driver through serial communication between PC and microcontroller, in which the computer is the upper computer and the microcontroller is the lower computer.
1 Hardware Basics
Figure 1 shows the block diagram of the system. Because the working levels of the serial ports of the upper and lower computers are inconsistent, the TTL level is converted to RS232 level through the MAX232 chip. The microcontroller selected is ATMEL's reduced instruction set microcontroller ATmega16. This microcontroller has low power consumption, only 1.1 mA in normal mode, and the highest operating frequency can reach 16 MHz. It has a rewritable 16 KB programmable Flash. Its internal USART is a highly flexible serial communication device and is very convenient to use. The D/A chip uses ANALOG's 12-bit resolution AD5344. AD5344 has a parallel input interface, requires few control lines, and has double buffer input logic. One AD5344 has 4 outputs. The computer sends data to the microcontroller through the serial port. The microcontroller places the received data in the internal SRAM. After receiving the data, it takes out the data and outputs it to the D/A through the data port. The analog output signal (voltage) of the D/A is used to control the piezoelectric ceramics.
2 Host computer program design
The host computer program is written in the programming environment of Visual Basic 6.0. Using the MSComm communication control of Visual Basic6.0, it is very easy to realize serial communication. When using it, the information format and protocol of serial communication must be set. Each communication control corresponds to a serial port. If you want to access multiple communication ports, you need to design multiple communication controls.
2.1 Program flow and interface design
The communication between the computer and the single-chip microcomputer adopts the query working method. The computer is the host computer (host) and the single-chip microcomputer is the slave computer (slave). The host computer is mainly responsible for sending control commands, as well as sending, receiving, processing, calculating, and displaying data. The host computer program is divided into four parts: interface design, program initialization, data communication, and data processing. The program flow is shown in Figure 2.
The main program interface is mainly divided into a data input box and a command control button. The input box is used to input the value of the voltage provided to the piezoelectric ceramic, and the command control button is used to send and receive commands and data. The interface also places a text box to display the communication status. The program interface is shown in Figure 3.
The "Set" button in Figure 3 is used to send the voltage value (CH1~CH4) in the text box to the microcontroller through the serial port, and the microcontroller then transmits the data to the analog-to-digital converter . The "Clear" button is used to set all output data to zero.
2.2 Program code
The specific program code includes the initialization of the serial port and the sending and receiving of data. The initialization code of the serial port is as follows:
MSComm1.CommPort=1; Use COM1 serial
portMSComm1.Settings="9600, n, 8, 1"; Data format: baud rate 9 600 b/s, no parity check, 8-bit data, 1 stop
bitMSComm1.OutBufferCount=0; Clear the send bufferMSComm1.InBufferCount
=0; Clear the receive bufferMSComm1.PortOpen
=True; Open the serial
portMSComm1.InputMode=1; Retrieve data in binary formMSComm1.InputLen
=0; Read all data in the buffer at one time
Due to space limitations, the code for the data sending and receiving parts is no longer given.
3 Communication program design of the lower computer
The lower computer program includes the initialization part, the data receiving part and the data output part.
The USART inside Atmega16 is a highly flexible serial communication device, which is very convenient to use. The baud rate generator of the microcontroller serial communication can be generated by its internal clock. The baud rate register UBRR is used to set the required baud rate. The calculation formula for the asynchronous normal mode baud rate is BAUD=fosc/16(UBRR+1). For a baud rate of 9 600 b/s (consistent with the host computer), when fosc=8 MHz, the value of UBRR is 51. The data transmission format is: 1 start bit, 8 data bits, and 1 stop bit. The program flow is shown in Figure 4.
The initialization part of the program code is as follows:
ldi r16, 0x20
out UCSRA, r16; set the serial communication mode
ldi r17, 0x00
out UBRRH, r17
ldi r16, 0x33
out UBRRL, r16; set the baud rate of the serial communication
ldi r16, 0x86
out UCSRC, r16; set the data format of the serial communication
ldi r16, 0x18
out UCSRB, r16; enable serial communication
The other parts of the code are too long to be listed here.
The piezoelectric ceramic driver is designed based on serial communication. The serial communication control provided by Visual Basic 6.0 can easily realize the exchange of serial port data. The system has a short development cycle and high efficiency, and the debugging of the serial communication program can be assisted by many tool software (such as the serial port debugging assistant), so there are many advantages to using serial communication. Although some computer motherboards do not have serial interfaces (such as laptops) and are replaced by USB interfaces, serial communication can also be used. The method is to use the USB to serial port method. The hardware requires an adapter cable and the driver must be installed when using it. The serial port number is automatically assigned by Windows, that is, the system virtualizes a serial port, and the usage of this port is exactly the same as the real serial port.
References
[1] Chen Xiutao, Hou Zaihong, Tan Fengfu, et al. A target precision tracking system based on piezoelectric ceramics [J]. Microcomputer Information, 2010, 26(8-1): 32-33.
[2] Zhu Huazheng, Fan Dapeng, Zhang Zhiyong, et al. Development of precision optical path deflection and focal length adjustment mechanism [J]. Laser and Infrared, 2009, 39(10): 1028-1032.
[3] Li Zhaoqing, Han Tao. Serial port technology [M]. Beijing: National Defense Industry Press, 2004.
[4] Wu Aiping. Design of temperature measurement and control system based on VB and single chip microcomputer [J]. Modern Electronic Technology, 2010(8): 208-210.
[5] Wang Ping, Zhang Xindong. Design of data acquisition system based on intelligent instrument [J]. Automation and Instrumentation, 2009(4): 9-10.
Previous article:LED driver power performance design requirements
Next article:Solutions to Insufficient IC Driving Current in Power Supply Design
Recommended ReadingLatest update time:2024-11-16 18:09
- Popular Resources
- Popular amplifiers
- MathWorks and NXP Collaborate to Launch Model-Based Design Toolbox for Battery Management Systems
- STMicroelectronics' advanced galvanically isolated gate driver STGAP3S provides flexible protection for IGBTs and SiC MOSFETs
- New diaphragm-free solid-state lithium battery technology is launched: the distance between the positive and negative electrodes is less than 0.000001 meters
- [“Source” Observe the Autumn Series] Application and testing of the next generation of semiconductor gallium oxide device photodetectors
- 采用自主设计封装,绝缘电阻显著提高!ROHM开发出更高电压xEV系统的SiC肖特基势垒二极管
- Will GaN replace SiC? PI's disruptive 1700V InnoMux2 is here to demonstrate
- From Isolation to the Third and a Half Generation: Understanding Naxinwei's Gate Driver IC in One Article
- The appeal of 48 V technology: importance, benefits and key factors in system-level applications
- Important breakthrough in recycling of used lithium-ion batteries
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- MPXV2202DP connected to IN132 output abnormality, I don't know how to deal with it
- CES 2021 Complement Event Activity Recognition on IMU with Machine Learning Core
- Tektronix Prize-giving Event | Popular Applications of Semiconductor Materials and Device Test Technology
- Internet of Things vs Industrial Internet of Things: 10 Differences That Matter
- The stm32f030c8t6 chip crashes as long as it fetches data during an interrupt
- 【Arduino】168 sensor module series experiments (219) --- INMP441 omnidirectional microphone
- The upcoming nrf52840 metro express development board
- Electronic Instrumentation and Electrical Measurement
- Analysis of EMI radiation signal strength
- Research on the Development of Radio Frequency Filter Materials Industry