 title  "HELLO - Put 'Hello World' on the SLI Display."
;
;  This is a simple PIC (16C84) Program to send the Message "Hello World" to the SLI 
;   from a PIC using RA0 as the Output.
;
;  This is a Demonstration of serial.inc.  Note that the Registers are defined the same 
;  way here.
;
;  Hardware Notes:
;   Reset is tied directly to Vcc and PWRT is Enabled.
;   The Pic is Running with a 3.579545 MHz (Colour Burst) Crystal for 16C84
;     NOTE: The Frequency isn't all that important for proper Operation of the SLI.
;   RA1 is Connected to the SLI
;   _MCLR is pulled up using a 4.7K resistor and a 
;
;  Myke Predko
;  97.01.12
;
;
  LIST P=16C84, R=DEC		;  16C84 Runs at 3.579545 MHz
  errorlevel 0,-305
  INCLUDE "c:\mplab\p16c84.inc"

;  Register Usage
 CBLOCK	0x0C			;  Start at Top of File Registers
Count				;  Count Values for Dlay "Loop"
Counthi		
_VarEnd				;  Mark Where the Serial Stuff Can Go
 ENDC


 PAGE
 __CONFIG _CP_OFF & _XT_OSC & _PWRTE_ON  & _WDT_OFF
                               ;  Note that the WatchDog Timer is OFF

;  Code for "HELLO"

  org    0

  goto	 MainLine

  org	 4			;  Put in serial.inc starting at Int Handler
  INCLUDE "..\..\INCLUDES\SERIAL.INC"

 PAGE
;  Now, Put in Program Code

HelloWorld 			;  "Hello World" String
  addwf	 PCL
  dt	 "  Hello World", 0


MainLine			;  Now, Run the Program


  movlw	 2			;  Make Sure Nothing is Output
  movwf	 PORTA
  bsf	 STATUS, RP0		;  Make RA1 Output
  bcf	 TRISA & 0x07F, 1
  bcf	 STATUS, RP0

  call	 Dlay			;  Wait 60 msec for LCD to become enabled
  call	 Dlay

  movlw	 0x0D			;  Send CR to Initialize the Display
  call	 SendCHAR

  call	 Dlay			;  Wait 30 msec for everything to get Setup

  clrf	 FSR 			;  Setup FSR to Output the String

Loop				;  Now, Output the Message

  movf	 FSR, w			;  Send the the Character at FSR offset
  call	 HelloWorld		
  iorlw	 0			;  Are we at the End?
  btfsc	 STATUS, Z
   goto	 Stop			;  Yes, Stop the Program

  call	 SendCHAR		;  No - Send the Character to the SLI

  incf	 FSR			;  Point to the Next Character

  goto	 Loop			

Stop				;  Finished with the Program
  goto	 $			;  Yes, Loop Around forever

 
 PAGE
;  Subroutines Needed by "Hello"
Dlay
  movlw  16			;  Delay for 30 msec
  movwf  Count
  movlw  39
  movwf  Counthi
  decfsz Count
   goto  $ - 1
  decfsz Counthi
   goto  $ - 3

  return


  end
