LCD Programming with Assembly Language

in #programming6 years ago

I think it is very useful code for engineering students. There are many resources on the internet for C programming, but there is no source in the assembly language. I share the project with you. I use PIC18F4520 microcontroller.

Simulation Picture.PNG

LIST P=18f4520
INCLUDE "P18f4520.INC"
ORG 0
CLRF PORTB
CLRF PORTD ;Clear PORTB and PORTB
CLRF TRISB
CLRF TRISD ;Select as PORTB and PORTD output
START
CALL LCD_Settings
CALL NAME
GOTO START
NAME
MOVLW 'F'
MOVWF PORTB
CALL LCD_Send
MOVLW 'A'
MOVWF PORTB
CALL LCD_Send
MOVLW 'T'
MOVWF PORTB
CALL LCD_Send
MOVLW 'I'
MOVWF PORTB
CALL LCD_Send
MOVLW 'H'
MOVWF PORTB
CALL LCD_Send
MOVLW ' '
MOVWF PORTB
CALL LCD_Send
MOVLW 'D'
MOVWF PORTB
CALL LCD_Send
MOVLW 'U'
MOVWF PORTB
CALL LCD_Send
MOVLW 'N'
MOVWF PORTB
CALL LCD_Send
MOVLW 'D'
MOVWF PORTB
CALL LCD_Send
MOVLW 'A'
MOVWF PORTB
CALL LCD_Send
MOVLW 'R'
MOVWF PORTB
CALL LCD_Send
RETURN
;**********LCD SETTINGS**********
R1 EQU 0X0A
R2 EQU 0X0B
R3 EQU 0X0C
;LCD Configuration
LCD_Settings
BCF PORTD,0 ; RS=0
CALL LCD_Command
MOVLW 0x0C ; Close Cursor
MOVWF PORTB
CALL LCD_Command
BSF PORTD, 0 ; RS=1
RETURN
;Send Command Subroutine
LCD_Command
BSF PORTD,1; E=1
BCF PORTD,1; E=0
CALL DELAY
RETURN
;Send Data Subroutine
LCD_Send
BSF PORTD,0 ; RS=1
CALL LCD_Command
RETURN
; Delay Subroutine
DELAY
MOVLW D'10'
MOVWF R3
LOOP MOVLW D'10'
MOVWF R2
LOOP_1 MOVLW D'10'
MOVWF R1
LOOP_2 NOP
DECF R1,F
BNZ LOOP_2
DECF R2,F
BNZ LOOP_1
DECF R3,F
BNZ LOOP
RETURN

END
Sort:  

WARNING - The message you received from @mdalamgir is a CONFIRMED SCAM!
DO NOT FOLLOW any instruction and DO NOT CLICK on any link in the comment!

For more information, read this post:
https://steemit.com/steemit/@arcange/phishing-site-reported-postupper-dot-ml

If you find my work to protect you and the community valuable, please consider to upvote this warning or to vote for my witness.

Congratulations @baymuhendis! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You made your First Vote
You got a First Vote

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

Upvote this notification to help all Steemit users. Learn why here!