//--------------------------------------------------------------- // L312.C // Wait for a positive edge at bit-0 of port KEY_PB // using Functions. // // C Code for the SBC188 Board. // C.P. Diduch, Dec 1999. //--------------------------------------------------------------- #define KEY_PA 0x138 // 82C55A port addresses for PA, #define KEY_PB 0x13A // PB, #define KEY_PC 0x13C // PC and the #define KEY_CON 0x13E // Control Register. #include // conio.h contains prototypes for // inportb() and outportb(). void WAITP(void); // Function declarations (prototypes). void PPI_INIT(void); //--------------------------------------------------------------- void main() { PPI_INIT(); WAITP(); } //--------------------------------------------------------------- void WAITP(void) { while( (0x01 & inportb(KEY_PB)) != 0) {} while( (0x01 & inportb(KEY_PB)) == 0) {} } //--------------------------------------------------------------- void PPI_INIT(void) { outportb(KEY_CON, 0x82); // Initialize KEY_PC and KEY_PA } // as OP ports and KEY_PB as IP. //---------------------------------------------------------------