Mikroelektronika MIKROE-724 データシート

ページ / 726
424
mikoBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
Expander_Set_DirectionPortB
Expander_Set_DirectionPortAB
Expander_Set_PullUpsPortA
Prototype
sub procedure Expander_Set_DirectionPortB(dim ModuleAddress, Data as byte)
Description The function sets Port Expander’s PortB direction.
Parameters 
ModuleAddress
: Port Expander hardware address, see schematic at the bottom of this page 
Data
: data to be written to the PortB direction register. Each bit corresponds to the appropriate pin of 
the PortB register. Set bit designates corresponding pin as input. Cleared bit designates corresponding 
pin as output. 
Returns
Nothing.
Requires
Port Expander must be initialized. See Expander_Init.
Example
‘ Set Port Expander’s PORTB to be input
Expander_Set_DirectionPortB(0,$FF)
Notes
None.
Prototype
sub procedure Expander_Set_DirectionPortAB(dim ModuleAddress, Direction as 
word)
Description The function sets Port Expander’s PortA and PortB direction.
Parameters 
ModuleAddress
: Port Expander hardware address, see schematic at the bottom of this page 
Direction
: data to be written to direction registers. Data to be written to the PortA direction register 
are passed in 
Direction
’s higher byte. Data to be written to the PortB direction register are passed 
in 
Direction
’s lower byte. Each bit corresponds to the appropriate pin of the PortA/PortB register. 
Set bit designates corresponding pin as input. Cleared bit designates corresponding pin as output. 
Returns
Nothing.
Requires
Port Expander must be initialized. See Expander_Init.
Example
‘ Set Port Expander’s PORTA to be output and PORTB to be input
Expander_Set_DirectionPortAB(0,$00FF)
Notes
None.
Prototype
sub procedure Expander_Set_PullUpsPortA(dim ModuleAddress, Data as byte)
Description The function sets Port Expander’s PortA pull up/down resistors.
Parameters 
ModuleAddress
: Port Expander hardware address, see schematic at the bottom of this page 
Data
: data for choosing pull up/down resistors configuration. Each bit corresponds to the appropriate 
pin of the PortA register. Set bit enables pull-up for corresponding pin. 
Returns
Nothing.
Requires
Port Expander must be initialized. See Expander_Init.
Example
‘ Set Port Expander’s PORTA pull-up resistors
Expander_Set_PullUpsPortA(0, $FF)
Notes
None.