Mikroelektronika MIKROE-350 Data Sheet

Page of 526
Expander_Set_DirectionPortAB
Expander_Set_PullUpsPortA
298
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
Prototype
sub procedure Expander_Set_DirectionPortAB(dim ModuleAddress as
byte
dim Direction as word)
Returns
Nothing.
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.
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,0x00FF)
Prototype
sub procedure Expander_Set_PullUpsPortA(dim ModuleAddress as
byte, dim Data_ as byte)
Returns
Nothing.
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. 
Requires
Port Expander must be initialized. See Expander_Init.
Example
' Set Port Expander's PORTA pull-up resistors
Expander_Set_PullUpsPortA(0, 0xFF)