CALIBRE
3.3.Function Description
3.3.1. | Setup |
|
Function specification | int Setup(int OwnAddress, int ClockSpeed, int BusVoltage, int PullUpsOn, int | |
SlaveBlockTimeout) |
| |
Parameters are: | int ownaddress | |
|
| This is the 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. |
|
| int ClockSpeed |
|
| This is the clock rate (bit rate for the I2C serial bus) when operating as a |
|
| master. For 400kHz enter 400, for 90kHz enter 90. |
|
| Maximum value 400 minimum value 25 |
|
| int BusVoltage |
|
| The desired bus voltage multiplied by 100 e.g. 330 would give a bus voltage |
|
| 3.3V. Please note that if a value between 4.2V and 5V is requested the output |
|
| will be 5V. |
|
| Maximum value 500 (5V) Minimum value 180 (1.8V). |
|
| int PullUpsOn |
|
| Set (1) to turn the pull up resistors on, clear (0) to turn them off. |
|
| int SlaveBlockTimeout |
|
| This parameter is only used by the slave block functions. If the Master has not |
|
| completed the transfer in this period (seconds) the Adapter will abort the |
|
| transfer and return an error code. |
|
| Range 1 – 255 seconds. NOTE: setting this value to 0 will prevent the Adapter |
|
| from timing out the slave block function. |
Parameters returned | If the software fails to find the driver error code 8000H is returned otherwise the | |
|
| status is returned. |
Prerequisites | None. | |
Functional description | This function initialises Adapter ready for I2C transfers. |
3.3.2.SendAddress
Function specification | Int SendAddress(int SlaveAddress, int SetNack) |
Parameters are: | int SlaveAddress |
| This is the address to be accessed via the I2C, e.g. A0H. |
| 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. |
| Normally there will be another transfer (data read or write) after the |
| SendAddress and so SetNack is enabled (0); |
Parameters returned | int ErrCode. |
| If the transfer time out occurs error code 8001H is returned otherwise the |
| status is returned. |
Prerequisites | The Adapter must be configured by running Setup. |
Functional description | The function waits for the bus to be free then sends the slave address. |
| The function waits for the address to be sent. Should a |
| the sending of an address then an error code 8001H is returned, otherwise the |
| status is returned. |
Issue 1.0 | Page 7 |
01/07/03 |
|