Go to Triangle Digital Support Home Page TDS9092 TECHNICAL MANUAL
Hardware support
Parallel input & output
Live website search
Enter key words
 

PARALLEL INPUT & OUTPUT

 

!

( n a - )

Write the 16-bit n to output address a and a+1

@

( a - n )

Fetch the 16-bit n from input address a and a+1

C!

( n a - )

Write the lower byte of n to output byte address a

C@

( a - n )

Fetch the lower byte of n from input byte address a

CFIGM

- a )

User variable with same content as configuration register for ports A & B

ALLOCATING I/O BITS

The TDS9092 has 35 parallel input-output bits, some of which you can choose to use for other purposes. The section PIN CONNECTIONS has details. This is a summary:

 

Port A

All 8 bits input or all 8 bits output.

Port B

All 8 bits input or all 8 bits output. Alternatively can be used for external matrix keyboard.

Port 6

The 8 bits can be individually inputs or outputs.

Port 5

The 8 bits can be individually inputs or outputs. Also used for on-board EEPROM and external masked interrupts.

Port 2

3 spare input/output bits available. Also used for timer functions.

DRIVE CAPABILITY & INPUT LEVELS

See 6301 MICROPROCESSOR DATA for more electrical specifications.

INPUTS

 

Logic 1 Input

Logic 0 Input

Port A

min 3.5V/5A

max 1.5V/5A

Port B

min 3.5V/5A

max 1.5V/5A

Port 2

min 2.0V/1A

max 0.8V/1A

Port 5

min 2.0V/1A

max 0.8V/1A

Port 6

min 2.0V/1A

max 0.8V/1A

Maximum input capacitance on parallel ports is 12.5pF plus PCB wiring.

OUTPUTS

 

Logic 1 Output

Logic 0 Output

Port A

min 2.8V @ 1mA

max 0.4V @ 3.2mA

Port B

min 2.8V @ 1mA

max 0.4V @ 3.2mA

Port 2

min 2.4V @ 0.2mA

max 0.4V @ 1.6mA

Port 5

min 2.4V @ 0.2mA

max 0.4V @ 1.6mA

Port 6

min 2.4V @ 0.2mA

max 0.4V @ 1.6mA

 

min 1.5V @ 1.0mA

 

DIRECTION OF PORTS A & B

At power-up (except for a few milliseconds when they are indeterminate) all Port A and B pins are inputs, you must set up any outputs needed. In the data direction registers a 1 means output and a 0 is input. For Port A and Port B use the write-only register at address hex 01F0. This has 3 bits:

 

Bit0

0=PortA input

1=PortA output

Bit1

0=PortB input

1=PortB output

Bit2

0=Not keyboard

1=Keyboard mode

 

A copy of the content of address 01F0 should always be written to the user variable CFIGM . You can then change direction on just Port A or Port B without affecting the direction of the other. Read CFIGM , then AND or OR to give the new value, and put it to both address 01F0 and CFIGM . This is necessary because of the write-only nature of 01F0. You can always get its value from CFIGM ; it is a mirror of the content of 01F0. Note that address 01F0 is a single byte, but CFIGM is a 16-bit word (as are all user variables). E.g.

To set A and B as outputs:

3 DUP CFIGM ! $01F0 C!

To change Port B to input:

CFIGM @ 5 AND DUP CFIGM ! $01F0 C!

ADDRESSING INPUT & OUTPUT

The ports are all memory-mapped and have these addresses in hex:

 

Input/Output

Data

Direction Register

Port A

01E0

01F0 bit 0

Port B

01DF

01F0 bit 1

Port 2

03

01

Port 5

15

20

Port 6

17

16

 

It is usually convenient to stay in the DECIMAL base and to define hex characters with the $ prefix. E.g. to output decimal 24 to Port 6:

24 $17 C!

Whenever you use a 16-bit input or output with @ or ! the top byte on the stack (which is the left two digits of the hex number) will be taken from, or put to, the lesser of the two adjacent addresses. The other byte corresponds to the greater of the two addresses.

Note that the addresses of Ports A and B are adjacent. You can input and output to these as if they were a single port at address hex 01DF. E.g. to output hex A39B to Ports A and B:

 

$A39B $01DF !

 

In this example A3 will be put to Port B and 9B will be put to Port A.

Parallel input and output can be almost indefinitely expanded, see the suggestions in PARALLEL INPUT & OUTPUT EXPANSION. This also has more software examples for using I/O.

USING ASSEMBLER FOR I/O

Fastest access to input and output is through assembly code. Simple primitive assembler I/O words can often result in the complete program running close to machine code speeds. Use STA, to output bytes and STX, for 16 bits at a time. For input use LDA, or LDX, or any of the test, add or compare instructions etc.

For example:

 

CODE !AB ( n -  ) PULX, $01DF STX, END-CODE

 

!AB will write the top of the stack to Ports A and B. Use of the immediate with memory instructions can manipulate I/O bits directly and so are even faster:

 

CODE PULSE (  -  ) $17 $80 ## OIM, $17 $7F ## AIM,

END-CODE

 

This does a logical OR of immediate data 80 with the output at address 17 and then a logical AND with immediate 7F. This will give a 5s pulse on bit 7 of Port 6. You can not do this with Ports A and B since if they are set as outputs they can not be read back. Use Ports 6, 5 or 2 when manipulating I/O bits with this type of instruction.

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