Serial Ports

Top  Previous  Next

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

Tibbo BASIC/C application running on the EM1000 works with serial ports through a "serial" (ser.) object (see "TIDE and Tibbo BASIC Manual"). 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 serial object also handles 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 lines (GPIO). The DTR and DSR lines of ports are always treated as GPIO, the serial object does not "touch" them. Actually, even 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 another object called the "I/O" (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 GPIO lines of the EM1000:

The HD/FD line selects half-duplex (LOW) or full-duplex (HIGH) mode for the serial port.

The RS_MODE line selects "physical" signal mode: RS232 (LOW) or RS422/485 (HIGH).

To select RS232, RS422, or RS485 mode for a serial port, setup the HD/FC and RS_MODE lines as shown in the table below. Ser.interface property of the serial object 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 the 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 the ser.dircontrol= 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 i/o 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 the serial port is enabled (ser.enabled= 1- YES).

The HD/FD and RS_MODE lines have pull-up and pull-down resistors respectively. On startup 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

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

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

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