Ultra-low frequency waveform generator using MSP430F149 microcontroller

Publisher:annye_chengLatest update time:2006-05-07 Source: 电子技术应用 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

    Abstract: This paper introduces the design principle of using MSP430F149 chip to develop ultra-low frequency waveform generator and its application in physiological filter debugging.

    Keywords: MSP430F149 chip microcontroller waveform generator filter system

Ultra-low frequency waveform generators are commonly used as signal sources for simulations in vibration analyzers of manned transportation systems. It is required to operate stably in the range of 0.1Hz to 100Hz, with small waveform distortion, and to be fine-tuned in steps of 0.1Hz. There are many shortcomings in the design of traditional ultra-low frequency waveform generators: (1) general-purpose circuits are used, there are many components, especially the large capacitors, and the waveform has poor stability, large distortion, and is extremely inconvenient to adjust; (2) Application-specific circuits, such as ICL8038 and MAX038, have significantly improved distortion and stability, but are still not suitable for ultra-low frequency applications. Moreover, there are many circuit adjustment components, which require high power supply and are costly. In view of the fact that currently developed vibration analyzers often use microcontrollers, it is of great promotion value to use its surplus software and hardware resources to establish an ultra-low frequency waveform generator with easy adjustment and high precision.

The SSD-J-2 vibration comfort measuring instrument developed in accordance with the UIC513 international standard "Vibration Comfort Evaluation Criteria for Passengers in Railway Vehicles" is a three-dimensional vibration portable analyzer based on MSP430F149, which contains physiological filters for up and down, left and right, and front and rear vibrations. In order to adjust and calibrate the accuracy of this set of physiological filters, a PWM output end of the microcontroller is coupled with a type II RC filter to form an ultra-low-frequency wave generator that is easy to adjust with the support of software. It has been proven in practice that its performance meets the technical requirements of the UIC513 standard.

1 Internal structure of MSP430F149

MSP430F149 is the latest 16-bit ultra-low-power mixed-signal microcontroller launched by TEXAS INSTRUCMENTS in the United States. It has Flash memory and is highly flexible, making it easy to modify codes and product after-sales upgrades. It uses a reduced instruction set (RISC) with a 125ns instruction cycle, and most instructions are completed within one instruction cycle. The supply voltage is 1.8V ~ 3.6V, and its ultra-low power consumption (supply voltage 2.2V, working frequency 32kHz, working current is 7 μA ; supply voltage 2.2V, working frequency 1MHz, working current is 250 μA. ) makes it ultra-low power consumption . Low-frequency waveform generators can be designed as battery-powered, long-duration systems. MSP430F149 contains a 12-bit high-performance A/D converter with 8 external channels, a 16-byte programmable buffer with auto-scan function, on-chip reference voltage, a temperature sensor and low battery voltage Detection circuit; There are two internal timers: a 16-bit Timer_B with 7 capture/compare registers and a 16-bit Timer_A with 3 capture/compare registers. In the comparison mode, a PWM signal can be generated to control the frequency of the DCO. , they can be used to meet the requirements; the chip has 60KB flash memory, 2KB RAM, and adopts serial online programming to bring flexible space for users to modify programs and control parameters, and the internal security fuse can make the program Not illegally copied. In addition, MSP430F149 has a powerful interrupt function, 48 I/O pins, two serial communication interfaces, 100,000 times of erasing and writing, and super anti-interference ability.

2 Circuit design principles of ultra-low frequency waveform generator

Vibration analyzers used in human-ridden transportation vehicles have strict filtering requirements for signals. The UIC513 standard stipulates that vibration signals in the Z direction (up and down) should be filtered according to the filtering weighting curve in Figure 1. The filtering frequency band is 0.4Hz ~ 16Hz, and it is step-like. What is important is that testing the filtering effect is a prerequisite for evaluating vibration comfort. The filter circuit can only be put into use after strict calibration and calibration, so it is necessary to use a low-distortion, ultra-low-frequency sinusoidal signal source to calibrate the circuit. Using MSP430F149 for design, the circuit is very simple. The accuracy of the generated waveform depends on the accuracy of the pulse width counter, which can be up to 16 bits. The frequency depends on the size of the sine table designed by the software, the system frequency and the length of time to read the sine table. It should be noted that the designed frequency should be slightly higher than the required frequency, so that the order of the filter circuit from the pulse-width high-control signal to the sine wave signal can be reduced. Its circuit structure is shown in Figure 2.

