*
* polarity : This specifies the polarity of the interrupt. A non-zero
* argument enables rising-edge interrupt. A zero argument
* enables the interrupt on the flling edge.
*
* This function enables within the 16C48 an interrupt for the specified bit
* at the specified polarity. This function does not setup the interrupt
* controller, nor does it supply an interrupr handler.
*
*============================================================================*/
void enab_int(int bit_number, int polarity)
{
unsigned port;
unsigned temp;
unsigned mask;
/* Adjust for 0 based numbering */
--bit_number;
/* Calculate the I/O address based uppon the bit number */
port = (bit_number / 8) + bas 8;
/* Calculate a bit mask based on the specified bit number */
mask = (1 << (bit_number % 8));
/* Turn on page 2 access */
outportb(ba7,0x80);
/* Get the current state of the interrupt enable register */
temp = inportb(port);
/* Set the enable bit for our bit number */
temp = temp | mask;
/* Now update the interrupt enable register */
outportb(port,temp);
/* Turn on access to page 1 for polarity control */
outportb(ba7,0x40);
/* Get the current state of the polarity register */
temp = inportb(port);
/* Get current polarity settings */
/* Set the polarity according to the argument in the image value */
if(polarity)
/* If the bit is to be set */
temp = temp | mask;
else
temp = temp & ~mask;
/* Write out the new polarity value */
Содержание EBC-LP
Страница 2: ...REVISION HISTORY P N 403 0306 000B ECO Number Date Code Rev Level ORIGINATED 030110 B 03 59 030530 B1...
Страница 68: ...APPENDIX C Mechanical Drawing...
Страница 69: ......
Страница 70: ......
Страница 71: ...APPENDIX D WS16C48 I O Routines and Sample Program Listings...