Mikroelektronika MIKROE-350 Fiche De Données

Page de 526
Expander_Read_PortA
Expander_Read_PortB
292
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
Prototype
sub function Expander_Read_PortA(dim ModuleAddress as byteas byte
Returns
Byte read.
Description
The function reads byte from Port Expander's PortA.
Parameters : 
ModuleAddress:
Port Expander hardware address, see schematic at the 
bottom 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
dim read_data as byte
...
Expander_Set_DirectionPortA(0,0xFF)        ' set expander's porta
to be input
...
read_data = Expander_Read_PortA(0)
Prototype
sub function Expander_Read_PortB(dim ModuleAddress as byteas byte
Returns
Byte read.
Description
The function reads byte from Port Expander's PortB.
Parameters : 
ModuleAddress:
Port Expander hardware address, see schematic at the 
bottom 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
dim read_data as byte
...
Expander_Set_DirectionPortB(0,0xFF)        ' set expander's portb
to be input
...
read_data = Expander_Read_PortB(0)