| Setnack 1 for no acknowledge 0 for acknowledge. |
Parameters returned | I2Cdata, the data read, if a |
| 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. |
| IMPORTANT: SETNACK MUST = 1 WHEN READING THE LAST AND |
| THE LAST BUT ONE BYTES IN A SEQUENCE OF BYTES |
| SETNACK MUST = 0 FOR ALL OTHER READS. IF THIS FORMAT IS |
| NOT STRICTLY FOLLOWED THEN THE ADAPTER AND BUS WILL |
| NOT OPERATE CORRECTLY. |
| WHEN READING ANOTHER I2C DEVICE THE FIRST BYTE READ |
| USING THE READBYTE FUNCTION IS ALWAYS THE SLAVE |
| ADDRESS OF THAT DEVICE. THIS MUST BE READ AND |
| DISCARDED BEFORE THE REAL DATA CAN BE READ. DO NOT |
| COUNT THIS EXTRA READ WHEN CONSIDERING WHETHER OR |
| NOT TO ACKNOWLEDGE. |
| Should a |
| the data is returned. Readbyte is compatible with both master read and |
| slave read modes. |
sendstop |
|
Function specification | Int sendstop ( ) |
Parameters returned | ErrCode. If the transfer time out occurs error code 8002H is returned |
| otherwise the status is returned. |
Prerequisites | Adapter must be configured using setup. Should normally only be used |
| at the end of transmission. Correct acknowledge sequence must have |
| been applied if the transmission was a read. |
Functional description | Instruct the adapter to send a stop code and wait for it to be sent. Should |
| a |
| is returned, otherwise the status is returned. |
restart |
|
Function specification | Int restart (int slaveaddress, int setnack) |
| Slaveaddress is the address to be accessed via the I2C, e.g. A1H |
| Setnack 1 for no acknowledge 0 for acknowledge – see Functional |
| Description. |
Parameters returned | ErrCode. If the transfer time out occurs error code 8003H is returned |
| otherwise the status is returned. |
Prerequisites | Adapter must be configures using setup. A start and slave address must |
| have previously been sent using sendaddress. Usually a data pointer |
| would already have been written using writebyte. |
Functional description | Sends a start code and the slave address specified and presets the |
| acknowledge status depending on the value of setnack. The |
| acknowledge is set ready for the data transfer after the address and |
| hence in read mode (odd address being sent) if only one byte is to be |
| read the setnack parameter must equal 1. If more than one byte is to be |
| read or if in write mode (even address being sent) then setnack must |
| equal 0. |
| The function waits for the address to be sent. Should a |
| during the sending of an address then an error code 8003H is returned, |
| otherwise the status is returned. |
Revision 1.7 | Page 17 of 27 |
09/12/1999 |
|