Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
Expander_Read_PortA
Expander_Read_PortB
305
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
Prototype
function Expander_Read_PortA(ModuleAddress: byte): byte;
Returns
Byte read.
Description
The function reads byte from Port Expander's PortA.
Parameters : 
ModuleAddress
: Port Expander hardware address, see schematic at the bot
tom of this page 
Requires
Port Expander must be initialized. See Expander_Init.
Port Expander's PortA should be configured as input. See Expander_Set_Direc-
tionPortA and Expander_Set_DirectionPortAB routines.
Example
// Read a byte from Port Expander's PORTA
var read_data : byte;
...
Expander_Set_DirectionPortA(0,0xFF);        // set expander's
porta to be input
...
read_data := Expander_Read_PortA(0);
Prototype
function Expander_Read_PortB(ModuleAddress: byte): byte;
Returns
Byte read.
Description
The function reads byte from Port Expander's PortB.
Parameters : 
ModuleAddress
: Port Expander hardware address, see schematic at the bot-
tom of this page 
Requires
Port Expander must be initialized. See Expander_Init.
Port Expander's PortB should be configured as input. See Expander_Set_Direc-
tionPortB and Expander_Set_DirectionPortAB routines.
Example
// Read a byte from Port Expander's PORTB
var read_data : byte;
...
Expander_Set_DirectionPortB(0,0xFF);        // set expander's
portb to be input
...
read_data := Expander_Read_PortB(0);