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.
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
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:
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
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.
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:
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.
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:
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.