Calibre UK PICA93LV User Manual

Manual is about: Parallel I2C Communications Adapter

Summary of PICA93LV

  • Page 1

    Calibre pica93lv parallel i2c communications adapter user manual issue 1.3 22/07/1999 calibre uk limited cornwall house, cornwall terrace bradford, west yorkshire, bd87js, england tel no : (01274) 394125 fax no: (01274) 730960) e-mail: sales@calibreuk.Com web-site www.Calibreuk.Com.

  • Page 2

    Calibre issue 1.3 22/07/1999 welcome to the calibre parallel i 2 c interface. This interface is designed to allow users to run i 2 c bus operations via pc parallel port. If you have any queries relating to this or any other i 2 c product supplied by calibre please visit our web site www.Calibreuk.Co...

  • Page 3

    Calibre issue 1.3 page i 22/07/99 contents introduction 1 1.1. General introduction 1 1.2. Packing list 1 1.3. . Configuring the adapter 1 1.4. Bus termination and protection 1 1.5. Installing the adapter 2 connecting the adapter to your system 3 2.1. Connector pinout 3 2.2. Bus capacitance limitati...

  • Page 4

    Calibre issue 1.3 page 1 22/07/99 introduction 1.1. General introduction the parallel i2c communications adapter is designed to connect to any ibm pc compatible parallel port. It is based on the philips pcf8584 bus controller, it features full i2c bi-directional compatibility as either a master or s...

  • Page 5

    Calibre issue 1.3 page 2 22/07/99 1.5. Installing the adapter connect the pica93lv to your pc as shown in figure 1 ( the cable numbers correspond to the packing list above). Figure 1.0 typical pc connection.

  • Page 6

    Calibre issue 1.3 page 3 22/07/99 connecting the adapter to your system 2.1. Connector pinout all external connections are made via a 9 way "d" socket: pin normal mode 1 0v 2 0v 3 0v 4 0v 5 nc 6 sda (bi-directional) 7 +5v 8 scl (bi-directional) 9 nc 2.2. Bus capacitance limitations the maximum allow...

  • Page 7

    Calibre issue 1.3 page 4 22/07/99 software utilities 3.1. Introduction unpack the software from the cd-rom in accordance with the instructions provided with the licence. The software utilities contain simple dos routines in both c, qbasic and windows dll / lib (16bit only) for use with visual basic ...

  • Page 8

    Calibre issue 1.3 page 5 22/07/99 the i2cinc.C file contains all the functions required to build an i2c transfer. This will require compiling (note the include file) to produce an object file. Once the object files have been created link them together with the library file to create your application...

  • Page 9

    Calibre issue 1.3 page 6 22/07/99 3.4. Windows lib/dll functions 3.4.1. Files on disc \readme.Doc user information \win\c\i2cinc.H "c" function prototypes \win\c\lpti2c.Lib i2c "c" library \win\vb30\lpti2c.Bas visual basic 3.0 declarations \win\vb30\lpti2c.Dll i2c visual basic dynamic link library t...

  • Page 10

    Calibre issue 1.3 page 7 22/07/99 using the utilities 4.1. Introduction each utility is documented in a standard format which lists its name, usage, function and effect on the adapter is given. The adapter should be setup prior to any data transfer. 4.2. C routines 4.2.1. I2c setup / initialisation ...

  • Page 11

    Calibre issue 1.3 page 8 22/07/99 4.2.2. I2c status checking routine function definition: int getstatus(void) usage: i2cstatus = getstatus(); function: function to read status register of the parallel i2c communications adapter. Parameters are: none value returned: int i2cstatus where i2cstatus is a...

  • Page 12

    Calibre issue 1.3 page 9 22/07/99 the function will read the status a number of times before returning an error condition - this number is defined by the maxnumberofgoes constant defined in i2cinc.C, this value may be altered to suit your system. I2c status on exit 0x00 bus busy and address sent and...

  • Page 13

    Calibre issue 1.3 page 10 22/07/99 parameters are: int setnack this controls whether the parallel i2c communications adapter transmits an acknowledge down the i2c bus on reception of a byte. The last byte received during a transfer must not be acknowledged. If setnack = 0 then acknowledge is enabled...

  • Page 14

    Calibre issue 1.3 page 11 22/07/99 4.2.5. Write data byte to slave routine function definition: int writebyte(int i2cdata) usage: i2cstatus = writebyte(i2cdata) function: this is the procedure to write a byte of data to a slave device whose slave address has already been sent by sendaddress. Paramet...

  • Page 15

    Calibre issue 1.3 page 12 22/07/99 4.2.6. Send an i2c stop routine function definition: int sendstop(void) usage: i2cstatus = sendstop(); function: this is the procedure to send a stop (end of communication signal) down the i2c bus, ending a transmission or reception with a slave which was addressed...

  • Page 16

    Calibre issue 1.3 page 13 22/07/99 parameters are: int slaveaddress the slave address of the device which is to be communicated with. This will be an even number if the adapter is to write to the slave, add 1 to get an odd number if the adapter is to read from the slave. Int setnack this controls wh...

  • Page 17

    Calibre issue 1.3 page 14 22/07/99 4.3. Qbasic routines 4.3.1. I2c setup/initialisation routines function definition: setup (ownaddress as integer, sclk as integer) usage call setup(ownaddress as integer, sclk as integer) function: procedure to set up parallel i2c communications adapter. Parameters ...

  • Page 18

    Calibre issue 1.3 page 15 22/07/99 see appendix a for details of the status values returned. I2c status on exit: the status of the parallel i2c communications adapter will not be affected by using the fngetstatus% function. Example usage: (see also sample programs) 'this will read the parallel i2c c...

  • Page 19

    Calibre issue 1.3 page 16 22/07/99 sub main slaveaddress% = &ha0 ' ic address of slave, this is a typical write ' address for an i2c static ram or eeprom setnack% = 0 ' enable acknowledge (see parameter descriptions) i2cstatus% = sendaddress (slaveaddress%, setnack%) select case i2cstatus% case &h00...

  • Page 20

    Calibre issue 1.3 page 17 22/07/99 (see appendix a for details status codes). Example usage: (see also sample programs) ' 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....

  • Page 21

    Calibre issue 1.3 page 18 22/07/99 example usage: (see also sample programs) ' this will write a byte of data to a slave previously addressed by sendaddress. */ sub main i2cdata$ = &h69 ' data byte which is to be transmitted */ i2cstatus$ = writebyte (i2cdata$) if (i2cstatus and &h8000) = &h8000 the...

  • Page 22

    Calibre issue 1.3 page 19 22/07/99 4.3.7. I2c restart and address sending routine function definition: restart%(slaveaddress as integer setnack as integer) usage: i2cstatus% = restart(slaveaddress%, setnack%) function: procedure to send restart and slave address of device which is to be communicated...

  • Page 23

    Calibre issue 1.3 page 20 22/07/99 4.4. Libraries for programming in microsoft windows environments the library function descriptions in this section apply equally to both c++ and visual basic applications. 4.4.1. Users of ica90 / 93 i2c adapters for those customers who have already used the ica90 o...

  • Page 24

    Calibre issue 1.3 page 21 22/07/99 this is a period of time (in micro seconds) to wait for the required bus status. If this time-out expires the i2c functions will exit returning an error code. Int sclk this is the clock rate (bit rate for the i2c serial bus) when operating as a master. Value of scl...

  • Page 25

    Calibre issue 1.3 page 22 22/07/99 parameters returned int errcode. If the transfer time out occurs error code 8004h is returned otherwise the status is returned. Prerequisites adapter must be configured using setup, start and write address sent by sendaddress. Functional description the function wr...

  • Page 26

    Calibre issue 1.3 page 23 22/07/99 4.4.9. Restart function specification int restart(int slaveaddress, int setnack) parameters are: int slaveaddress the address to be accessed via the i2c, e.G. A1h. Int setnack this controls whether the parallel i2c communications adapter transmits an acknowledge do...

  • Page 27

    Calibre issue 1.3 page 24 22/07/99 functional description this function issues two consecutive stop commands on the bus, with a delay in between. It then clears the adapter registers and reads the status. This should normally set the adapter into a known idle state when a bus error or other problem ...

  • Page 28

    Calibre issue 1.3 page 25 22/07/99 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. 4.4.13. Getbytes function specification int getbytes(int far *transferarray) parameters are: int far *transferarray...

  • Page 29

    Calibre issue 1.3 page 26 22/07/99 functional description the function determines the required transfer format, sends the appropriate sequence of start(s) and slave address(es) and checks for acknowledges where necessary. If the slave fails to acknowledge then a stop is sent and nobytesread is retur...

  • Page 30

    Calibre issue 1.3 page 27 22/07/99 further information a) 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 man...

  • Page 31

    Calibre issue 1.3 page 28 22/07/99 appendix a parallel i2c communications adapter status codes this is an eight bit register, read using the getstatus routine. The bit definitions are as follows: bit 7 (msb) - the pending interrupt not (pin) bit the pin bit is a read-only flag which is used to synch...

  • Page 32

    Calibre issue 1.3 page 29 22/07/99 appendix b parallel i2c communications adapter control codes the control register should normally be written using the setup, sendaddress and sendstop routines. To implement more advanced functions for example, enabling hardware interrupt generation these routines ...

  • Page 33

    Calibre issue 1.3 page 30 22/07/99 the most commonly asked i2c questions 6.1. General questions 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. Q...

  • Page 35

    Calibre issue 1.3 page 32 22/07/99 4)brief software listings, or which calibre software you are running. 5)the serial number of your i2c adapter, or when you purchased it. Please email your query to: techsupport@calibreuk.Com or fax your query to: 44-1274-730960 we will endeavour to help you..