#include <18F8722.h>
#device *=16
#device adc=8
#FUSES NOWDT, WDT128, EC_IO, NOPROTECT, IESO, BROWNOUT, BORV25, PUT, NOCPD
#FUSES STVREN, NODEBUG, NOLVP, NOWRT, NOCPB, NOEBTRB, NOEBTR, NOWRTD, NOWRTC
#FUSES NOWRTB, FCMEN, LPT1OSC, MCLR, NOXINST, MCU
#use delay(clock=40000000)
#use rs232( stream = PC, baud=115200, parity=N, xmit=PIN_G1, rcv=PIN_G2, errors )
#define RLED PIN_F7
#define YLED PIN_H5
#rom int8 0xF0000 = { 1, 2, 3, 4 }
void main()
{
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF|ADC_TAD_MUL_0);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_timer_4(T4_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(VREF_LOW|-2);
setup_low_volt_detect(FALSE);
setup_oscillator(False);
output_low( RLED ) ;
output_high( YLED ) ;
delay_ms( 350 ) ;
output_high( RLED ) ;
output_low( YLED ) ;
delay_ms( 350 ) ;
output_low( RLED ) ;
while( 1 )
{
if( read_eeprom( 0x0000 ) == 1 )
output_high( YLED ) ;
else
output_high( RLED ) ;
delay_ms( 100 ) ;
output_low( YLED ) ;
output_low( RLED ) ;
delay_ms( 100 ) ;
}
}