Please help make this code run through MPLAB IDE 420:
;***************************************************************************************
;Filename: LAB#7_SHORT.ASM *
;Function: Demonstrates parallel communications with a Hitachi LCD module.
; Wiring:
; RB7:RB0 connected to D7:D0 of LCD Module
; RA0 connected to E line of LCD Module
; RA1 connected to RS line of LCD module *
;Author: Your Name Here *
;Date: 01/01/2012 *
;***************************************************************************************
#include <../General.H>
DELAY1 EQU 0X10 ;Delay loop variable
DELAY2 EQU 0X11 ;Delay loop variable
DELAY3 EQU 0X12 ;Delay loop variable
MSGCOUNT EQU 0X13 ;Message counter variable
TMP EQU 0x14 ;Holds the table offset for the long table
__CONFIG 0X3FF2 ;This is the control bits for CONFIG register
ORG 0X0000 ;RESET or WDT reset vector
GOTO START
ORG 0X0004 ;Regular INT vector
RETFIE
LCDINIT
BCF PORTA,1 ;RA1=RS, Set RS line Lo for commands
MOVLW 0X30 ;Sends reset command to LCD (3 times)
MOVWF PORTB
CALL LCDCOMMS
MOVLW 0X30
MOVWF PORTB
CALL LCDCOMMS
MOVLW 0X30
MOVWF PORTB
CALL LCDCOMMS
MOVLW 0X38 ;Sets LCD to advance automatically with each data byte
MOVWF PORTB
CALL LCDCOMMS
MOVLW 0X0C
MOVWF PORTB
CALL LCDCOMMS
MOVLW 0X01
MOVWF PORTB
CALL LCDCOMMS
MOVLW 0X06
MOVWF PORTB
CALL LCDCOMMS
MOVLW 0X02
MOVWF PORTB
CALL LCDCOMMS
BSF PORTA,1 ;RA1=RS, Set RS line Hi for data
RETURN
LCDCOMMS
BCF PORTA,0 ;RA0=E, set E Lo
NOP
NOP ;3 Instruction cycle delay for LCD to recognize 'E' line being low
NOP
BSF PORTA,0 ;RA0=E, Set Hi
CALL LCDDELAY
RETURN
LCDDELAY
; 20 mS time delay used for the LCD Module to update after presenting a byte
MOVLW 0X10
MOVWF DELAY1
LOOP1
MOVLW 0X10
MOVWF DELAY2
LOOP2
MOVLW 0XF0
MOVWF DELAY3
LOOP3
DECFSZ DELAY3,F
GOTO LOOP3
DECFSZ DELAY2,F
GOTO LOOP2
DECFSZ DELAY1,F
GOTO LOOP1
RETURN
START
BSF STATUS,RP0
MOVLW 0XFC ;Set RA0 & RA1 as outputs
MOVWF TRISA
MOVLW 0X00 ;Set all of PORTB as outputs
MOVWF TRISB
BCF STATUS,RP0
BSF PORTA,0
BSF PORTA,1
CALL LCDINIT ;Initializing LCD
CLRF MSGCOUNT ;Sets message counter to 0x00
DISPLAY
MOVF MSGCOUNT,W ;Put message counter in W
MOVWF TMP ; tore offset
INCF MSGCOUNT,F ; ncrement message counter
CALL SHORT_TABLE ;Call table routinue
MOVWF PORTB ;Place ASCII code on LCD Module Inputs
ADDLW 0X00
BTFSC STATUS,Z ;Check to see if last byte was 0x00
GOTO STOP ; f so, STOP
CALL LCDCOMMS ;If not, send byte to LCD
GOTO DISPLAY ; and retrieve next byte
STOP
GOTO STOP
SHORT_TABLE
MOVF TMP,W
ADDWF PCL,F ;Go to the appropriate RETLW
MSG
DT "Welcome to Farmingdale State College."
RETLW 0X00
END
+6V 1602 LCD 22pf PIC16F84A LCD example w 86888885 10K 29 4 70 11 126 SMHZ PIC16F84A 150 18 220 OSC1/CLKN RAD OSC2/CLKOUT RAT RAZ MCLR RA3 RAITOCKI 32 23 45V TOK 28 29 RBOINT R81 R82 RB3 RB4 RBS RBG RB7 10 11 12
Please help make this code run through MPLAB IDE 420: ;*****************************************************************
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am