Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
TWI LIBRARY
TWI full master MSSP module is available with a number of AVR MCU models. mikroPascal PRO
for AVR provides library which supports the master TWI mode.
Library Routines
- TWI_Init 
- TWI_Busy 
- TWI_Start 
- TWI_Stop 
- TWI_Read 
- TWI_Write 
- TWI_Status 
- TWI_Close
TWI_Init
TWI_Busy
473
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
Prototype
procedure TWI_Init(clock : dword);
Returns
Nothing.
Description
Initializes TWI with desired clock (refer to device data sheet for correct values in
respect with Fosc). Needs to be called before using other functions of TWI Library.
You don’t need to configure ports manually for using the module; library will take
care of the initialization.
Requires
Library requires MSSP module on PORTB or PORTC.
Example
TWI_Init(100000);
Prototype
function TWI_Busy() : byte;
Returns
Returns 0 if TWI start sequnce is finished, 1 if TWI start sequnce is not finished.
Description
Signalizes the status of TWI bus.
Requires
TWI must be configured before using this function. See TWI_Init.
Example
if (TWI_Busy = 1) 
begin
...