#include <main.h>

#include <2408.C>

#define LCD_ENABLE_PIN PIN_B2
#define LCD_RS_PIN PIN_B0
#define LCD_RW_PIN PIN_B1
#define LCD_DATA4 PIN_B4
#define LCD_DATA5 PIN_B5
#define LCD_DATA6 PIN_B6
#define LCD_DATA7 PIN_B7
#include <lcd.c>

 
unsigned int keys;

 
void main()
{
	setup_adc_ports(NO_ANALOGS, VSS_VDD);
//	init_ext_eeprom();

   lcd_init();
	output_low(pin_c1);																	// set this pin low
	while(TRUE)
	{
		if(input(pin_c2))		
			{
				while(input(pin_c2));
				keys=read_ext_eeprom(0x00);												// read the eprom data


				output_high(pin_c1);															// set memory busy this end		
//				while(!(ext_eeprom_ready()));
				write_ext_eeprom( 1, keys);												// write the data value to memory in byte 1;				
			    delay_ms(12);																	// allow eeprom to store				
				output_low(pin_c1);															// clearmemory busy this end	
				output_a(keys);
				printf(lcd_putc,"\f 0= %2X ", keys);									// display keys value
				lcd_gotoxy(1,2);																// display on lie 2
				printf(lcd_putc," 1= %2X ", keys);									// display keys value			
				output_a(keys);

			}



	}
 
}
