Specifications

Chapter 6 - Samples
The above macro has several arguments that need to be explained:
TESTER macro HiLo, Port, Bit, Delay, Address
HiLo can be '0' or '1' which represents rising or falling edge where service subprogram will be
executed when you press a key.
Port is a microcontroller's port to which a key is connected. In the case of a PIC16F84
microcontroller, it can be PORTA or PORTB.
Bit is port's pin to which the key is connected.
Delay is a number from 0 to 255, used to assign the time needed for key debounce detection -
contact oscillation - to stop. It is calculated as TIME = Delay x 1ms.
Address is the address where the micro goes after a key is detected. The sub-routine at the
address carries out the required instruction for the keypress.
Example 1: TESTER 0, PORTA, 3, .100, Tester1_above
Key-1 is connected to RA0 (the first output of port A) with a delay of 100 microseconds and a
reaction to logic zero. Subprogram that processes key is found at address of label Tester1_above.
Example2: TESTER 0, PORTA, 2, .200, Tester2_below
Key-2 is connected to RA1 (the second output of port A) with 200 mS delay and a reaction to logic
one. Subprogram that processes key is found at address of label Tester2_below.
The next example shows the use of macros in a program. TESTER.ASM turns LED on and off. The
LED is connected to the seventh output of port B. Key-1 is used to turn LED on. Key-2 turns LED
off.
http://www.mikroelektronika.co.yu/english/product/books/PICbook/6_04Poglavlje.htm (2 of 3) [4/2/2003 16:18:47]