/* * LED1190.C * * Simple Demo Program for Micro/sys SBC1190 * Embeddable Computer * * This program merely blinks the red LED on the SBC1190 once * per second. It is useful for simple download and debug testing. * * 6/5/98 Micro/sys, Inc. Glendale, CA (818) 244-4600 * */ #include #define P1DIR 0xFF50 #define P1PIN 0xFF52 #define P1CON 0xFF54 #define P1LTCH 0xFF56 #define REDLED 0x40 /* port pin P1.6 */ void delay_500ms(void); void main(void) { outp(P1CON, inp(P1CON) & ~REDLED); /* setup pin as I/O */ outp(P1DIR, inp(P1DIR) & ~REDLED); /* setup pin for output */ for(;;) { outp(P1LTCH, inp(P1LTCH) & ~REDLED); /* turn on LED */ delay_500ms(); /* a rough delay */ outp(P1LTCH, inp(P1LTCH) | REDLED); /* turn off LED */ delay_500ms(); } } #ifdef __TURBOC__ void delay_500ms(void) { long start_time; start_time = biostime(0, 0l); while (biostime(0, 0l) <= start_time + 9) ; } #else /* Microsoft C */ void delay_500ms(void) { long start_time,timenow; _bios_timeofday(0,&start_time); do { _bios_timeofday(0,&timenow); } while (timenow <= start_time + 9); } #endif