Calibre UK PCI90 I2C User Manual - Calibre
CALIBRE
Issue 1.1
Page 9
06/03/2007
This parameter .is reserved for future use and should always be set to zero (0).
int setnack
This controls whether the adapter transmits an 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 is to be set = 0 (in the case of reading 1 byte only, the
acknowledge will have been disabled by sendaddress and so should now be
enabled again after reading the data, hence setnack = 0 for reading a single
byte of data).
The first read from the adapter following a write to it will result in the data that
was written being returned. This data MUST be read and discarded before real
data can be read, DO NOT count this extra read when considering whether or
not to acknowledge.
Parameters returned
int I2CData
If a time-out occurs the ErrCode 8005H is returned, otherwise the data 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.
Readbyte is compatible with both master read and slave read modes.
5.3.5.
sendstop
Function specification Int sendstop(int board)
Parameters are:
int board
This parameter .is reserved for future use and should always be set to zero (0).
Parameters returned
int 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 a transmission. Correct acknowledge sequence must have been applied
if the transmission was a read.
Functional descriptionInstructs the adapter to send a stop code and wait for it to be sent.
Should a time-out occur during the sending of a stop then an error code 8002H
is returned, otherwise the status is returned.
5.3.6.
restart
Function specification Int restart(int board, int slaveaddress, int setnack)
Parameters are:
int board
This parameter .is reserved for future use and should always be set to zero (0).
int slaveaddress
The address to be accessed via the I2C, e.g. A1H.
int setnack
This controls whether the adapter transmits an 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 a read (odd numbered) address is being sent AND only 1 Byte is
to be read, setnack should be set to = 1; in all other cases it must be clear = 0.
Parameters returned
int ErrCode
If the transfer time out occurs error code 8003H is returned otherwise the
status is returned.
Prerequisites
Adapter must be configured 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.