User manual
444
mikoC PRO for dsPIC
MikroElektronika
Expander_Read_Byte
Expander_Write_Byte
Expander_Read_PortA
Prototype
char Expander_Read_Byte(char ModuleAddress, char RegAddress);
Description The function reads byte from Port Expander.
Parameters - ModuleAddress: Port Expander hardware address, see schematic at the bottom of this page 
- RegAddress: Port Expander’s internal register address 
Returns Byte read.
Requires Port Expander must be initialized. See Expander_Init.
Example
// Read a byte from Port Expander’s register
char read_data;
...
read_data = Expander_Read_Byte(0,1);
Notes None.
Prototype
void Expander_Write_Byte(char ModuleAddress, char RegAddress, char data_);
Description Routine writes a byte to Port Expander.
Parameters - ModuleAddress: Port Expander hardware address, see schematic at the bottom of this page 
- RegAddress: Port Expander’s internal register address 
- Data: data to be written 
Returns Byte read.
Requires Port Expander must be initialized. See Expander_Init.
Example
// Write a byte to the Port Expander’s register
Expander_Write_Byte(0,1,0xFF);
Notes None.
Prototype
char Expander_Read_PortA(char ModuleAddress);
Description The function reads byte from Port Expander’s PortA.
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  PortA  should  be  congured  as  input.  See  Expander_Set_DirectionPortA  and 
Expander_Set_DirectionPortAB routines.
Example
// Read a byte from Port Expander’s PORTA
char read_data;
...
Expander_Set_DirectionPortA(0,0xFF);        // set expander’s porta to be 
input
...
read_data = Expander_Read_PortA(0);
Notes None.










