Read Supply Voltage

Note: This example is not supported on the Stellaris platform because the Texas Instruments LM4F120H5QR microcontroller lacks an onboard voltage reference and cannot measure their supply voltage.

This example uses the micro-controller's internal ADC to read the supply voltage to the microcontroller and display it on the screen. On an ez430 board this is typically 3.6V. Follow the same setup as for the "Hello World" example. In the code, the application just calls the hal function getVcc3 to get the processor's supply voltage, in millivolts. In the hal file (e.g. hal_mdb1.c) you'll see that getVcc3 is described as: /** Reads the MSP430 supply voltage using the Analog to Digital Converter (ADC). On MDB2, this is approx. 3600mV @return Vcc supply voltage, in millivolts uint16_t getVcc3 While you probably don't need to know the voltage down to the millivolt, this is a good example of using a standard unit of measure (mV) for a function return value.



Next Example: Read IR Temperature Sensor

Previous: Read Color Sensor

Top: Module_Examples