1433 views|0 replies

1140

Posts

0

Resources
The OP
 

Notes on commonly used modules inside MSP430 microcontroller [Copy link]

The ADC core converts the analog signal into 12-bit data and stores it in the conversion storage register. The final result of the input analog voltage satisfies the formula:
This paper requires two analog signals, pH signal and temperature signal, to be converted into A/D. In order to reduce errors, the method of taking values multiple times and then taking the average value can be adopted, so the serial channel multiple conversion mode is adopted.
When applying the ADC conversion module, the MSP430 series microprocessors can use interrupt functions. Just one command can enter the A/D conversion interrupt, convert in low power mode, wake up the CPU after the conversion is completed, and return to the main program to continue to execute other commands. It is simple and convenient.
Since the analog electrical signal output by the sensor electrode directly enters the microprocessor, and the analog signal can only be received and processed by the microcontroller after being converted into a digital signal, the 12-bit precision A/D conversion module integrated in the MSP430F149 has a built-in reference level generator and a sample-and-hold circuit, which has strong anti-interference ability and can meet the controller's sampling of eight external signals. A0 and A1 in the flowchart are two channels for pH signal and temperature signal conversion, and the final average is used for data processing, which are MSP430F149 ports P1.0 and P1.1 respectively.

3,4 Key working mode design
The key working mode determines how the corresponding subroutine obtains the key value of the key to determine the program flow. In the single-chip microcomputer system, there are two key working modes, namely query scanning mode and interrupt mode.
The query scanning mode means that once the training enters the key scanning mode, it will repeatedly or use the interrupt generated by the internal timer of the single-chip microcomputer to scan the keys at regular intervals. If a key is pressed, it will execute the corresponding subroutine. If no key is pressed, it will continue to scan the key status.
The interrupt mode means that the CPU does not actively scan the keys. When a key is pressed, the key is closed, and the keyboard generates a signal, which is notified to the CPU through a maskable interrupt. If the CPU allows interrupts at this time, it enters the interrupt processing subroutine.

In the design of the intelligent pH meter, since there is only one button on the control panel of the instrument besides the power button to enter the calibration subroutine, if the query scanning mode is selected, it will inevitably cause a waste of CPU. Therefore, the button working mode in this experiment adopts the interrupt mode, which can effectively improve the execution efficiency of the software. The
program is relatively simple. One button corresponds to one bit of a port. The port to be used is set to the read-in state. Before confirming that the key is pressed, a delay period is required to play the role of de-jittering and preventing accidental pressing. If the software determines that a key is pressed, it enters the calibration subroutine, otherwise it directly enters the detection state.

3.5FLASH storage read and write
FLASH technology combines the cost advantage of OTP memory and the reprogrammable performance of EEPROM, and can use the smallest possible cost to maximize the flexibility of EEPROM. The embedded FLASH memory of MSP430F149 is an electrically erasable and programmable memory like EEPROM. The main features are as follows:
Programming can use bit, byte and word operations
Programmable through JTAG, BSL and ISP.
1.8V-3.6V working voltage, 2.7V-3.6V programming voltage.
The number of erase/programming times can reach 100,000 times.
The data retention time ranges from 10 years to 100 years.
60KB space programming time <5 seconds
After the confidentiality fuse is burned out, it cannot be recovered and no access to JTAG can be made.
FLASH programming/erase time is controlled by internal hardware without software intervention.

FLASH memory has the following advantages: data will not be lost after power-on, fast data storage, electrically erasable, large capacity, online programmable, sufficient erase and write times, low price, and high reliability. FLASH can basically replace EEPROM, but the erase operation cannot be performed byte by byte, but can only be performed segment by segment. The
FLASH memory module of MSP430F149 is composed of 128 segments of main memory and 2 segments of information memory. The information memory is 128 bytes per segment, with addresses from 1000H to 10FFH, which are information memory A and B respectively. Each segment of the main memory is 512 bytes, and its address range is 1100H-FFFFH.
There are 3 operations on the FLSAH module: read, write and erase. Reading is very simple, and various addressing modes can be used, which can be easily completed with the help of instructions. Erasing and writing need to be completed according to their inherent operating procedures by controlling the corresponding bits in the 3 control words of the FLASH module. Only the unique combination of control bits can realize the corresponding functions.
The read and write program of the Flash module of MSP430F149 can be completed with one function respectively when writing the program. When it is needed, just call the function directly. If the written data is not erased for a period of time, it can be locked after writing. Of course, it must be unlocked before rewriting. In this experiment, it is mainly used to store some data of the electrode sensor after calibration. These data must be called out when performing pH value calculation and temperature compensation to ensure that the output value is correct at this temperature and the electrode is aged at this time.

This post is from Microcontroller MCU
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list