Serial Port and General-Purpose I/O Lines
#8 |
P8 |
Input/output |
General-purpose input/output line |
#9 |
P7 |
Input/output |
General-purpose input/output line |
#10 |
P6 |
Input/output |
General-purpose input/output line |
#11 |
P1 |
Input/output |
General-purpose input/output line |
#12 |
P0 |
Input/output |
General-purpose input/output line |
#15 |
P3 (DTR) |
Input/output (output) |
General-purpose input/output line Data terminal ready output |
#16 |
P2 (DSR) |
Input/output (input) |
General-purpose input/output line Data set ready input |
#17 |
TX |
|
Serial transmit line |
#18 |
RX |
|
Serial receive line |
#19 |
P4 (CTS/SEL) |
Input/output (input) |
General-purpose input/output line Clear to send input Full-/half-duplex selection input |
#20 |
P5 (RTS/DIR) |
Input/output (output) |
General-purpose input/output line Request to send output (full-duplex mode) Data direction control output (half-duplex mode) |
Line functions defined by the application firmware are shown in blue
The EM120 features a serial port (RX, TX lines) and several general-purpose I/O lines (P0-P8). All of the above lines are of CMOS type. From the hardware point of view, all general-purpose I/O lines can serve as inputs or outputs. Maximum load current for each I/O line is 10mA.
Simplified structure of EM120's I/O lines is shown on the circuit diagram below. All lines are "quasi-bidirectional" and can be viewed as open collector outputs with weak pull-up resistor. There is no explicit direction control. To "measure" an external signal applied to a pin the OUT line must first be set to HIGH. It is OK to drive the pin LOW externally when the pin outputs HIGH internally.
The application firmware of the EM120 maps certain serial port functions onto the general-purpose I/O pins- these functions are shown in blue in the table at the top of this topic. For example, P5 is a universal input/output but the application firmware can be set to turn this line into the RTS output of the serial port. Therefore, depending on your application you can view P5 as a general-purpose I/O line or specific control line of the serial port (RTS).
Being of CMOS type, the serial port and I/O lines of the EM120 can be connected directly to the serial port pins and I/O lines of most microcontrollers, microprocessors, etc. An interface IC* must be added to the EM120 externally if you want to connect the module to a "true" serial port (for example, COM port of the PC).
Logical signals on the serial port lines of the EM120 are active LOW. TX and RX lines are high when idle, start bit is LOW, stop bit is HIGH; LOW on CTS and RTS lines means "transmission allowed" and HIGH means "transmission not allowed". This is standard for CMOS-level serial ports and is exactly opposite to the signalling on the RS232 cables. Logical signals on the EM120 are inverted because standard interface ICs* invert the signals internally too.
As explained earlier, actual functionality of the I/O lines is firmware-dependent. See serial port and serial communications for details.
* Such as MAX232 for RS232, MAX485 for RS485, etc.