;***************************************************************
;Type:		M68HCs12 Assembly Program for Code Warrior
;Program Name:	lcd4bit_display
;Written By: 	Jianjian Song & Keith Hoover
;Date:		October 5 2007
;Purpose: 4-Bit Mode LCD Panel interfacing via E, RS, DB7-4
;Display Panel Connections
;1--Vss(0V), 2--Vcc(5V), 3--Vee (0V), 4--RS = PT2, 5--R/W = 0V, 
;6--E clock = PT3,11--DB4 = PT4,12--DB5 = PT5,13--DB6 = PT6
;14--DB7 = PT7.
;***************************************************************
    xdef Entry      ;Entry point must be available to debugger
		xref  LCD_INIT      ;MAKE THE FOLLOWING SUBROUTINES AVAILABLE TO OTHER FILES	  
	  xref	LCD_MESSAGE
	  xref  LCD_CMD
    include 'mc9s12c32.inc'
CodeSec: SECTION      ;relocatable code section 
Entry: lds #$3f00
      jsr LCD_INIT
Display_again:
      ldx #msg1
      LDAB #0
      jsr LCD_MESSAGE ;Send msg1 beginning on first column of first line.
      LDAB #$44
      ldx #msg2
      jsr LCD_MESSAGE  ;Send msg2 beginning on 5th column of second line.
      jsr delay1sec
      LDAB #$01
      jsr LCD_CMD     ;clear display before looping back to display again.
      bra Display_again
      
      ;delay 1 second
delay1sec:
      pshx
      pshy
      ldy #$50
delayouter:
      ldx #$ffff
delayinner:
      dex
      bne delayinner
      dey
      bne delayouter
      puly
      pulx
ConstSec: SECTION     ;relocatable constant section     
msg1: dc.b "hello there",0
msg2: dc.b "this is a test",0
      end