P IC single chip LCD 1602 displays the website address and phone number
;************************************
PCL EQU 2H ;Define the low byte address of program memory
STATUS EQU 3H ;Define the status register address
PORTD EQU 8H ;Define the RD port data register address
PORTC EQU 7H ;define the address of RC port data register
TRISD EQU 88H ;define the address of RD port direction control register
TRISC EQU 87H ;define the address of RC port direction control register
ADCON1 EQU 9FH ;define the address of ADC module control register 1
;********************
Z EQU 2 ;define the address of 0 status bit
RP0 EQU 5 ;define the address of page select bit RP0
;************************
RS EQU 2 ;LCD register select signal pin is defined at RD.2 pin
RW EQU 1 ;LCD read/write signal pin is defined at RD.1 pin
E EQU 0 ;LCD chip select signal pin is defined at RD.0 pin
COUNT EQU 24H ;define the address of count register
TMP1 EQU 25H ;define the address of temporary register
;**********************
ORG 000H
NOP ;place a null operation instruction
GOTO MAIN
ORG required by ICD 0008H
;******************************************************
TABLE ;Get the display code of the first line WWW.PICAVR.COM
ADDWF PCL,1 ;Address offset plus current PC value
RETLW 20H ;Space
RETLW 57H ;W
RETLW 57H ;W
RETLW 57H ;W
RETLW 2EH ;.
RETLW 50H ;P
RETLW 49H ;I
RETLW 43H ;C
RETLW 41H ;A
RETLW 56H ;V
RETLW 52H ;R
RETLW 2EH ;.
RETLW 43H ;C
RETLW 4FH ;O
RETLW 4DH ;M
RETLW 20H ;SpaceRETLW
00H
;-------------------- ----------------------------------
TABLE1 ;Get the display code of the second lineTEL:020-86307727
ADDWF PCL,1 ;Address offset plus current PC valueRETLW
54H ;T
RETLW 45H ;E
RETLW 4CH ;L
RETLW 3AH ;:
RETLW 30H ;0
RETLW 32H ;2
RETLW 30H ;0
RETLW 0B0H ;-
RETLW 38H ;8
RETLW 36H ;6
RETLW 33H ;3
RETLW 30H ;0
RETLW 37H ;7
RETLW 37H ;7
RETLW 32H ;2
RETLW 37H ;7
RETLW 20H ;space
RETLW 00H
;******* ************************************************
MAIN
BSF STATUS,RP0
MOV LW 07H
MOV WF ADCON1 ; Set RA port to normal digital IO port
MOV LW 00H
MOV WF TRISD ; Define RD port and RC port to output
MOV WF TRISC
BCF STATUS,RP0
CALL DELAY ;Call delay, LCD reset may not be as fast as PIC when powered on
MOV LW 01H
MOV WF PORTC ;Clear screen
CALL ENABLE
MOV LW 38H
MOV WF PORTC ;8-bit 2-line 5x7 dot matrix
CALL ENABLE
MOV LW 0FH ;Display, cursor, and blinking turned on
MOV WF PORTC
CALL ENABLE
MOV LW 06H ;Text does not move, cursor automatically moves right
MOV WF PORTC
CALL ENABLE
MOV LW 80H
MOV WF PORTC ; Display position
CALL ENABLE
CALL WRITE1 ;Call the subroutine to send the first line of numbers "WWW.PICAVR.COM"
MOV LW 0C0H
MOV WF PORTC ;The location of the first line
CALL ENABLE
CALL WRITE2 ;Call the subroutine to send the second line of numbers "TEL:020-86307727"
CALL ENABLE
GOTO $
;************************
WRITE1
CLRF COUNT ;Send the first line of numbers
WRITE_A
MOV FW COUNT
CALL TABLE
MOV WF TMP1
CALL WRITE3
INCF COUNT,1
MOV FW TMP1
XORLW 00H
BTFSS STATUS,Z
GOTO WRITE_A
RETLW 0
;****************************
WRITE2 ;Send the second line of numbers
CLRF COUNT
WRITE2_A
MOV FW COUNT
CALL TABLE1
MOV WF TMP1
CALL WRITE3
INCF COUNT,1
MOV FW TMP1
XORLW 00H
BTFSS STATUS,Z
GOTO WRITE2_A
RETLW 0
;**************************
WRITE3 ;Send data to LCD subroutine
MOV WF PORTC
BSF PORTD,RS
BCF PORTD,RW
BCF PORTD,E
CALL DELAY
BSF PORTD,E
RETLW 0
;***********************************************
ENABLE
BCF PORTD,RS ;Write control command subroutine
BCF PORTD,RW
BCF PORTD,E
CALL DELAY
BSF PORTD,E
RETLW 0
;************************************************
DELAY
;Subroutine name, also subroutine entry address
MOV lw 0ffh ;Send the outer loop parameter value FFH through W MOV wf 20h ;to the 20H unit lp0
used as the outer loop variable
MOV lw 0ffh ; pass the inner loop parameter value FFH through W
MOV wf 21h ; send it to the 21H unit used as the inner loop variable
lp1 decfsz 21h,1 ; decrement the content of variable 21H, if it is 0, jump to
goto lp1 ; jump to LP1
decfsz 20h,1 ; decrement the content of variable 20H, if it is 0, jump
to goto lp0 ; jump to LP0
return ; return to the main program
end ; end of source program
Previous article:PIC microcontroller AD conversion LED display program
Next article:PIC microcontroller LCD1602 displays a single letter A program
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- TI supports Bluetooth technology for high-precision body temperature measurement flexible PCB reference design
- Introduction to Machine Vision Technology
- 【RT-Thread Reading Notes】1. RT-Thread RTOS Preface
- I would like to ask about an EXCEL curve fitting formula. I cannot get the value of Y by substituting the values of X (0, 150, 300). The value of Y is not correct.
- EEWORLD University ---- Sensors and Testing Technology
- The first question after the New Year is how dare I use this IGBT driving current.
- Bluetooth module interfaces
- Weak Bluetooth signal strength and excessive static power consumption of the product
- Analysis of the circuit diagram of infrared pair tube. Can someone please help me analyze it?
- Application design of active RFID tag based on MSP430F2012 and nRF24L01