Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
KEYPAD LIBRARY
The mikroPascal PRO for AVR provides a library for working with 4x4 keypad. The library routines
can also be used with 4x1, 4x2, or 4x3 keypad. For connections explanation see schematic at the
bottom of this page.
Note: Since sampling lines for AVR MCUs are activated by logical zero Keypad Library can not
be used with hardwares that have protective diodes connected with anode to MCU side, such as
mikroElektronika's Keypad extra board HW.Rev v1.20
External dependencies of Keypad Library
Library Routines
- Keypad_Init 
- Keypad_Key_Press 
- Keypad_Key_Click 
Keypad_Init
249
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
The following variables
must be defined in all
projects using Sound
Library:
Description: 
Example : 
var keypadPort :
byte; 
sfr; external;
Keypad Port.
var keypadPort : byte
at PORTB;
var
keypadPort_Direction :
byte; 
sfr; external;
Direction of the Keypad
Port.
var
keypadPort_Direction
: byte 
at DDRB;
Prototype
procedure Keypad_Init();
Returns
Nothing.
Description
Initializes port for working with keypad.
Requires
Global variables : 
keypadPort_Reg
- Keypad port 
keypadPort_Reg_Direction
- Direction of the Keypad port 
must be defined before using this function.
Example
// Initialize PORTB for communication with keypad
var keypadPort : byte at PORTB;
var keypadPort_Direction : byte at DDRB;
...
Keypad_Init();