mgbglasgow
Junior Member level 1
- Joined
- Jun 15, 2011
- Messages
- 15
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,508
hi all,
my first post, im having issues with lcd on pic 18f1320, have ported the code from 16f84 sample and can place the cursor on the lcd with ease, but just cant get a character to appear.
my code is below, any help would be greatly appreciated
; lcd routine, testing delay routines for 5ms (4.1ms), 50ms (40ms), 150us (100us mini.)
;*********************************************************
INCLUDE "P18F1320.INC"
; EQUATES SECTION
;*********************************************************
LIST P=PIC18F1320, ; we are using the 18F1320
ORG 0 ;the start address in memory is 0
GOTO START ; goto start!
;**********************************************************************
; Configuration Bits
CONFIG IESO=OFF ;disable osc switching
CONFIG BORV=45 ;set brown out to 4.5 volts
CONFIG PWRT=ON ;use power timer
CONFIG BOR=ON ;enable brown out protection
CONFIG WDT=OFF ;diasble WDT
;*********************************************************
;SUBROUTINE SECTION.
; 100ms SECOND DELAY, VALUE OF FFC2
DELAYP1 MOVLW 0x08
MOVWF T0CON
MOVLW 0xFF
MOVWF TMR0H
MOVLW 0xC2
MOVWF TMR0L
BCF INTCON, TMR0IF
BSF T0CON, TMR0ON
AGAIN5 BTFSS INTCON, TMR0IF
BRA AGAIN5
BCF T0CON, TMR0ON
RETLW 0
; 250ms SECOND DELAY, VALUE OF FFC2
DELAYP25 MOVLW 0x08
MOVWF T0CON
MOVLW 0xFF
MOVWF TMR0H
MOVLW 0x5A
MOVWF TMR0L
BCF INTCON, TMR0IF
BSF T0CON, TMR0ON
AGAIN3 BTFSS INTCON, TMR0IF
BRA AGAIN3
BCF T0CON, TMR0ON
RETLW 0
; 1 SECOND DELAY, VALUE OF E0FF
DELAY1 MOVLW 0x08
MOVWF T0CON
MOVLW 0xE0
MOVWF TMR0H
MOVLW 0xFF
MOVWF TMR0L
BCF INTCON, TMR0IF
BSF T0CON, TMR0ON
AGAIN4 BTFSS INTCON, TMR0IF
BRA AGAIN4
BCF T0CON, TMR0ON
RETLW 0
CLOCK BSF PORTA,2 ;Clock RB0 high
CALL DELAYP25
BCF PORTA,2 ;Clock RB0 low.
CALL DELAYP25
RETLW 0
DELAY3 CALL DELAY1 ;3 second delay
CALL DELAY1
CALL DELAY1
RETLW 0
;*********************************************************
Aa MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 1H ;41 is code for A
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Bb MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 2H ;42 is code for B
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Cc MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 3H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Dd MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 4H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Ee MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 5H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Ff MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 6H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Gg MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 7H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Hh MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 8H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Ii MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 9H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Jj MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 0AH
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Kk MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 0BH
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Ll MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 0CH
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Mm MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 0DH
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Nn MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
MOVLW 0EH
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Oo MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 0FH
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Pp MOVLW 2
MOVWF PORTA
MOVLW 5H
MOVWF PORTB
CALL CLOCK
MOVLW 0H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Qq MOVLW 2
MOVWF PORTA
MOVLW 5H
MOVWF PORTB
CALL CLOCK
MOVLW 1H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Rr MOVLW 2
MOVWF PORTA
MOVLW 5H
MOVWF PORTB
CALL CLOCK
MOVLW 2H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Ss MOVLW 2
MOVWF PORTA
MOVLW 5H
MOVWF PORTB
CALL CLOCK
MOVLW 3H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Tt MOVLW 2
MOVWF PORTA
MOVLW 5H
MOVWF PORTB
CALL CLOCK
MOVLW 4H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Uu MOVLW 2
MOVWF PORTA
MOVLW 5H
MOVWF PORTB
CALL CLOCK
MOVLW 5H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Vv MOVLW 2
MOVWF PORTA
MOVLW 5H
MOVWF PORTB
CALL CLOCK
MOVLW 6H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Ww MOVLW 2
MOVWF PORTA
MOVLW 5H
MOVWF PORTB
CALL CLOCK
MOVLW 7H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Xx MOVLW 2
MOVWF PORTA
MOVLW 5H
MOVWF PORTB
CALL CLOCK
MOVLW 8H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Yy MOVLW 2
MOVWF PORTA
MOVLW 5H
MOVWF PORTB
CALL CLOCK
MOVLW 9H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Zz MOVLW 2
MOVWF PORTA
MOVLW 5H
MOVWF PORTB
CALL CLOCK
MOVLW 0AH
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
NUM0 MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 3H
MOVWF PORTB
CALL CLOCK
MOVLW 0H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
NUM1 MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 3H
MOVWF PORTB
CALL CLOCK
MOVLW 1H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
NUM2 MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 3H
MOVWF PORTB
CALL CLOCK
MOVLW 2H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
NUM3 MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 3H
MOVWF PORTB
CALL CLOCK
MOVLW 3H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
NUM4 MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 3H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
MOVLW 4H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
NUM5 MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 3H
MOVWF PORTB
CALL CLOCK
MOVLW 5H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
NUM6 MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 3H
MOVWF PORTB
CALL CLOCK
MOVLW 6H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
NUM7 MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 3H
MOVWF PORTB
CALL CLOCK
MOVLW 7H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
NUM8 MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 3H
MOVWF PORTB
CALL CLOCK
MOVLW 8H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
NUM9 MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 3H
MOVWF PORTB
CALL CLOCK
MOVLW 9H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
GAP MOVLW 2
MOVWF PORTA
MOVLW 2H
MOVWF PORTB
CALL CLOCK
MOVLW 0H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
DOT MOVLW 2
MOVWF PORTA
MOVLW 2H
MOVWF PORTB
CALL CLOCK
MOVLW 0EH
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
CLRDISP CLRF PORTA
MOVLW 0H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
MOVLW 1
MOVWF PORTB
CALL CLOCK
CALL DELAYP1
RETLW 0
;*********************************************************
;CONFIGURATION SECTION
START BSF STATUS,5 ;Turns to Bank1.
MOVLW B'00000000' ;All 5bits of PORTA are all outputs
MOVWF TRISA
MOVLW B'00000000'
MOVWF TRISB ;PORTB is OUTPUT
BCF STATUS, 5
CLRF PORTA ;Clears PortA.
CLRF PORTB ;Clears PortB.
;Display Configuration
MOVLW 03H ;FUNCTION SET
MOVWF PORTB ;8bit data (default)
CALL CLOCK
CALL DELAYP1 ;wait for display
MOVLW 02H ;FUNCTION SET
MOVWF PORTB ;change to 4bit
CALL CLOCK ;clock in data
CALL DELAYP1 ;wait for display
MOVLW 02H ;FUNCTION SET
MOVWF PORTB ;must repeat command
CALL CLOCK ;clock in data
CALL DELAYP1 ;wait for display
MOVLW 08H ;4 bit micro
MOVWF PORTB ;using 2 line display.
CALL CLOCK ;clock in data
CALL DELAYP1
MOVLW 0H ;Display on, cursor blinking
MOVWF PORTB ;0EH
CALL CLOCK
MOVLW 0FH
MOVWF PORTB
CALL CLOCK
CALL DELAY3
CALL DELAYP25
MOVLW 0H ;Increment cursor, 06H
MOVWF PORTB
CALL CLOCK
MOVLW 6H
MOVWF PORTB
CALL CLOCK
;*********************************************************
;Program starts now.
BEGIN CALL CLRDISP
CLRF PORTA
MOVLW 8H ;Cursor at MID TOP, 88H
MOVWF PORTB
CALL CLOCK
MOVLW 0H
MOVWF PORTB
CALL CLOCK
LOOP CALL Aa
CALL DELAY1
CALL Bb
CALL DELAY1
CALL Cc
CALL DELAY1
GOTO LOOP
END
my first post, im having issues with lcd on pic 18f1320, have ported the code from 16f84 sample and can place the cursor on the lcd with ease, but just cant get a character to appear.
my code is below, any help would be greatly appreciated
; lcd routine, testing delay routines for 5ms (4.1ms), 50ms (40ms), 150us (100us mini.)
;*********************************************************
INCLUDE "P18F1320.INC"
; EQUATES SECTION
;*********************************************************
LIST P=PIC18F1320, ; we are using the 18F1320
ORG 0 ;the start address in memory is 0
GOTO START ; goto start!
;**********************************************************************
; Configuration Bits
CONFIG IESO=OFF ;disable osc switching
CONFIG BORV=45 ;set brown out to 4.5 volts
CONFIG PWRT=ON ;use power timer
CONFIG BOR=ON ;enable brown out protection
CONFIG WDT=OFF ;diasble WDT
;*********************************************************
;SUBROUTINE SECTION.
; 100ms SECOND DELAY, VALUE OF FFC2
DELAYP1 MOVLW 0x08
MOVWF T0CON
MOVLW 0xFF
MOVWF TMR0H
MOVLW 0xC2
MOVWF TMR0L
BCF INTCON, TMR0IF
BSF T0CON, TMR0ON
AGAIN5 BTFSS INTCON, TMR0IF
BRA AGAIN5
BCF T0CON, TMR0ON
RETLW 0
; 250ms SECOND DELAY, VALUE OF FFC2
DELAYP25 MOVLW 0x08
MOVWF T0CON
MOVLW 0xFF
MOVWF TMR0H
MOVLW 0x5A
MOVWF TMR0L
BCF INTCON, TMR0IF
BSF T0CON, TMR0ON
AGAIN3 BTFSS INTCON, TMR0IF
BRA AGAIN3
BCF T0CON, TMR0ON
RETLW 0
; 1 SECOND DELAY, VALUE OF E0FF
DELAY1 MOVLW 0x08
MOVWF T0CON
MOVLW 0xE0
MOVWF TMR0H
MOVLW 0xFF
MOVWF TMR0L
BCF INTCON, TMR0IF
BSF T0CON, TMR0ON
AGAIN4 BTFSS INTCON, TMR0IF
BRA AGAIN4
BCF T0CON, TMR0ON
RETLW 0
CLOCK BSF PORTA,2 ;Clock RB0 high
CALL DELAYP25
BCF PORTA,2 ;Clock RB0 low.
CALL DELAYP25
RETLW 0
DELAY3 CALL DELAY1 ;3 second delay
CALL DELAY1
CALL DELAY1
RETLW 0
;*********************************************************
Aa MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 1H ;41 is code for A
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Bb MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 2H ;42 is code for B
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Cc MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 3H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Dd MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 4H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Ee MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 5H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Ff MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 6H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Gg MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 7H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Hh MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 8H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Ii MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 9H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Jj MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 0AH
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Kk MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 0BH
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Ll MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 0CH
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Mm MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 0DH
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Nn MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
MOVLW 0EH
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Oo MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 4H
MOVWF PORTB
CALL CLOCK
MOVLW 0FH
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Pp MOVLW 2
MOVWF PORTA
MOVLW 5H
MOVWF PORTB
CALL CLOCK
MOVLW 0H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Qq MOVLW 2
MOVWF PORTA
MOVLW 5H
MOVWF PORTB
CALL CLOCK
MOVLW 1H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Rr MOVLW 2
MOVWF PORTA
MOVLW 5H
MOVWF PORTB
CALL CLOCK
MOVLW 2H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Ss MOVLW 2
MOVWF PORTA
MOVLW 5H
MOVWF PORTB
CALL CLOCK
MOVLW 3H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Tt MOVLW 2
MOVWF PORTA
MOVLW 5H
MOVWF PORTB
CALL CLOCK
MOVLW 4H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Uu MOVLW 2
MOVWF PORTA
MOVLW 5H
MOVWF PORTB
CALL CLOCK
MOVLW 5H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Vv MOVLW 2
MOVWF PORTA
MOVLW 5H
MOVWF PORTB
CALL CLOCK
MOVLW 6H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Ww MOVLW 2
MOVWF PORTA
MOVLW 5H
MOVWF PORTB
CALL CLOCK
MOVLW 7H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Xx MOVLW 2
MOVWF PORTA
MOVLW 5H
MOVWF PORTB
CALL CLOCK
MOVLW 8H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Yy MOVLW 2
MOVWF PORTA
MOVLW 5H
MOVWF PORTB
CALL CLOCK
MOVLW 9H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
Zz MOVLW 2
MOVWF PORTA
MOVLW 5H
MOVWF PORTB
CALL CLOCK
MOVLW 0AH
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
NUM0 MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 3H
MOVWF PORTB
CALL CLOCK
MOVLW 0H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
NUM1 MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 3H
MOVWF PORTB
CALL CLOCK
MOVLW 1H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
NUM2 MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 3H
MOVWF PORTB
CALL CLOCK
MOVLW 2H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
NUM3 MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 3H
MOVWF PORTB
CALL CLOCK
MOVLW 3H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
NUM4 MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 3H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
MOVLW 4H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
NUM5 MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 3H
MOVWF PORTB
CALL CLOCK
MOVLW 5H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
NUM6 MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 3H
MOVWF PORTB
CALL CLOCK
MOVLW 6H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
NUM7 MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 3H
MOVWF PORTB
CALL CLOCK
MOVLW 7H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
NUM8 MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 3H
MOVWF PORTB
CALL CLOCK
MOVLW 8H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
NUM9 MOVLW 2 ;enables the display
MOVWF PORTA
MOVLW 3H
MOVWF PORTB
CALL CLOCK
MOVLW 9H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
GAP MOVLW 2
MOVWF PORTA
MOVLW 2H
MOVWF PORTB
CALL CLOCK
MOVLW 0H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
DOT MOVLW 2
MOVWF PORTA
MOVLW 2H
MOVWF PORTB
CALL CLOCK
MOVLW 0EH
MOVWF PORTB
CALL CLOCK ;clock character onto display.
RETLW 0
CLRDISP CLRF PORTA
MOVLW 0H
MOVWF PORTB
CALL CLOCK ;clock character onto display.
MOVLW 1
MOVWF PORTB
CALL CLOCK
CALL DELAYP1
RETLW 0
;*********************************************************
;CONFIGURATION SECTION
START BSF STATUS,5 ;Turns to Bank1.
MOVLW B'00000000' ;All 5bits of PORTA are all outputs
MOVWF TRISA
MOVLW B'00000000'
MOVWF TRISB ;PORTB is OUTPUT
BCF STATUS, 5
CLRF PORTA ;Clears PortA.
CLRF PORTB ;Clears PortB.
;Display Configuration
MOVLW 03H ;FUNCTION SET
MOVWF PORTB ;8bit data (default)
CALL CLOCK
CALL DELAYP1 ;wait for display
MOVLW 02H ;FUNCTION SET
MOVWF PORTB ;change to 4bit
CALL CLOCK ;clock in data
CALL DELAYP1 ;wait for display
MOVLW 02H ;FUNCTION SET
MOVWF PORTB ;must repeat command
CALL CLOCK ;clock in data
CALL DELAYP1 ;wait for display
MOVLW 08H ;4 bit micro
MOVWF PORTB ;using 2 line display.
CALL CLOCK ;clock in data
CALL DELAYP1
MOVLW 0H ;Display on, cursor blinking
MOVWF PORTB ;0EH
CALL CLOCK
MOVLW 0FH
MOVWF PORTB
CALL CLOCK
CALL DELAY3
CALL DELAYP25
MOVLW 0H ;Increment cursor, 06H
MOVWF PORTB
CALL CLOCK
MOVLW 6H
MOVWF PORTB
CALL CLOCK
;*********************************************************
;Program starts now.
BEGIN CALL CLRDISP
CLRF PORTA
MOVLW 8H ;Cursor at MID TOP, 88H
MOVWF PORTB
CALL CLOCK
MOVLW 0H
MOVWF PORTB
CALL CLOCK
LOOP CALL Aa
CALL DELAY1
CALL Bb
CALL DELAY1
CALL Cc
CALL DELAY1
GOTO LOOP
END