Calibre UK PICA93LV User Manual

Page of 35
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
returned equal to 0.
The first data byte read is the slave read address sent (see readbyte
description). This is discarded, it is not returned in the transfer array. The data
bytes are then read and stored in the transfer array. At the appropriate point
acknowledges are ceased - for the last and the last but one byte to be
transferred.
A stop is sent after the last byte has been read. On completion the number of
bytes read is returned.
Should a time-out occur the transfer is terminated by a stop and the number
of bytes successfully read is returned.
Getbytes can only be used in master read mode.
4.4.14.
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.
Functional description
This function is used when the adapter is a slave being read by a master
elsewhere on the bus - the adapter is in slave write mode. The function must
be called immediately after the master indicates the last byte has been read
(by not acknowledging that byte). This function is required to clear the I2C
data lines so that the master can send a stop signal.