[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 249
  • Last Modified:

declaring a variable and a string for 68HC12

Below code (written for Motorola 68HC12) displays the alphabet on an lcd screen. How can I modify this code so that it can display a welcome message for 5 sec.s and then print out a variable called "price" .

In other words how do i declare a string and a variable for hc12?
if it were hc05 it would have been something like
ORG $50
msg     DB    "Welcome./"
price    DB    "$00.00"

but DB wont work in hc12. what's the way of doing this in hc12?


;**********************************************
;*  LCD display                                                
;*  this code initilizes the LCD module and            
;*  displays the alphabet.                                      
;*                                     
;**********************************************

PORTT   EQU   $0240
PORTM   EQU   $0250

DDRT    EQU   $0242
DDRM    EQU   $0252




        ORG   $4000
; set port data patterns and directions
STACK   LDS   #$4000        
TRYLCD  LDAA  #$FF
        STAA  DDRM
        STAA  DDRT
        LDAA  #$00
        STAA  PORTM
       
; LCD display peripheral needs to be initilized
        LDAA  #$01
        JSR   WCTRL                  ; clear
        LDAA  #$01
        JSR   WCTRL                  ; clear
        LDAA  #$02
        JSR   WCTRL
        LDAA  #$38
        JSR   WCTRL
        LDAA  #$0C
        JSR   WCTRL
        LDAA  #$06
        JSR   WCTRL
       
        LDAA  #'a'                ; ascii a
DLP     JSR   WDAT             ; display a character
        INCA                               ; to next character
        CMPA  #'z'       ; ascii t
        BNE   DLP                   ; loop till t
HERE    BRA   HERE             ; Stop    
         
       



;*************************************************************

WCTRL   STAA  PORTT
        PSHA
        BSET  PORTM,%00000010
        NOP
        NOP
        NOP
        NOP
        BCLR  PORTM,%00000010
        CLRA
CTRDLY2 PSHA
        CLRA
CTRDLY1 DECA
        BNE   CTRDLY1
        PULA
        DECA
        BNE   CTRDLY2
        PULA
        RTS


;**************************************************************


WDAT    STAA  PORTT
        PSHA
        BSET  PORTM,%00000100
        BSET  PORTM,%00000010
        NOP
        NOP
        NOP
        NOP
        BCLR  PORTM,%00000010
        BCLR  PORTM,%00000100
        CLRA
DATDLY1 DECA
        BNE   DATDLY1
        PULA        
        RTS
       
        ORG $FFFE                                                ;reset vector
        FCB $40
        FCB $0
       
0
Lerzan
Asked:
Lerzan
1 Solution
 
stefan73Commented:
Hi Lerzan,
> but DB wont work in hc12. what's the way of doing this in hc12?
Any assembler should have a command to store raw bytes. m68k has db, dw,dl.

Cheers!

Stefan
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now