Power Expander Status

So I decided to try using an LCD to output the main and power expander voltage. I just used the sample program and put it where it should go, changing “backupBattery” to “powexpBattery”

task usercontrol()
{
	string mainBattery, powexpBattery;

	while(true)														// An infinite loop to keep the program running until you terminate it
	{
		clearLCDLine(0);											// Clear line 1 (0) of the LCD
		clearLCDLine(1);											// Clear line 2 (1) of the LCD

		//Display the Primary Robot battery voltage
		displayLCDString(0, 0, "Primary: ");
		sprintf(mainBattery, "%1.2f%c", nImmediateBatteryLevel/1000.0,'V'); //Build the value to be displayed
		displayNextLCDString(mainBattery);

		//Display the Backup battery voltage
		displayLCDString(1, 0, "PowerExp: ");
		sprintf(powexpBattery, "%1.2f%c", SensorValue(status)/70, 'V');	//Build the value to be displayed
		displayNextLCDString(powexpBattery);

		//Short delay for the LCD refresh rate
		wait1Msec(500);
	}
}

I connected the controller and it ouputed “32.9V”, so I added another zero to the bolded 70 (70 was the divisor on the pdf from vex). It now outputed “3.29V” I tested the voltage manually, and it was about 8. Using just the raw input from the analog port I was using, i found it was outputting 2000 instead of something reasonable like 400-600ish. Why is this happening? The file is below. It doesn’t allow .c files, so it is just a text file.

Edit: I should add that the main voltage works fine

To convert raw sensor data into volts the correct scale factors are either 280.0 (if your power expander is marked A2) or 182.4 (older power expanders). The values published on the former wiki were assuming that sensors returned values in the range 0-1023 when in fact with the cortex and recent versions of ROBOTC they return values in the range 0-4095.