Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
TWI_Start
TWI_Read
TWI_Write
474
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
Prototype
function TWI_Start() : char;
Returns
If there is no error function returns 0, otherwise returns 1.
Description
Determines if TWI bus is free and issues START signal.
Requires
TWI must be configured before using this function. See TWI_Init.
Example
if (TWI_Start = 1)
begin  
...
Prototype
function TWI_Read(ack : byte) : byte;
Returns
Returns one byte from the slave.
Description
Reads one byte from the slave, and sends not acknowledge signal if parameter
ack is 0, otherwise it sends acknowledge.
Requires
TWI must be configured before using this function. See TWI_Init.
Also, START signal needs to be issued in order to use this function. See
TWI_Start.
Example
Read data and send not acknowledge signal:
tmp := TWI_Read(0);
Prototype
procedure TWI_Write(data_ : byte);
Returns
Nothing.
Description
Sends data byte (parameter data_) via TWI bus.
Requires
TWI must be configured before using this function. See TWI_Init.
Also, START signal needs to be issued in order to use this function. See
TWI_Start.
Example
TWI_Write(0xA3);