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

PARALLEL INPUT & OUTPUT EXPANSION

You can use the two wire I2C bus and I2C I/O chips or hang octal integrated circuits on the data bus to achieve I/O expansion. These are discussed in turn. See PARALLEL INPUT & OUTPUT, for more details of I/O.

I/O EXPANSION ON I2C BUS

The PCF8574 and PCF8574A chips from Philips offer 8 bits of parallel input or output. These low cost chips are very useful for expansion, particularly since you can connect up to 16 devices, giving 128 I/O lines, to just 2 wires of the I2C bus from the TDS9092. They can easily be a few metres from the computer board if necessary without having to add any buffers.

Because of capacitive loading on the I2C data bus the 100K internal pull-up resistance on the TDS9092 may be too high. Check with an oscilloscope on pin a31 and ensure that the signal rises to logic 1 within one bit time of the waveform. If not, add an external resistor from port 5 bit 7 (pin a31) to +5VOUT. Try 100K then lower, the value needed will depend on how many I2C chips are connected and how long the wires are.

I2C expansion

I2C expansion
Click the diagram for more detail, or to save a copy:
1. in Internet Explorer right click on the picture and select "Save Target as..."
2. in Netscape double-click the picture to open the file, then under "File" select the "Save As" option.

 

The file _PCF8574.TDS (comes with Update Service) has the software support. To use an I/O as input, first write hex FF to it (only needs to be done once). For example:

 

$66 7 !8574         ( output 8 bits to PCF8574

                    ( device number 7

$FF 3 !8574 3 @8574 ( input 8 bits from PCF8574

                    ( device number 3

 

Each IC has 3 pins which you tie to 0V or +5V to code for the device number.

I/O EXPANSION ON DATA BUS

For an 8-bit output use an octal latch type 74HC574 and for an input an octal buffer 74HC541. You need negative active address decode lines for these such as the spare chip selects provided on the TDS9092 connector, splitting them further with another decoder if you wish (see diagram).

I/O expansion on data bus

I/O expansion on data bus
Click the diagram for more detail, or to save a copy:
1. in Internet Explorer right click on the picture and select "Save Target as..."
2. in Netscape double-click the picture to open the file, then under "File" select the "Save As" option.

 

The basic Forth word to output the top of the stack to such a parallel 8-bit port is C! and to input 8 bits from 8 logic inputs to the top of the stack is C@ . For example

 

$1F $0182 C!

 

puts the binary pattern 00011111 to address 0182 so that it will appear at the output of the third chip from the left in the diagram. The three pins 12-14 will go to 0V and the five pins 15-19 will be +5V.

To work with individual bits use the logic operators OR AND XOR NOT . Note that an output port implemented as shown cannot be read back so in cases where individual bits are being manipulated a copy should be kept in RAM. For example, to output a pulse of 1ms on bit 3 of the chip on the right (i.e. address 0183):

 

0 VARIABLE 1MEMORY ( for output port copy

: INIT ( part of switch on initialisation

   0 1MEMORY C!  0 $0183 C! ;

: PRESET ( - set bit 3 of output port U4 to logic 1

   1MEMORY C@ $08 OR DUP $0183 C! 1MEMORY C! ;

: RESET ( - reset bit 3 of o/p port U4 to logic 0

   1MEMORY C@ $F7 AND DUP $0183 C! 1MEMORY C! ;

: PULSE ( - output pulse of 1ms on bit 3 of device 4

   PRESET 16 WAIT RESET ;

 

This technique ensures that only the desired bit is affected. All other bits on the same port are left unchanged.

The above examples are in normal Forth but use of the assembler can speed up these and other such primitive functions. For example to output the 16 bits on the top of the stack to all 16 bits of the two output chips define OUTPUT as follows:

 

CODE OUTPUT ( n -   send n to ports at addresses

            ( 0182 and 0183

   PULX,  $0182 STX, END-CODE

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