Mikroelektronika MIKROE-742 데이터 시트
Expander_Write_PortAB
Expander_Set_DirectionPortA
308
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
Prototype
procedure Expander_Write_PortAB(ModuleAddress: byte; Data_:
word);
word);
Returns
Nothing.
Description
The function writes word to Port Expander's ports.
Parameters :
-
ModuleAddress
: Port Expander hardware address, see schematic at the bot
tom of this page
-
Data_
: data to be written. Data to be written to PortA are passed in Data's
higher byte. Data to be written to PortB are passed in Data's lower byte
Requires
Port Expander must be initialized. See Expander_Init.
Port Expander's PortA and PortB should be configured as outputs. See
Expander_Set_DirectionPortA, Expander_Set_DirectionPortB and
Expander_Set_DirectionPortAB routines.
Expander_Set_DirectionPortA, Expander_Set_DirectionPortB and
Expander_Set_DirectionPortAB routines.
Example
// Write a byte to Port Expander's PORTA and PORTB
...
Expander_Set_DirectionPortAB(0,0x0000); // set expander's
Expander_Set_DirectionPortAB(0,0x0000); // set expander's
porta and portb to be output
...
Expander_Write_PortAB(0, 0xAA55);
Expander_Write_PortAB(0, 0xAA55);
Prototype
procedure Expander_Set_DirectionPortA(ModuleAddress: byte; Data_:
byte);
byte);
Returns
Nothing.
Description
The function sets Port Expander's PortA direction.
Parameters :
-
ModuleAddress
: Port Expander hardware address, see schematic at the bot
tom of this page
-
Data_
: data to be written to the PortA direction register. Each bit corresponds
to the appropriate pin of the PortA register. Set bit designates corresponding
pin as input. Cleared bit designates corresponding pin as output.
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
Expander_Set_DirectionPortA(0,0x00);
Expander_Set_DirectionPortA(0,0x00);