Returned Values:

AL = 0

;port is available

 

1

;port is busy

int TC_ready(int wait)

{

int i; do {

regs.h.ah=0x61;

int86(0x21,®s,®s);

}while (wait && regs.h.al); return(regs.h.al);

}

3.4.Serial I/O for RS-232 and RS-485

The system allow to the RS-232 and RS-485 to serve serial input/output (character mode I/O) no matter the port is assigned as host or serial port. However, if the port is assigned as host, must select “NONE” as its active protocol.

The INT 34H is dedicated for RS-232 and INT33H is dedicated for RS-485 and the both function calls are functional for host and serial port.

RS-232 port serial I/O using INT 34H

01

Input data

 

 

Entry Parameters:

AH = 1

 

Returned Values:

1) if a character received

AH = 0

AL = Data character

2) if no character received AH = 1

AL = undefined

unsigned char TC_232_char_I()

{

regs.h.ah = 1; int86(0x34,®s,®s); if (regs.h.ah == 0)

return(regs.h.al);

return(255);

}

3-26

Page 27
Image 27
Unitech MR350MKII manual Serial I/O for RS-232 and RS-485, RS-232 port serial I/O using INT 34H, Input data