The Bus 4-Serial Port peripheral provides four bi-directional serial ports. Each port is equipped with an RS-232 driver as well as a TTL- level output for adding RS-485, RS-422 or other adapter modules.
1. Install ADDR jumpers to pins 1-2, 3-4, 5-6, and 7-8 (as shipped).
2. Connect the VAST cable to the SBC2000.
3. Execute the following code:
GLOBAL temp AS INTEGER GLOBAL port AS INTEGER CONSTANT crlf AS STRING = "\013\010" REM Print chars. received on each of REM the four B4SERIAL ports DO FOR port = 4 TO 7 temp = COMM(port,0,0) IF temp <> -1 PRINT crlf, port-4, ":", CHR(temp) ENDIF NEXT port LOOP UNTIL 0
Establishes serial buffers for the off-board serial ports COM4 - COM19.
Where:COMM_BUFFER (port AS INTEGER, address AS LONG, size AS INTEGER)
- "port"
- is the port number of the off-board serial port.
- "address"
- is the starting address of the buffer.
- "size"
- is the size of the buffer.
Input buffers collect incoming characters so that an application does not have to get each character from the port before the next one arrives. Vesta Basic does not automatically provide buffers for the ports on the BUS4SERIAL cards; you must use this routine in your application to provide them.
COMM()
The COMM function provides character-level control of the serial ports.
COMM (port, func, value)
The COMM function controls communication on a byte-by-byte level. This COMM() is identical to the Vesta Basic COMM() function used for onboard serial ports 0 and 1. A B4SERIAL peripheral is controlled by COMM() via ports 4 thru 19 in Vesta Basic, or 0 thru 15 in C.
Port Settings for COMM()
In Vesta Basic:
In C:
Func Settings for COMM()
Func | Operation | Description |
0 | Serial Input | Returns ASCII value of next keystroke from serial port. A minus one ( -1) is returned if no keystroke is received within the time-out interval. |
1 | Serial Output | Sends low eight bits, contained in value, to serial port. Ignore return value. |
2 | Char Pending | Return 0 if no characters pending in the serial port's receives buffer. Returns 1 if character are pending. |
3 | Push-to-talk | Controls push-to-talk line on the RS-485 connector associated with the COM serial port. This mode has no effect if port = 1 (DEV port). VALUE = 1: Push-to-talk asserted VALUE = 0: Push-to-talk released |
4 | Get Time-out | Returns current time-out duration of serial port. |
MODE()
MODE(port, baud_rate, data_bits, parity, stop bits, timeout)
MODE() Parameters
Port | 0 to 7. Port 0 is the COM port, Port 1 is the DEV port. Ports 2 and 3 do not exist. Ports 4-19 are on a B4SERIAL board. |
Baud | Min 150 to max115200 baud. Numbers between prime baud rates will produce non-standard baud rates. If the number is -1, the current Baud rate will remain unchanged. |
Data_bits | 7, 8 or 9. If -1, the current bits per character will remain unchanged. |
Parity | 0 = No parity1 = Even parity2 = Odd parity-1 = Parity unchanged |
Stop bits | 1, 2 or -1. If -1, the current number of stop bits will remain unchanged. |
Timeout | 1 to 32768 in tens of milli- seconds (327.68 sec max). If less than 1, the current timeout will remain unchanged. Timeout affects the COM serial port driver. It has no effect on PRINT, INPUT, INKEY or CHAR_PENDING. |
VMTB allows you to attach up to 4 B4SERIAL boards to a single VAST connector, for ports 4-19.
Each of the four serial ports on the B4SERIAL peripheral has an interrupt request line. The lines are logically OR'ed together and connected to the bus interrupt line, on J1B-6. Since there is no direct way to know which of the four serial ports has generated the interrupt, you will have to read the status registers of each of the ports until you find the one with the request.
The port registers are compatible with the Intel 8250 UART. The register set for each port starts at 0x0000, 0x0010, 0x0020 and 0x0030, respectively.
All jumpers must be installed when using Vesta Basic.
7531 | Address |
JJJJ | 0 |
JJJO | 256 |
JJOJ | 512 |
JJOO | 768 |
Pin | Signal | Pin | Signal |
J1A-1 | N.C. | J1B-1 | GND |
J1A-2 | D7 | J1B-2 | N.C. |
J1A-3 | D6 | J1B-3 | +5V |
J1A-4 | D5 | J1B-4 | N.C. |
J1A-5 | D4 | J1B-5 | N.C. |
J1A-6 | D3 | J1B-6 | INT* |
J1A-7 | D2 | J1B-7 | N.C. |
J1A-8 | D1 | J1B-8 | N.C. |
J1A-9 | D0 | J1B-9 | N.C. |
J1A-10 | N.C. | J1B-10 | GND |
J1A-11 | AEN | J1B-11 | N.C. |
J1A-12 | A19 | J1B-12 | N.C. |
J1A-13 | A18 | J1B-13 | IOW |
J1A-14 | A17 | J1B-14 | IOR |
J1A-15 | A16 | J1B-15 | N.C. |
J1A-16 | A15 | J1B-16 | N.C. |
J1A-17 | A14 | J1B-17 | N.C. |
J1A-18 | A13 | J1B-18 | N.C. |
J1A-19 | A12 | J1B-19 | N.C. |
J1A-20 | A11 | J1B-20 | N.C. |
J1A-21 | A10 | J1B-21 | N.C |
J1A-22 | A9 | J1B-22 | N.C |
J1A-23 | A8 | J1B-23 | N.C. |
J1A-24 | A7 | J1B-24 | IRQ4 |
J1A-25 | A6 | J1B-25 | IRQ3 |
J1A-26 | A5 | J1B-26 | N.C. |
J1A-27 | A4 | J1B-27 | N.C. |
J1A-28 | N.C. | J1B-28 | ALE |
J1A-29 | A2 | J1B-29 | +5V |
J1A-30 | A1 | J1B-30 | N.C. |
J1A-31 | A0 | J1B-31 | N.C. |
J1A-32 | GND | J1B-32 | GND |
Each of the four serial ports has two corresponding connectors. The one that has TTL serial levels (labeled 485A-D) connects an RS-485 or other adapter to the board. The other (labeled COM1-4) provides RS-232C serial levels and modem control lines.
RS-485 | RS-232(COM) | ||
Pin | Signal | Pin | Signal |
1 | GND | 1 | CD |
2 | +5V | 2 | RXD |
3 | TXD | 3 | TXD |
4 | RTS | 4 | DTR |
5 | RXD | 5 | GND |
6 | RX0 | 6 | DSR |
7 | N.C. | 7 | RTS |
8 | DSR | 8 | CTS |
9 | -9V | 9 | RI |
10 | +9V | 10 | +5V |
The RTS line is used as XMIT_ENABLE when an RS-485 Adapter is installed.
The RXD line is the data-receive pin for each 485 connector. RX0 connects to the RS-232 driver-chip's data-receive output. Data can be received from only one source at a time. Assign the COM port to input by placing a jumper shunt across pins 5 and 6 (RXD & RX0). Select the 485 connector for input by removing the jumper shunt and connecting an RS-485 or other adapter to the connector.
The current draw for the B4SERIAL with all four serial ports connected to other serial hardware is 40mA. B4Serial Dimension Drawing Dimensions are in inches.
Dimensions are in inches.