CALIBRE
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 has occurred.
If the status does not indicate bus free or the bus Error bit is still set then 8006H is returned otherwise the status is returned.
4.4.12. sendbytes |
|
|
|
Function specification | Int sendbytes(int far *transferarray) | ||
Parameters are: | int far *transferarray | ||
| The far pointer must point to a single dimensional array the format of which is | ||
| detailed below. The calling function must have initialised elements 0, 1 and 2 | ||
| prior to calling the function. | ||
Element no | Element name | Description | |
0 | slaveaddress | Slaveaddress is the address to be accessed via the | |
|
|
| I2C Bus, this is in hexadecimal e.g. A0H. |
1 | wordaddress | Wordaddress is the offset within the slave to which | |
|
|
| the first byte of data is to be written, see transmission |
|
|
| format for more detail. |
2 | nobytes | The number of bytes (n) to be sent. Min value 1. | |
3 | byte 0 |
| First byte to be sent. |
|
|
| " |
|
|
| " |
| byte n |
| Last byte to be sent. |
Parameters returned | int bsent |
| |
| The number of bytes actually sent. | ||
Prerequisites | Adapter must be configured using setup. Array elements 0, 1 and 2 must be | ||
| initialised. Usually elements 3 to n would also be initialised. Array must be | ||
| |||
| concerned. |
| |
Transmission format | There are two transmission formats, these are : | ||
| i. | ||
|
| If transmission format i) is required set the wordaddress to a number | |
|
| greater than FFH. | |
| ii. | ||
|
| If transmission format ii) is required set the wordaddress to a number | |
|
| less than or equal to FFH. | |
Functional description | The function determines the required transmission format and then sends a | ||
| start code and the slave address. |
If transmission format ii) has been selected the wordaddress is sent. The data bytes are then transmitted sequentially.
Should a
Issue 1.3 | Page 24 |
22/07/99