Go to Triangle Digital Support Home Page TDS9092 TECHNICAL MANUAL
Hardware support
Serial communications
Live website search
Enter key words
 

SERIAL COMMUNICATIONS

 

'(KEY)

( - a )

Address of user variable vectoring (KEY)

'?TERMINAL

(  -   )

Address of user variable vectoring ?TERMINAL

'EMIT

( - a )

Address of user variable vectoring EMIT

(KEY)

( - c )

Receive binary byte c from serial port 1

*(KEY)

( - c )

(_SERIAL2.TDS) Receive binary byte c from serial port 2

*?TERMINAL

( - f )

(_SERIAL2.TDS) f=1 on receipt of any character from serial port 2

*EMIT

( c - )

(_SERIAL2.TDS) Send lower byte of c to serial port 2

1FORTH

(  -   )

(_SERIAL2.TDS) Redirect serial I/O to port 1

1NOBODY

(  -   )

(_SHELTER.TDS) Empty serial 1 input buffer, throw away contents

232OFF

(  -   )

Turn serial ports off to save power

232ON

(  -   )

Turn serial ports on after saving power

2>

(  -   )

(_SERIAL2.TDS) End of structure <2 . port 2 I/O . 2>

2SERIAL-INITIALISE

( n - )

(_SERIAL2.TDS) Initialise serial port 2 & fifo buffer

2FORTH

(  -   )

(_SERIAL2.TDS) Redirect serial I/O to port 2

2NOBODY

(  -   )

(_SERIAL2.TDS) Empty serial 2 input buffer, throw away contents

<(KEY)>

( - c )

Receive lower byte of c from serial port 1

<2

(  -   )

(_SERIAL2.TDS) Start of structure <2 . port 2 I/O . 2>

<?TERMINAL>

( - f )

f=1 on receipt of Ctrl+c from serial port 1

<EMIT>

( c - )

Send lower byte of c to serial port 1

?1DATA

( - f )

(_SERDTA.TDS, _SHELTER.TDS) f is true if data pending on port 1

?2DATA

( - f )

(_SERIAL2.TDS) f is true if data pending on port 2

?TERMINAL

(  -   )

Vectored word. Normally does <?TERMINAL>

BAUD

( n - )

Set serial port 1 to baud rate n

BELL

(  -   )

Uses EMIT . Sounds bell

DOWN

(  -   )

Uses EMIT . Send cursor down one line

EMIT

( c - )

Vectored word. Normally does <EMIT>

HOME

(  -   )

Uses EMIT . Home cursor

LEFT

(  -   )

Uses EMIT . Send cursor left one character

PAGE

(  -   )

Uses EMIT . Clear screen and home cursor

RB

( - a )

Receive data rate for serial port 2

RBAUD

( n - )

(_SERIAL2.TDS) Set receive baud rate on serial port 2

RIGHT

(  -   )

Uses EMIT . Send cursor right one character

SHELTER

(  -   )

(_SHELTER.TDS) Convert serial port 1 input to interrupt version with fifo buffer

TB

( - a )

Transmit data rate for serial port 2

TBAUD

( n - )

(_SERIAL2.TDS) Set transmit baud rate on serial port 2

UP

(  -   )

Uses EMIT . Send cursor up one line

 

Some of the words given above which support serial communications are not in the Forth ROM but come in the following files. Others are redefined by these files.

 

_SERIAL2.TDS

Provides interrupt driven second serial port. Input data is put in a fifo buffer.

_SERDTA.TDS

Check if a byte is pending on serial port 1 input

_SHELTER.TDS

Interrupt-driven serial port 1 input with fifo buffer

HARDWARE

The inputs to the serial ports can be true RS232 levels (at least �3.0V) or just TTL.

The outputs are at least �5.0V under 3K load. The steady state is the negative voltage, which is logic 1 in RS232 terms. The voltages are generated on the TDS9092 from the +5V output of the regulator. No negative supply is needed and the card can be run from a single battery of +6V to +16V.