3 Software design to implement PWM function using MSP430F149

In the software design of this ultra-low frequency waveform generator, the following functional modules are mainly used: Timer_B timer, Timer_A timer, CPU register, on-chip digitally controlled crystal oscillator and XT1 low-power oscillator. Its main program flow The diagram is shown in Figure 3.

3.1 Stable DCO frequency module

DCO is essentially an RC oscillator with the characteristics of an RC oscillator. It is not accurate in frequency setting and conversion, but because it is a digitally controlled oscillator, it can be calibrated by a known frequency-stable crystal oscillator, such as a 32768Hz watch crystal, so that the DCO reaches an accurate frequency. Because MSP430F149 does not contain frequency-locked loop digital logic, it is only possible to calibrate the DCO through "soft frequency locking" through software, which is very important.

The procedure is as follows:

Setup_TA mov #TASSEL1+TACLR,&TACTL; set TA clock SMCLK

Setup_CC2 mov #CCIS0+CM0+CAP,&CCTL2;Set CCR2, input signal:; ACLK, capture mode

Bis #MC1,&TACTL;Set Timer_A: connection mode

Test_DCO bit #CCIFG,&CCTL2; detection capture flag bit

jz Test_DCO

bic #CCIFG,&CCTL2; clear flag bit

AdjDCO mov &CCR2,R14

;R14=captured SMCLK value

sub R15,R14;R14=capture the difference of SMCLK

mov &CCR2,R15; last captured SMCLK value

com #Delta,R14;Delta=SMCLK/ACLK

jlo IncDCO

jeq DoneFLL

DecDCO dec.b &DCOCTL ;Adjust DCO

jmp Test_DCO

IncDCO inc.b &DCOCTL

Jmp Test_DCO

DoneFLL clr &CCTL2 ;Stop CCR2

Clr &TACTL ;Stop Timer_A

    3.2 Timer_B interrupt program that generates PWM

Changing the frequency of sine requires changing the frequency of pulse width signal output. There are three different methods: (1) You can change the accuracy, further change the size of the sine table, and increase or decrease the period of outputting a sine wave; (2) You can Change the main frequency to extend the execution time of the instruction and thereby extend the cycle; (3) Use the interrupt processing delay method to read the sine table to control the output frequency. All three methods are very simple and only need to change a few parameters. The last method is used here.

The procedure is as follows:

TB_ISR inc R11; R11, R12 are used to change the generated sine

;Wave frequency, delayed reading of sine table

cmpR11,R12

J

Incd R15; Increase pointer R15, pointing to the sine table

;The next sine value of

and #Number,R15;Number=sine table size×2

mov Sine_Tab(R15),&TBCCR1

;Sine_Tab is the sine table pointer, TBCCR1

RT reti ;Move into new value

4 Self-calibration system of physiological filter of vibration analyzer with MSP430F149 as the core

Because MSP430F149 provides powerful functions, it can be used to develop portable vibration analyzers. The ultra-low frequency waveform generator is developed on the basis of MSP430F149. It has a simple structure and can calibrate the physiological filter circuit of the vibration analyzer, completing the self-calibration function of the instrument. The system structure diagram is shown in Figure 4.

Using MSP430F149 to design a sine wave generator takes advantage of the special functions provided by this microcontroller, resulting in a simple circuit, easy adjustment, and controllable accuracy. Through verification, waveforms with different frequencies and small distortion can be generated, which can be used as input sources for analog circuits to calibrate them. In addition, the microcontroller can be further used to generate harmonic signals, DC signals, etc., and can be applied to wider fields.

Reference address:Ultra-low frequency waveform generator using MSP430F149 microcontroller

Previous article:Development of a wide-range and high-precision optical fiber sensing thermometer based on single-chip microcomputer
Next article:Online monitoring of operating temperature of power cable joints

Latest Test Measurement Articles
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号