Mikroelektronika MIKROE-738 Datenbogen
![Mikroelektronika](https://files.manualsbrain.com/attachments/e0529b3b58069a916ad7bb89f7e9f5f0eda73421/common/fit/150/50/1b07b99aa3112e022a916b06db07f1f4f211e91d41878452d87c7638b1bf/brand_logo.gif)
mikroC PRO for PIC32
MikroElektronika
389
Expander_Read_PortB
Expander_Read_PortAB
Prototype
char Expander_Read_PortB(char ModuleAddress);
Description The function reads byte from Port Expander’s PortB.
Parameters -
Parameters -
ModuleAddress
: Port Expander hardware address, see schematic at the bottom of this page
Returns
Byte read.
Requires
Port Expander must be initialized. See Expander_Init.
Port Expander’s PortB should be configured as input. See Expander_Set_DirectionPortB and
Expander_Set_DirectionPortAB routines.
Example
// Read a byte from Port Expander’s PORTB
char read_data;
...
Expander_Set_DirectionPortB(0,0xFF); // set expander’s portb to be
input
...
read_data = Expander_Read_PortB(0);
Notes
None.
Prototype
unsigned int Expander_Read_PortAB(char ModuleAddress);
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
Returns
Word read.
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
unsigned int read_data;
...
Expander_Set_DirectionPortAB(0,0xFFFF); // set expander’s porta and
portb to be input
...
read_data = Expander_Read_PortAB(0);
Notes
None.