This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Reading a Pin Value



Hi,

I am using the MSP430 F1121A STK.. i.e MSP 430 F1121A development board. I am writing my code in IAR Embedded Workbench 5.0

I have the VCC connected to pin number 2 of MSP430. This Vcc of 3v  is available from a coin battery. I want to read the voltage of the battery at the pin. That is, I want to read the amount of power coming to the Vcc pin or the pin 2.. Can anyone tell me the code for reading the value on pin 2 ASAP ?

Thank You,

Regards,

Sphurthi

  • Seems like you're out of luck.

    The 1121A only has a comparator unit and no ADC. The comparator can compare input voltages against VCC, VCC/2 or VCC/4 or each other, but it cannot measure an absolute value (it has no reference voltage).

    The only thing you can to is to go the opposite way: attach a reference voltage to one of the comparator input pins (such as a zener diode or better a shunt regulator) and compare it against VCC/2. Then at least you can detect whether VCC falls below 2*Vref. That's all you can do with the 1121A.

    The bigger MSPs have a real 10-bit or even 12 bit ADC and these also support measuring VCC/2 agains an internal reference voltage, giving you a fairly precise reading of VCC. But not the 1121A.

     

**Attention** This is a public forum