User manual
420
mikoBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
Expander_Write_Byte
Expander_Read_PortA
Prototype
sub procedure Expander_Write_Byte(dim ModuleAddress, RegAddress, Data as
byte)
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,$FF)
Notes None.
Prototype
sub function Expander_Read_PortA(dim ModuleAddress as byte) as byte
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
dim read_data as byte
...
Expander_Set_DirectionPortA(0,$FF) ‘ set expander’s porta to be input
...
read_data = Expander_Read_PortA(0)
Notes None.