MC9S12E128 - LVDS (Low Voltage Detect Status) Usage

Discussion created by VincentV on Mar 24, 2006
Latest reply on Apr 10, 2006 by VincentV
As part of a Power-On/Reset test, I would like to make sure that the voltage to the chip is within tolerance.

Looking through the manual, there seems to be a bit in the "VREGCTRL" word at address 0x0019.

The LVDS, or Low-Voltage Detect Status Bit (bit 2) seems to to what I want it to. The manual says that if LVDS is 0, this indicates that, "input voltage V(DDA) is above level V(LVID) or RPM or shutdown mode.

So this seems good. Exactly what I want! The only problem is that on my board, it keeps reporting a '1'. And I really don't think it's the board.

But, to be sure that it isn't my code, I was hoping a few other eyeballs would be great, just in case I did something stupid.

Looking in mc9s12e128.h, this area of memory seems to be defined for easy reference (as _VREGCTRL0). The bit itself seems to be defined individually as VREGCTRL0_LVDS.

So I've written the following code to read it:

voltage = (uint8)_VREGCTRL0.Bits.LVDS; //get LVDS bit


//NOTE: The above line was just to see if I had to set an "enable" bit, which isn't listed in the documentation but is listed in the header

x = printf(" \n\r LVDS is one" );
x = printf(" \n\r LVDS is zero" );

x = printf(" \n\r Voltage Status: %02X", voltage);

Both methods produce a '1' which seems not to be what I want.

But, like I said, it could certainly be some terrible coding on my part. I would appreciate it if someone could help me figure out what's what.

in the header, the relevant lines start at line 918.