//**************************************************************************
// JJ28-36   Battery Watt-Hours Left	   		           	S215  10 1028
// *************************************************************************
#include "s215-header18-f45.h" //CHANGE TO s215-header18-f46.h IF VERSION D
							   //  BOARD.
#pragma code
//||||||||||||||||||||||| GLOBAL VARIABLES AND DEFINES |||||||||||||||||||||
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
#define BAT100PC 12.8	//Battery voltage when 100% charged.
#define BATZPC 11.0		//Battery voltage when 0% charged.
#define BATCAPACITY 60.	//Battery capacity in watt-hours,
						// (Amp-hrs * 12).
#define CF 1.285 		//Correction factor = actual time/displayed time
float
	ccm = 1.0,				//Charging (solar panel) current ADC multiplier
	lcm = 1.0,				//Load current ADC multiplier
	bveslope = 0.0464, 		//Battery voltage-equation slope
	bveintercept = -8.1605;	//Battery voltage-equation y intercept
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

//|||||||||||||||||||||||||| MAIN PROGRAM ||||||||||||||||||||||||||||||||||
void main (void)
{
float
	batwhleft = 0.5 * BATCAPACITY, //Start out with half the battery's
				//capacity because we don't know it's state of charge.
	bv = 12.0;	//Battery voltage. (Start with 12 V. so running average
				//   won't take so long to settle down.)
InitPorts();
while (1==1)
{
//|||||||||||||||||||||||||| PRIMARY LOOP ||||||||||||||||||||||||||||||||||
bv = Getcv(0);


//. . . Put your code here.


//===========================================================
//|||||||||||||||||||||||| END OF PRIMARY LOOP |||||||||||||||||||||||||||||		
}
}
//|||||||||||||||||||||||| END OF MAIN PROGRAM |||||||||||||||||||||||||||||

