Agilent Technologies 34401A User Manual

Page 202

Advertising
background image

void interrupt int_char_in(void)

{

enable();

/* Enable hardware interrupts */

if(int_buf_count < INT_BUF_size) {

*int_buf_in++ = inportb(RDR); /* Read byte from UART */

int_buf_count++;

if(int_buf_in >= int_buf + INT_BUF_size) int_buf_in = int_buf;

int_buf_ovfl = 0;

}

else {

inportb(RDR);

/* Clear UART interrupt */

int_buf_ovfl = 1;

}

outportb(INT_controller,End_of_interrupt); /* Non-specific EOI */

}

void send_ctlc(void)

{

outportb(MCR,0x8);

/* De-assert DTR */

delay(10);

/* Wait 10 mS for stray characters */

while(!(inportb(LSR) & 0x20)) ; /* Wait on transmitter register */

outportb(THR,0x3);

/* Send ^C */

while(!(inportb(LSR) & 0x40)) ; /* Wait for ^C to be sent */

int_buf_in = int_buf_out = int_buf;

/* Clear int_char_in buffer */

int_buf_count = int_buf_ovfl = 0;

delay(20);

/* 20mS for 34401 to clean up */

outportb(MCR,0x9);

/* Assert DTR */

}

RS-232 Operation Using Turbo C

(continued)

Chapter 6 Application Programs
RS-232 Operation Using Turbo C

196

Advertising