To save power the serial port drive chip can be turned off. This is described in the section LOW POWER OPERATION.

SERIAL PORT 1

Pin connections:

 

SIN1 Serial input 1

pin a25

SOUT1 Serial output 1

pin c25

 

Serial port 1 is a hardware UART built into the 6301 microprocessor. See 6301 MICROPROCESSOR DATA for details you need which are not here or in the word list.

Baud rates supported on serial port 1 are:

 

Transmit:

76800 38400 19200 9600 4800 2400 1200 600 300 150 75

Receive:

76800 38400 19200 9600 4800 2400 1200 600 300 150 75

 

At power-up the default baud rate is 9600. Transmit and receive baud rates are always the same as each other. Serial port 1 is used for developing software but can also form part of the application.

Change the baud rate as needed, E.g. 1200 BAUD . Include BAUD in the initialisation of your program if serial port 1 is to be used at a speed other than 9600 baud. The default mode is 8 data bits, one start and one stop bit but can be changed to other protocols including synchronous use.

The input and output words on serial port 1 are all vectored and can be redirected to other peripherals as needed. See EMIT in the word list for an example. The section LCD DISPLAYS contains others.

File _SHELTER.TDS is an interrupt driven version of the software for serial port 1. Received characters will not be missed at 9600 baud even when the Forth program is busy doing other work, they are stored in a circular buffer until needed. The position and size of the buffer are user adjustable. The word SHELTER should be executed (once only) to initialise the system.

SHELTER re-vectors input to the new routine and so shelters the application program from any problem of fast serial input bursts. Its use is advised whenever receiving data from another computer but keyboard input is usually slow enough not to require it.

SERIAL PORT 2

Pin connections:

 

SIN2 Serial input 2

pin c14

SOUT2 Serial output 2

pin c13

 

Serial port 2 is implemented in software written in machine code. It is not built into the Forth ROM but comes as file _SERIAL2.TDS on disk. If you will be using Serial port 2 incorporate this as part of your applications software.

Although software, it allows a foreground program to continue while asynchronous data is input to serial port 2. The data received is placed under interrupt into a circular buffer from where it can be taken as needed by the foreground program. This is broadly equivalent to _SHELTER.TDS for serial port 1.

The interrupt routine uses the 16-bit timer and its input capture and output capture interrupts. They should not be used elsewhere in the application.

Put xxxx 2SERIAL-INITIALISE before the second serial port will be needed (execute once only), ideally in the word executed at power-up, where xxxx is the baud rate, e.g.

1200 2SERIAL-INITIALISE

Use *(KEY) and *EMIT to receive and send one byte on serial port 2. Or use the structure <2 . something here . 2> to temporarily redirect EMIT and (KEY) to serial port 2.

Reception of each data bit occurs under interrupt so that the main program does not have to hang around servicing the serial port for the duration of the whole byte. However for transmission the program stays inside *EMIT until the data byte has gone.

Baud rates supported on serial port 2 are:

 

Transmit:

4800 2400 1200 600 300 150 75

Receive:

4800 2400 1200 600 300 150 75

 

Under many circumstances 9600 baud is also possible but should only be attempted after careful experiments with the actual situation. Transmit and receive baud rates are independent of each other.

The data format is one start bit, 8 data bits and one or more stop bits. If 7 bits plus parity is needed this can be provided at a higher level.

CURSOR MOVEMENT

The cursor movement words only work if the codes are set correctly. These words are provided to set the TDS9092 to work with the appropriate terminal:

 

IBM

Same codes as Microsoft Basic. Use with a PC program written in BASICA, GWBASIC, QuickBasic, QBasic or Visual Basic

STD

Use with most dumb terminals such as ADM3A

VT52

Use with VT52 terminals or VT100 set to VT52 mode

 

The words PAGE HOME LEFT RIGHT UP DOWN enable you to write programs which can position the cursor anywhere on the terminal screen. BELL sounds the terminal bell.

Go to Triangle Digital Support Home Page Go to top   Next page