Mikroelektronika MIKROE-350 データシート

ページ / 526
Expander_Read_PortAB
293
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
Prototype
sub function Expander_Read_PortAB(dim ModuleAddress as byteas word
Returns
Word read.
Description
The function reads word from Port Expander's ports. PortA readings are in the
higher byte of the result. PortB readings are in the lower byte of the result.
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 and PortB should be configured as inputs. See
Expander_Set_DirectionPortA, Expander_Set_DirectionPortB and
Expander_Set_DirectionPortAB routines.
Example
' Read a byte from Port Expander's PORTA and PORTB
dim read_data as word
...
Expander_Set_DirectionPortAB(0,0xFFFF)        ' set expander's
porta and portb to be input
...
read_data = Expander_Read_PortAB(0)