/*----------------------------------------------------------------------------*/ #include "timer.h" #include "uart.h" /*----------------------------------------------------------------------------*/ MY1SBIT(DRIVE,PIN20); MY1SBIT(INPUT,PIN10); /*----------------------------------------------------------------------------*/ void main(void) { unsigned char wait; timer_init(); uart_init(); uart_puts("\nTESTING RELAY\n"); DRIVE = 1; /* active low */ INPUT = 1; while(1) { if (INPUT==0) { uart_puts("-- Switch ON... "); DRIVE = 0; wait = 3*TIMER_LOOP_1S; do { timer_wait(TIMER_VAL50MS); } while (--wait); uart_puts("OFF.\n"); DRIVE = 1; while (!INPUT); } } } /*----------------------------------------------------------------------------*/