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




( b a1 a2 - f)

Byte b to addr a1 in IC at a2


( a1 a2 - b f)

Byte b from addr a1 in IC at a2


( - )

Start of own I2C command


( - )

End of own I2C command


( - f )

Receive 1 bit from I2C peripheral


( - b )

Receive 1 byte from I2C peripheral


( b - )

Send 1 byte to I2C peripheral




Support for 8K byte I2C EEPROM


The I2C bus software is built into TDS9092 but the source code is available so that you can modify it to set up another such bus on two other parallel port bits.


The PCF8573 and PCF8583 are low cost clock chips


you can connect externally to the I2C bus. By powering the clock from a battery, date and time can be made non-volatile. These files contains software support.


The PCF8474 and PCF8574A are low cost chips and very useful for I/O expansion, you can connect up to 16 devices, giving 128 I/O lines, to just 2 wires of the I2C bus, see page 130. This file contains software support.


The PCF8582 EEPROM chip on board the TDS9092 is one of a number of available devices which will hang on the same 2-wire bus. These I2C devices are made by Philips, Xicor, Microchip Technology and others. They can be a few meters from the computer board without having to add buffers.

The TDS9092 drives these devices at a speed of about 17K baud. Transfers are synchronous and handshaken. The Forth words not only handle the data but also return a flag which is only true if the transfer actually happened.

In practice you are only likely to need the words I2C! and I2C@ , the write and the read instructions, but the primitives from which they are constructed are made available since they enable you to use other modes in I2C peripherals, such as automatic internal address increment.

Each I2C chip has different possible chip addresses determined by the type of chip it is. For example the PCF8582 has addresses hex 50 and 57, and on the TDS9092 it is connected at address hex 50. Within each chip are several internal addresses which have nothing to do with the first one. In the case of the PCF8582 these are 00 to FF and each represents one byte of EEPROM. You can employ these as non-volatile memory.

Note that neither of these two addresses are the same as the microprocessor address space - that is something else again!

For example, to store 17 to address FF in the on-board EEPROM chip:


$17 $FF $50 I2C!


A 1 will be left on the stack if the transfer is successful, which it should be. Try device address $51 and you will find the transfer fails because there is no IC at that address. Recover the data like this:


$FF $50 I2C@


This leaves on the stack the validation flag with the data fetched underneath. Transfer times are of the order of 1 to 2 ms. After each byte using the on-board EEPROM you should wait for 50ms to allow the device to complete the erase and write. Reading needs no such delay. The EEPROM data shows a maximum of 10000 write cycles for each byte, and data retention of 10 years minimum. Other I2C chips can be added externally.

Although I2C! and I2C@ are the main words for use with I2C devices, it may be necessary to make up others from the primitives STARTI2C  STOPI2C  R1BYTE S1BYTE  R1BIT .

When using I2C words on the TDS9092 the spare bits P50 to P55 should preferably be used as inputs since the I2C words have to change the Data Direction Register of port 5, and the unused bits are always afterwards set to 0 (for input).

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