5.10Programming Example
The following C program segment demonstrates how to program an
outp(0x300,0x55); | /* writes 55h to Port A */ |
outp(0x301,0x5F); | /* writes 010b to Port B upper 3 bits*/ |
/* sets Port B lower 5 bits for input */ | |
outp(0x302,0xFF); | /* initializes Port C for input */ |
Port_B = inp(0x301); | /* reads data from Port B */ |
/* Port_B(bit7) = '0' and Port_B(bit5) = '0' due to 'masking' */ Port_C = inp(0x302); /* reads data from Port C */
outp(0x306,0x76);
/* INT7 - INT4 set for Level Sensitive Active High Interrupt Mode */
/* INT3 - INT0 set for Edge Sensitive
/* External Interrupt Source Enabled */
/* External Interrupt Source set for
outp(0x305,0x77);
/* Enables six Port C interrupt sources */
/* Enables INT6,INT5,INT4,INT2,INT1,INT0 */
31 |