msp430 voltage monitoring

Publisher:江上HZLatest update time:2016-08-25 Source: eefocusKeywords:msp430 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1. Restrictions on Use:

    When using MSP430x41x devices, it should be noted that there are significant differences between the x413, x417 and x419 devices.

For SVS, 413 and 419 are typical examples. 413 only has 1.9V voltage monitoring. Not only is the voltage value not selectable, but it can only measure the voltage from VCC. 419 not only has SVSIN to monitor external voltage, rather than being limited to the internal voltage of VCC, but also has 14 different voltages to choose from, which can monitor internal or external voltages at will.

    If you want to use 413 to indicate low battery, it will not alarm unless it is 1.9V, so it is not suitable for devices powered by lithium batteries, and is only suitable for devices using disposable dry batteries. If you want to use lithium battery indication, either do not use 413 or use a comparator.

2. Misunderstandings:

    When using SVS on 41x devices, many people may misread the manual or use it without reading it carefully, resulting in software writing errors. Although these will not cause major problems, they are indeed problems that should not occur.

    VLDx sets the voltage value, 0 is to turn off SVS, 1-15 are all enabled, 15 is to monitor the external signal input from SVSIN, 1-14 are from small to large to monitor the internal VCC voltage from low to high. On the 413 device, since there is only one 1.9V gear, the effect is the same as long as it is not 0. Of course, if you want to be compatible with the software of the entire 41x series, you should still use the corresponding voltage value option, that is, 1.

    SVSON is the most easily misused bit. Many examples on the Internet will write code similar to the following when setting SVSCTL:

#define VLD_3V7 0xe0

void low_bat_test(void)

{

SVSCTL = SVSON + VLD_3V7;

_NOP();

_NOP();

_NOP();

if(SVSCTL & SVSOP)

//Low voltage indication

else

// Turn off the low voltage indication

SVSCTL = 0;

}

    This is actually a misunderstanding. The English manual specifically notes in capital letters that the SVSON bit is not used to turn on SVS. This bit is automatically turned on when VLDx>0, so it is obvious from the above example that the author of the code thought it was a switch to turn on SVS.

The correct way to write it is SVSCTL = VLD_3V7; and then when we check the value of SVSCTL, it becomes 0xe4.

    Another thing that I missed without reading carefully is about delay. Although the manual says that SVSON is automatically set when VLDx>0, if you read that chapter carefully, you will know two other things:

    1. When starting (from off to on) or changing the monitoring voltage, the SVS module cannot start working immediately and must wait for a while. The waiting time for starting and changing the voltage is also different, which is about 50us and less than 12us respectively.

    2. The SVSON bit does not act immediately after setting VLDx to a non-zero value. It can be used as an indicator of the stability of the SVS system. Before the SVS module is ready, the SVSON bit is still 0. When SVSON is 1, it means that the module is ready and can work.

    So we can change the above program into this:

#define VLD_3V7 0xe0

void low_bat_test(void)

{

SVSCTL = VLD_3V7; //This sentence directly sets the voltage value and does not modify the SVSON bit

while((SVSCTL & SVSON) != SVSON); //This sentence is to wait infinitely until SVSON is 1 before continuing

if(SVSCTL & SVSOP)

//Low voltage indication

else

// Turn off the low voltage indication

SVSCTL = 0;

}

    Did you notice the difference between the code and the previous one? I am just throwing out some ideas to stimulate discussion. If I have made any mistakes, please point them out. Let’s learn and improve together.

Keywords:msp430 Reference address:msp430 voltage monitoring

Previous article:How to improve MSP430 C language programming efficiency
Next article:MSP430 timer interrupt usage summary

Latest Microcontroller 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号