/*******************************************************************************
 *	TestTemp.c		Greenpower CarComputer Test Program
 *				T.Barnaby,	BEAM Ltd,	2008-09-15
 *******************************************************************************
 *
 * Function:	Displays temperature on the LCD panel
 * Version:	1.0
 */
#include <string.h>
#include <pic18f2520.h>
#include <picLib3.c>

#pragma stack 0x200 0x100		// Setup stack

#define	CLOCK		4000000		// Clock frequency

void main(void) {
	UInt8	d1[] = { 0x11, 0x22, 0x33, 0x44 };
	UInt16	temperature;
	UInt8	buf[16] = "hi";

	// Set up Oscillator
	OSCCON = 0x62;				// Internal 4MHZ
	TRISB = 0x0F;           		// PORTB top 4 bits Output

	PORTB = 0;

	PORTBbits.RB7 = 1;

	i2cInit();
	lcdInit();
	adcInit();
	
	lcdWriteStr(0, 0, "Temperature");
	
	while(1){
		// Measure Temperature
//		temperature = adcRead(2) / 2;	// Calibrated for 10mV/C. Scaled by 2

//		strByte(buf, temperature);
		lcdWriteStr(0, 1, buf);
		delayMs(1000);
	}
}
