printf("\nEnter command string:\n");
gets(command); strcat(command,"\n"); /* SCPI requires line feed */
if(command[0] == 0x19) send_ctlc(); /* If ^Y then send ^C */
else if(command[0] != ’q’) {
for(i=0; i<strlen(command); i++) {
/* Wait for DSR and transmitter hold register empty */
while(!(inportb(LSR) & inportb(MSR) & 0x20)) ;
outportb(THR,command[i]); /* Send character */
}
}
if(strpbrk(command,"?")) {
/* If query then get response */
c = 0;
do {
while(int_buf_count && !kbhit()) {
putch(c = *int_+); int_buf_count--;
if(int_buf_out >= i INT_BUF_size) int_buf_out = int_buf;
}
if(kbhit()) {
if(getch() == 0x19) send_ctlc(); /* if ^Y then send ^C */
c = 0xa;
/* Terminate loop */
}
}
while(c != 0xa);
}
/* End if */
}
while(command[0] != ’q’);
/* ’q’ to quit program */
outportb(IER,inportb(IER) & 0xfe);
/* Disable UART interrupt */
outportb(MCR,0x1);
/* Disable IRQ buffer, DTR = 1 */
/* Disable IRQ4 in 8259 interrupt controller register */
outportb(INT_con1,inportb(INT_con1) | ~IRQ4_enab);
setvect(IRQ4_int,oldvect);
/* Restore old interrupt vector */
return(0);
}
RS-232 Operation Using Turbo C
(continued)
Continued on next page
6
Chapter 6 Application Programs
RS-232 Operation Using Turbo C
195
Содержание 34401A
Страница 12: ...1 Quick Start 1 ...
Страница 26: ...2 Front Panel Menu Operation 2 ...
Страница 50: ...3 Features and Functions 3 ...
Страница 103: ...4 Remote Interface Reference 4 ...
Страница 135: ...SCPI Status System 4 Chapter 4 Remote Interface Reference The SCPI Status Model 135 ...
Страница 170: ...5 Error Messages 5 ...
Страница 182: ...6 Application Programs 6 ...
Страница 196: ...7 Measurement Tutorial 7 ...
Страница 214: ...8 Specifications 8 ...
Страница 222: ...Product Dimensions TOP Product Dimensions All dimensions are shown in millimeters 8 Chapter 8 Specifications 223 ...