AN1833 Freescale Semiconductor / Motorola, AN1833 Datasheet - Page 35

no-image

AN1833

Manufacturer Part Number
AN1833
Description
A Low-Power Wireless Remote Control Transmitter and Receiver
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
KeyPdInt_Isr020:
KeyPdInt_Isr030:
get2nd
KeyPdInt_Isr080:
KeyPdInt_Isr090:
************************************************************************************
* This keypad decode routine is from AN1239 written by David Yoder
*
* KeyPad_Body
*
* This subroutine decodes a 4x4 matrix keypad on port B.
*
************************************************************************************
KeyPad_Body:
KeyPad010:
AN1833
MOTOROLA
lda
jsr
jsr
beq
brset
sta
bset
bra
sta
jsr
jsr
beq
bra
lda
jsr
bset
bclr
rti
ldx
lda
and
ora
sta
lda
and
cmp
beq
decx
#$4
DelaymS2_Body
KeyPad_Body
KeyPdInt_Isr090
first,flag,get2nd
code
first,flag
KeyPdInt_Isr080
command
Send_preamble
KeyPad_Body
KeyPdInt_Isr090
KeyPdInt_Isr080
#!10
DelaymS2_Body
IRQR,ISCR
xmt,serial_port
#{KeyPad_Table_Top - KeyPad_Table}
portb
#$f0
KeyPad_Table+1,x
portb
porta
#$0F
KeyPad_Table,x
KeyPad030
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
;Debounce key for 4mS
;Jump to delay routine
;Get the keypress
;If no key down, return
;no key down = 00 in acu
; branch if first key seen
; store address code
; set first key flag
; go wait for key release
; store command byte
;go send preamble & code
; go check if the key has been released
; no key pressed so exit
; else wait for key release
;Debounce the release
;Clear any interrupt requests
; generated due to key bounce
;Return from Interrupt
;Interrupts can happen in any code in
; the main routine after this ISR has
; been called once.
;Remember this when changing the main
; routine!
;Load X with the offset of the last
;entry in the table
;Get value in port B
;Do not allow high nibble to change
;Get key decode value from table
;Write to Port
;Get value in port A
;Throw out columns to read only rows
;See if high nibble bit was pulled low
;If key found, branch
;Decrement X thrice to point to
;Delay 10 mS
; turn off the transmitter
(KeyPdInt_Isr)
Application Note
Code Listing
35
*
*
*
*
*
*

Related parts for AN1833