User manual
mikroPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
420
Expander_Read_PortB
Expander_Read_PortAB
Prototype
function Expander_Read_PortB(ModuleAddress : byte) : byte;
Description The function reads byte from Port Expander’s PortB.
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 congured as input. See Expander_Set_DirectionPortB and
Expander_Set_DirectionPortAB routines.
Example
// Read a byte from Port Expander’s PORTB
var read_data : byte;
...
Expander_Set_DirectionPortB(0,$FF); // set expander’s portb to be input
...
read_data := Expander_Read_PortB(0);
Notes None.
Prototype
function Expander_Read_PortAB(ModuleAddress : byte) : word;
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 congured 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
var read_data : word;
...
Expander_Set_DirectionPortAB(0,$FFFF); // set expander’s porta and portb
to be input
...
read_data := Expander_Read_PortAB(0);
Notes None.