Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
Expander_Set_DirectionPortB
Expander_Set_DirectionPortAB
309
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
Prototype
procedure Expander_Set_DirectionPortB(ModuleAddress: byte; Data_:
byte);
Returns
Nothing.
Description
The function sets Port Expander's PortB direction.
Parameters : 
ModuleAddress
: Port Expander hardware address, see schematic at the bot
tom 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. 
Requires
Port Expander must be initialized. See Expander_Init.
Example
// Set Port Expander's PORTB to be input
Expander_Set_DirectionPortB(0,0xFF);
Prototype
procedure Expander_Set_DirectionPortAB(ModuleAddress: byte;
Direction: word);
Returns
Nothing.
Description
The function sets Port Expander's PortA and PortB direction.
Parameters : 
ModuleAddress
: Port Expander hardware address, see schematic at the bot-
tom 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. 
Eachbit 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);