Research on the Application of Microcontrollers in Ultrasonic Control Systems
2026-04-06 06:21:38··#1
The TI MSP430 microcontroller was adopted as the core device of the controller to meet the current development trend of low power consumption, high integration, and miniaturization in instrument design. The PC monitoring software was developed using VC++6.0, and the microcontroller program was designed using C. Serial communication between the PC and the microcontroller was realized through RS-232C, thereby realizing the controller's control function over the ultrasonic instrument. 1 Introduction With the continuous development of computer technology, microcontrollers, and ultrasonic technology, ultrasonic instruments have also developed rapidly, with wide applications and a growing market. Ultrasonic applications mainly fall into two categories: power ultrasound and detection ultrasound. Due to the many characteristics of power ultrasound processing technology, compared with other processing technologies, it can greatly improve processing speed and efficiency, improve processing quality, and complete processing tasks that general technologies cannot accomplish. The main task of this paper is to study the control system applied to a power ultrasonic instrument and to measure and control its working process and status. Its main functions include: ① adjusting the duty cycle of the drive pulse; ② controlling the running sequence of the ultrasonic instrument; ③ detecting the frequency of the signal source. 2. Ultrasonic Instrument Control System Block Diagram The ultrasonic instrument control system is used to control the operation of the ultrasonic instrument and detect the frequency of its signal source. It mainly consists of a PC and an ultrasonic instrument controller. The controller is an intelligent measurement and control instrument, composed of an MSP430 microcontroller and its peripheral circuits. The PC and the MSP430 microcontroller communicate via RS232-C serial port. The control system block diagram is shown in Figure 1. The system adopts asynchronous serial communication, using RS-232C full-duplex transmission to realize data transmission between the PC and the microcontroller, thereby achieving the purpose of the PC controlling the microcontroller and realizing the control function of the ultrasonic instrument control system. Figure 1. Ultrasonic Instrument Control System Block Diagram 3. Detailed Hardware Design of the Ultrasonic Instrument Control System The hardware part of the control system consists of a PC and an ultrasonic instrument controller. A commonly used microcomputer can meet the requirements. The design of the ultrasonic instrument controller is the core of this system. The entire controller hardware circuit consists of an MSP430 and its interface circuit. 1. Level Conversion Circuit. Because the serial port level of the MSP430 microcontroller is TTL level, and the characteristics of TTL level are incompatible with the electrical characteristics of RS232, the serial port level must be converted in order for the MSP430 microcontroller's serial port to communicate with the RS-232C interface. In this system, the asynchronous communication interface circuit uses a new type of level conversion device, MAX3233E. The MAX3233E chip has an internal power supply voltage converter that can convert the input +3.3V power supply voltage to the ±12V voltage required for the RS-232C output level. The serial communication system using this chip interface only requires a single +3.3V power supply. 2. Power supply and crystal oscillator circuit. Mainly composed of 7805 and LM317, the integrated three-terminal regulator 7805 maintains a stable 5V voltage between its output terminal and ground terminal. That is, the voltage drop across the internal resistor of the 7805's output current is always 5V. Therefore, as long as the internal resistor is determined, the output voltage of the 7805 is determined and remains very stable. The LM317L is an adjustable three-terminal positive voltage regulator that can provide over 100 mA of current in an output voltage range of 1.2V to 37V. For a high-reliability system design, the choice of crystal is crucial, especially for systems with sleep/wake-up functionality (often using low voltage for low power consumption). This circuit uses two external crystal oscillators: an 8MHz crystal and a 32768 crystal. 3. Reset and PWM Output Circuit. The system reset circuit design must ensure the system can be fully reset and operate stably and reliably under various complex conditions. Poor reset performance will affect the normal operation of the system. This system uses a common power-on reset circuit, ensuring sufficient low-level time. The duty cycle and frequency of the PWM waveform are output from pin P4.3 of the MSP430 microcontroller. The output signal is pulse-shaped by a Schmitt trigger SN7414, isolated by an optocoupler TPL521, and then output from pin 1 of J6. In the MSP430, CCRO is used to control the period T, while the CCR3 register corresponding to the timer is used to control the variable duty cycle. 4. Switch Output Circuit. The PC sends a command, and the microcontroller receives the instruction from the PC via the serial port. Then, it executes the corresponding operation, completing the output of a switch signal with adjustable high and low levels via pin P1.4. The output signal is pulse-shaped by an SN7414 and then isolated by an optocoupler TPL521 before being output from pin 4 of J6. To ensure the stability of the MSP430 microcontroller system and better avoid interference from external signals, the TPL521 is used to electrically isolate the input and output signals. A pull-up resistor is connected to pin 4 of the optocoupler to increase the driving capability and prevent interference. The circuit diagram is shown in Figure 2. Figure 2 Shaping Circuit and Optocoupler Isolation Circuit (a) 7414 Shaping Circuit (b) Optocoupler Isolation Circuit 5. Frequency Detection and JTAG Interface Circuit. This detection circuit is used to detect external frequency signals. The signal is input via pin 4 of J5, and pin 3 is grounded. The signal is shaped by a 7414 and then sent to pin P1.2 of the 149. When the frequency detection command arrives, the watchdog timer enables the interrupt function of pin P1.2. Each interrupt on pin P1.2 counts once; when one second elapses, the watchdog timer disables the interrupt function on pin P1.2. The resulting value is the detected frequency. Connecting the programmable interface to the corresponding pin of the MSP430, and the other end of the interface to a JTAG emulator, allows for in-circuit programming, enabling the program to be re-downloaded to the MSP430 on the circuit board. 6. LCD Display Control Circuit Design. The microcontroller controls the display effect by writing instructions and parameters to the LCD controller. The main function of the LCD controller's control unit is to transmit the data written by the microcontroller to the display memory to the LCD driver system in some form. The driver system alone cannot enable the LCD device to display; a control circuit is also needed to provide the necessary scanning timing signals and display data to the driver system. The SED1335 LCD control board is a control board used for communication between a microcontroller and an LCD module. It receives instructions and data from the microcontroller and generates corresponding timing and data control to operate the LCD module. It can be used with all LCD modules suitable for the SED1335. The SED1335 hardware consists of a CPU interface section, an internal control section, and a driver section for the LCD, as shown in Figure 3. Figure 3: SED1335 Hardware Schematic Diagram 4. Ultrasonic Instrument Control Software Design The software design of the ultrasonic instrument control system is divided into two parts: PC monitoring software design and microcontroller program design. The PC monitoring software is developed using the powerful VC++, mainly considering the complexity and flexibility of the control functions. The microcontroller program design is performed on a new development platform. 4.1 PC Monitoring Software Design The PC monitoring software is the management software of the control system. It is responsible for issuing corresponding commands based on the technical requirements of the control system, controlling the controller to perform corresponding operations, and thus controlling the operation of the ultrasonic instrument. As an intelligent measurement and control system, its powerful control functions and control flexibility are inseparable from software support. In this asynchronous communication program, the sender and receiver must specify two things in advance: first, the character format, that is, specifying the number of bits occupied by each part of the character, whether to use parity check and the check method (even parity or odd parity), etc.; second, the baud rate used and the ratio between the clock frequency and the baud rate. The PC monitoring software includes the following programs: start of switch output, pause of switch output, adjustment of switch output time, PWM signal output, stop of PWM signal, PWM frequency adjustment, PWM duty cycle adjustment, real-time frequency detection, intermittent frequency detection, selection of program running time, and exit of program running. Below is its software block diagram 4. Figure 4 PC monitoring software block diagram 4.2 Microcontroller Program Design The microcontroller program consists of a main program and several subroutines. The program is written in C language and implements the functions of serial communication, switch output, PWM signal output, frequency detection and LCD display. Due to space limitations, only the main program and PWM output program are introduced here. 1. The main task of the microcontroller is to receive data sent by the PC and respond accordingly. Once the microcontroller receives data, it immediately judges the data to determine what operation needs to be performed. After the operation is completed, it returns some data to the PC to report the current operating status of the operated device, and then returns to the data detection loop. The microcontroller uses interrupt mode to receive and send data. In the main program, initialization is performed first. When bit 0 of F1agWord is not zero, it means that data reception is detected, and then the CommandProcess flow is entered to complete the functions of each subroutine. When the FdetectDone (frequency detection completed) signal is detected, the SendOut function is called to send the detected frequency value to the PC and LCD. The block diagram is shown in Figure 5. Figure 5 Main program block diagram 2. In the microcontroller program, the PWM-Propo_Adj and PWM-Frequ_Adj functions respectively complete the duty cycle and frequency adjustment. The duty cycle is adjustable from 0 to 100, and the frequency is adjustable from 0.1 to 10Hz. The program adopts an increment counting mode, and the output mode is 3 (PWM set/reset). This output mode outputs a high level when the value of TBR equals TBCCR3, continuing until the value of TBR increases to TBCCR0. We define the duty cycle of the high level as Proportion: Proportion/100 = (TBCCR0 - TBCCR3)/TBCCR0, TBCCR3 = TBCCR0 * (100 - Proportion)/100. Frequency adjustment uses a segmented method: a step size of 1 in the 1-10Hz range, using a clock frequency of 32768 Hz; a step size of 0.1 in the 0.5-0.9 range, also using a clock frequency of 32768 Hz; and a step size of 0.1 in the 0.1-0.4 range, where the clock frequency of 32768 Hz is divided by 8 to meet the requirements. These two points are noteworthy techniques in the program. Specifically, when using a clock frequency of 32768 Hz, if the desired output frequency is 1Hz, then the value in TBCCRO is 32768. Therefore, if the desired output frequency is 2Hz, the value in TBCCRO is 32768/2. In this program, the microcontroller controls the frequency of the output PWM signal based on the position change of the PC's slider. The author's innovation: This paper studies an ultrasonic instrument control system based on the MSP430 microcontroller. It mainly utilizes the MSP430 series microcontroller development tools to program the microcontroller and complete the hardware and software design of an intelligent measurement and control system. The research on the entire system demonstrates the characteristics of the MSP430 FLASH series microcontroller, making it suitable for low-power applications and miniaturized instruments. References: [1] Li Chaoqing, ed. PC and single-chip microcomputer data communication technology [M]. Beijing University of Aeronautics and Astronautics Press, 2002 [2] Sonam Gyaltsen, Song Guobing, Huang Qin. RS-485 communication based on MSP430 single-chip microcomputer [J]. Electronic Engineer. 2001 (11) [3] Wang Pengfei, Wang Baoqiang. Research on DC motor PWM speed regulation system based on MSP430 single-chip microcomputer [J]. Journal of Chengdu University of Information Technology. 2003, Vol. 18, No. 2 [4] Wu Lizhen, Zeng Yingsheng. Design of multi-ultrasonic signal fusion processing system based on AT89C52 single-chip microcomputer [J]. Microcomputer Information, 2006, 11-2: 86-88