ICA93LV I2C Communications Adapter User Manual Contents 1. Introduction 1.1. Packing List 2. Configuring the Adapter 2.1. Setting the Adapter Base Address 2.2. Wait State Generator 2.3. Interrupt Generation 2.4. Bus Termination and Protection 2.5. Installing the Adapter 3. Connecting the Adapter to your System 3.1. Connector Pinout 3.2. Normal/Long Distance Mode 3.3. Bus Capacitance Limitations/Cable Choice 3.4. Variable Voltage Bus Power Supply 4. Getting Started 4.1. Resetting the Adapter 4.2.
1. Introduction 2 The I C Communications Adapter is a half length PC interface card designed to fit any IBM PC 2 compatible expansion slot. Based on the Philips PCF8584 bus controller, it features full I C bi-directional 2 compatibility as either a master or slave. I C connections are made via a 9 way “D” socket. This product complies with the requirements of EEC Directive 89/336 for EMC and is CE marked. 1.1. Packing List Your I2C Communications Adapter is supplied with the following items:A.
2. Configuring the Adapter NOTE: MANY COMPONENTS ON THE ADAPTER CARD ARE STATIC SENSITIVE. OBSERVE NORMAL STATIC SENSITIVE PRECAUTIONS WHEN HANDLING THE CARD! The adapter is supplied in a standard configuration which should suit most applications. However, some features are link selectable. Read the following section to change the configuration. The standard configuration is: base address = 0310 (Hex) number of wait States = 1 hardware interrupts disabled bus termination & protection off 2.1.
Important Note: Due to the internal operation of the ICA93, it must not be accessed over the PC bus (read or written) more than once every nine of its own clock cycles. The ICA93 is clocked at 12MHz; therefore it MUST NOT be accessed more than once every 0.75 microseconds. If this requirement is not observed operation may become erratic. This is usually only encountered in very fast PCs, however it must be borne in mind when writing software if say the system hardware might be updated in the future.
3. Connecting the Adapter to your System 3.1. Connector Pinout All external connections are made via a 9 way “D” socket: Pin 1 2 3 4 5 6 7 8 9 NOTE: 3.2. Normal Mode 0V 0V 0V 0V NC SDA (Bi-directional) +V Variable bus voltage SCL (Bi-directional) NC THE PINS MARKED NC MUST NOT BE CONNECTED IN NORMAL MODE. Normal/Long Distance Mode The ICA93 does NOT support the 4-wire long distance mode which the 5V only ICA90 model can operate in. This is the only incompatibility between the two models. 3.3.
4. Getting Started 4.1. Resetting the Adapter A reset forces the adapter into a well defined state, ready for initialisation. The card uses the same reset line as the PC so either a power up or hard reset (press the button on your PC) will suffice. 4.2. Introduction to the Utilities The utilities supplied with the adapter contain simple DOS routines in both C and TurboBASIC, which can be used for setup and basic communications.
5. Using the Utilities Each utility is documented in a standard format, which lists its name, usage, function, and effect on the adapter is given. Following a reset, the adapter should be setup prior to any data transfer. 5.1. C Routines 5.1.1. I2C Setup/Initialisation Routine Name: setup(base, own, sclk) Usage: setup(base, own, sclk); Function: procedure to set up I2C Communications Adapter. Parameters are: int base base address of adapter set by links on circuit board.
Parameters are: int controladdress address of I2C control register. This is equal to 1+(base address of adapter set by links on circuit board). Value Returned: int where status is an integer from 0x00 to 0xFF which indicates the current status of I2C Communications Adapter. See Appendix A for details of the status values returned. I2C status on exit from routine: The status of the I2C Communications Adapter will not be affected by using the getstatus function.
{ int base, slv, setnack; base = 0x310; slv = 0xa0; /* Adapter’s bas address = 0x310 (hex) */ /* I2C Address of slave, this is a typical */ /* write for an I2C static RAM or EEPROM */ setnack = 0; /* Enable Acknowledge (see parameter */ /* descriptions) */ sendaddress(base, slv, setnack); printf(“Start and I2C Slave Address sent\n”); } /* This will send a start and the I2C Slave Address of the device */ /* to be communicated with. */ 5.1.4.
/* This will read a byte of data from a slave previously addressed */ /* by and with acknowledge already disabled by sendaddress. */ /* After reading the data, acknowledge will be re-enabled. */ 5.1.5. Write Data Byte to Slave Routine Name: writebyte(base, data) Usage: writebyte(base, data) Function: procedure to write a byte of data to a slave device whose slave address has already been sent by sendaddress.
#include /* Optional, but recommended if your compiler */ /* supports DOS I/0 functions */ /* This Contains the I2C routines */ #include main { int base, controladdress; base = 0x310; /* Adapter’s base address = 0x310 (hex) */ controladdress = base + 1; /* Control Register address */ sendstop(controladdress); printf(“Stop has been transmitted\n”); }/* This will write a Stop to the I2C Bus */ 5.1.7.
Name: setup (baseaddr%, own%, sclk%) Usage: call setup(baseaddr%, own%, sclk%) Function: procedure to set up I2C Communications Adapter. Parameters are: baseaddr% base address of adapter set by links on circuit board. own% I2C address to which the adapter is to respond in slave mode. This forms the upper 7 bits of the 8 bit address, the lowest bit being the Read(1) or Write (0) bit. This means that if own% = &h57, the card will respond to a Write to address &hAF.
baseaddr% = &h310 ‘* adapter’s base address = 0x310 (hex) * controladdress% = baseaddr% + 1 status% = FNgetstatus%(controladdress%) print”I2C Communications Adapter Status = “;status% ‘* This will read the I2C Communications Adapter’s current status * 5.2.3. I2C Address and Start Sending Routine Name: sendaddress(baseaddr%, slv%, setnack%) Usage: call sendaddress(baseaddr%, slv%, setnack%) Function: procedure to send Start and slave address of device that is to be communicated with.
setnack% this controls whether the I2C Communications Adapter transmits and Acknowledge down the I2C Bus on reception of a byte. The last byte received during a transfer must not be acknowledged, in all other cases acknowledge must be enabled. If setnack% = 0 then acknowledge is enabled, if setnack% = 1 then acknowledge is disabled. Therefore, if the LAST BUT ONE byte is to be read, setnack% should be set to =1; in all other cases it must be set = 0.
Function: procedure to send a Stop (end of communication signal) down the I2C Bus, ending a transmission or reception with a slave that was address previously by sendaddress. Parameters are: controladdress% The address of the I2C Communications Adapter control register, equal to 1+(base address set by links on circuit board). Value Returned:none.
‘* I2C Address of slave, this is a typical read address * ‘* for an I2C static RAM or EEPROM* setnack% = 0 ‘* Enable Acknowledge (see parameter descriptions) * call restart(baseaddr%, slv%, setnack%) print”Restart and I2C Slave Address sent” ‘* This will send a Restart and the I2C Slave Address of the device to * slv% = &ha1 5.3. DLLs for Programming in Microsoft Windows 3.X Environments 5.3.1. Files \readme.doc User Information \c\i2inc.h “C” function prototypes \c\cali2c.
baseaddress is the address at which the adapter has been installed, e.g. 310H ownaddress I2C address to which the adapter is to respond in slave mode. This forms the upper 7 bits of the 8 bit address, the lowest bit being the read (1) or write (0) bit. This means that if ownaddress = 57H the card will respond to a write address of AEH and a read address of AFH. Statuswait is a period of time (in microseconds) to wait for the required 2 bus status.
Setnack 1 for no acknowledge 0 for acknowledge. 2 Parameters returned I Cdata, the data read, if a time-out occurs the ErrCode 8005H is returned. Prerequisites Adapter must be configured using setup, start and read address sent by sendaddress. Functional Description If setnack is 1 the function writes 40H to the control register to establish the correct acknowledge procedure. The data is read from the adapter.
getstatus Function specification: Int getstatus ( ) Parameters returned I Cstatus, the current value of the bus status. Prerequisites Adapter must be configured using setup. Functional description The function reads status word from the adapter and returns it. 2 recover Function specification: Int recover Parameters returned ErrCode. If the bus recovery failed error code 8006H is returned otherwise the status is returned. Prerequisites Adapter must be configured using setup.
When all the bytes have been transmitted a stop is issued and the total number of bytes is returned. Sendbytes can only be used in master write mode. getbytes Function specification Int getbytes (int far *transferarray) The far pointer must point to a single dimensional array the format of which is detailed below. The calling function must have initialised elements 0, 1 and 2 prior to calling the function.
Getbytes can only be used in master read mode. slavelastbyte Function specification void slavelastbyte( ) Parameters returned none. Prerequisites Adapter must be configured using setup. This function would normally only be called following the end of a transmission in slave write mode – when the adapter is being read as a slave, by another master, not when writing to a slave using the adapter.
6. Further Information The following references may be found useful when using the adapter: Philips Semiconductors Technical Handbook Book 4 Parts 12a and 12b. These give details of the I2C compatible ICs, and the I2C Bus specification. The PCF8584P used on the adapter is included in later editions. Where the data sheet and this manual disagree, this manual should always be followed when using the adapter.
7. The Real-Time Bus Monitor The program REALTIM1.EXE in the MONTOR directory is a completely non-invasive real-time bus 2 monitor which records activity on an I C-bus, post-processes the data and stores the results in an ASCII file. This file can be printed out or examined with a word-processor as required. The monitor can record 2 up to 30,000 operations on the I C-bus.
2 Appendix A I C Communications Adapter Status Codes This is an eight bit register, read using the getstatus routine. Each individual bit has its own meaning as follows: Bit 7 (MSB) - The PIN Bit The PIN bit “Pending Interrupt Not” is a read-only flag which is used to synchronize serial communication. Each time a serial data transmission is initiated (by sendaddress routine or setting STA bit) the PIN will be set (= 1) automatically.
2 Appendix B – I C Communications Adapter Control Codes The Control Register should normally be written using the setup, sendaddress and sendstop routines. To implement more advanced functions such as enabling hardware interrupt generation or implementing long distance mode, these routines may need to be modified or the users own routines used in their place. The Control Register is accessed by writing to I/O address: 1+Base address of card (set by links on board).
2 Appendix C - The Most Commonly Asked I C Questions General Questions Question Will my adapter work in a Pentium PC? Answer Yes and there is no need to alter LK 4 from the position in which your adapter was shipped. Question Will my adapter run I2C clock speeds greater than 90KHz? Answer At the moment your adapter is limited by the Bus Controller chip fitted, to a maximum of 90KHz as a master and 100KHz as a slave.
Windows 95 START - Run regedit HKEY_LOCAL_MACHINE | |--SYSTEM | |--CurrentControlSet | |--Services | |--Class | |--WinRT | |--WinRTdev0 | |--Parameters |--Section0 |--Section1 Windows NT START - Run regedit HKEY_LOCAL_MACHINE | |--SYSTEM | |--CurrentControlSet | |--Services | |--WinRT | |--WinRTdev0 | |--Parameters |--Section0 |--Section1 Question Answer Question Answer I am using your Windows 95 / NT DLL and I am always getting a time out error code.