Here is a SW example demonstrating measurement of the bandgap voltage featured on a microcontroller.
The bandgap voltage is routed to an internal ATD channel. ATD converter measures the input voltage and stores it to a variable located in Flash memory.
The SW example project is made in CodeWarrior v5.1 for MC9S12XEP100 device.