File "klcd12D6.asm"
Full Path: /home/analogde/www/chart-export-handler/Projet/Example/HC12/D60/CME-12D60/klcd12D6.asm
File size: 2.26 KB
MIME-type: text/x-c
Charset: utf-8
; klcd12D6.ASM
; Example program using the KEYPAD and LCD_PORT on the Axiom
; CME-12D60 board.
;
; Memory Map Equates
RAMSTRT: EQU $0000 ; start of internal ram
RAMSIZE: EQU $0600 ; Size of internal ram
STACK: EQU RAMSTRT+RAMSIZE-2 ; top of stack
PRGSTRT: EQU $1000 ; start of the program code
#include d60reg.asm ; include register equates
; RAM
ORG RAMSTRT
CNT1 RMB 1 ; temporary count variable
TMP1 RMB 1 ; temporary storage variable
OLDKEY RMB 1 ; save key value for debounce
;**********************
; Program starts here *
;**********************
ORG PRGSTRT
START:
MOVB #08,$11 ; post-reset location of INITRG
MOVB #$0CF0,PEAR
MOVB #$73,MISC ; Flash on, p-sel stretch = 3
lds #STACK ; initialize stack pointer (don't do this if under monitor)
; Initialize KEYPAD
; Port H 0-3 must be output
; 4-7 must be input
INITKEY:
ldaa #$0F ; set Port H direction (0=input, 1=output)
staa DDRH ;
ldaa #$D3 ; set pull-up control register
staa PUCR
; Initialize LCD
jsr INITLCD ; Initialize LCD
ldx #PMT ; get message string
jsr LCDSTR ; display string
MainLoop:
jsr GETKEY ; get a key from keypad, returned in A
jsr LCDOUT ; display key value
bra MainLoop
ENDPROG:
rts ; return (use this only if called, from monitor for example)
jsr COP_RESET ; clear watch-dog timer
bra ENDPROG ; endless loop
; The M68HC12A4 powers on with the COP (Computer Operating Properly)
; watchdog system enabled. If you don't reset it occasionally in your software
; it will reset you. This subroutine will reset the COP.
COP_RESET:
ldaa #$55 ; get 1st COP reset value
staa COPRST ; store it
ldaa #$AA ; get 2nd COP reset value
staa COPRST ; store it
rts
;**************
; TEXT TABLES *
;**************
PMT: FCC 'Press Key: '
FCB 0
;*******************
; INCLUDE FILES
;*******************
#include lcd12d6.asm ; include LCD functions
#include key12d6.asm ; include KEYPAD functions
org $fffe reset vector
fdb START
END