Serial Ports

The serial ports of the IB1000/2/3 are controlled by the EM1000 located on the NB10x0 network board.

A Tibbo BASIC/C application running on the EM1000 works with serial ports through the ser. object. The object takes care of the data transmission through the TX line as well as data reception through the RX line. When the flow control of a serial port is enabled (ser.flowcontrol = 1 — ENABLED), the ser. object also handles the RTS and CTS lines of this port automatically.

With flow control disabled, the CTS and RTS lines can be controlled by the application as general-purpose I/O (GPIO) lines. As the DTR and DSR lines of ports are always treated as GPIO lines, the ser. object does not "touch" them. Actually, even the TX and RX lines of each port can be controlled as GPIO lines, but this is only possible when the corresponding serial port is "closed" (ser.enabled = 0 — NO). I/O line control is effected through the io. object.

The IB1002 and IB1003 boards have universal RS232/422/485 ports. Two interface selection lines — HD/FD and RS_MODE — are provided for each port and connected to the GPIO lines of the EM1000:

To select RS232, RS422, or RS485 mode for a serial port, set up the HD/FC and RS_MODE lines as shown in the table below. The ser.interface property must also be set correctly:

Mode

HD/FD

RS_MODE

ser.interface

RS232

HIGH

LOW

0 — PL_SER_SI_FULLDUPLEX

RS422

HIGH

HIGH

0 — PL_SER_SI_FULLDUPLEX

RS485

LOW

HIGH

1 — PL_SER_SI_HALFDUPLEX

The RS485 mode is half-duplex, which means that only a transmission or reception can occur at any given time. In this mode, the RTS line is used for direction control, which is handled by the EM1000 automatically. The RTS line should be LOW for data input and HIGH for data output. This is achieved by setting ser.dircontrol to 0 — PL_SER_DCP_LOWFORINPUT.

Do not forget that all lines of the EM1000 are configured as inputs by default. Any line that should work as an output must be configured as such. This is done through the io.enabled property of the io. object. The only exceptions are the TX and RX lines. The TX line automatically becomes an output and the RX line automatically becomes an output once a serial port is enabled (ser.enabled = 1 — YES).

The HD/FD and RS_MODE lines have pull-up and pull-down resistors, respectively. On start-up, the HD/FD line defaults to HIGH (full-duplex mode) and the RS_MODE line defaults to LOW (RS232 mode).


Serial Port 1

Line

Corresponding EM1000 I/O line

IC1000 cable line

RX (input)

GPIO8/RX0

17

TX (output)

GPIO9/TX0

19

CTS (input)

GPIO16/CTS0

33

RTS (output)

GPIO0/RTS0

1

DSR (input)

GPIO20/DSR0

41

DTR (output)

GPIO4/DTR0

9

HD/FD*

GPIO32

30

RS_MODE*

GPIO33

28

*IB1002 and IB1003 boards only


Serial Port 2

Line

Corresponding EM1000 I/O line

IC1000 cable line

RX (input)

GPIO10/RX1

21

TX (output)

GPIO11/TX1

23

CTS (input)

GPIO17/CTS1

35

RTS (output)

GPIO1/RTS1

3

DSR (input)

GPIO21/DSR1

43

DTR (output)

GPIO5/DTR1

11

HD/FD*

GPIO34

26

RS_MODE*

GPIO35

24

*IB1002 and IB1003 boards only


Serial Port 3

Line

Corresponding EM1000 I/O line

IC1000 cable line

RX (input)

GPIO12/RX2

25

TX (output)

GPIO13/TX2

27

CTS (input)

GPIO18/CTS2

37

RTS (output)

GPIO2/RTS2

5

DSR (input)

GPIO22/DSR2

45

DTR (output)

GPIO6/DTR2

13

HD/FD*

GPIO36

22

RS_MODE*

GPIO37

20

*IB1002 and IB1003 boards only


Serial Port 4

Line

Corresponding EM1000 I/O

IC1000 cable line

RX (input)

GPIO14/RX3

29

TX (output)

GPIO15/TX3

31

CTS (input)

GPIO19/CTS3

39

RTS (output)

GPIO3/RTS3

7

DSR (input)

GPIO23/DSR3

47

DTR (output)

GPIO7/DTR3

15

HD/FD*

GPIO38

18

RS_MODE*

GPIO39

16

*IB1002 and IB1003 boards only


Serial Ports

Serial Port 1

Serial Port 2

Serial Port 3

Serial Port 4