Programming Aspects of Moving message display project using 8051:-
In this post we will discuss the software or program or code written for moving message display project using microcontroller 8051.
In this section, we will try to answer the issues related to the timings of the signals generated. The timing of the signal relates to the order in which an instruction or command is sent to the LCD along with the appropriate signal of control signals. For example, if the Microcontroller programmer intends to send a byte of data intended for the display screen; the programmer will follow the following pseudo code steps:
 Clear R/S signal to indicate an instruction is being sent
 Clear R/W signal to indicate writing to the LCD is being intended
 Move data to the data lines
 Set Bit EN signal and then Clear EN to indicate that data intended to the LCD is present on the connecting interface latch
 Check for Busy Flag to be set to logic zero. This to ensure that when next time data is to be sent to the LCD module, the LCD is not in the middle of performing any internal operations [4].
5.1 Code Overview
In this section, we will discuss some of the important sections of the code written for the Microcontroller. The code for the convenience of the reader is produced here as well as present in the soft copy in the attached files.
BUFFER EQU 05FH  ;LOCATION FOR STORAGE LCD DATA 
BUFF_POINTER EQU 05EH  ;LOCATION HOLDS BUFFER CURRENT POINTER
DATA_LINE EQU 090H  ;WRITING TO PORT 1
ORG 0000H
LJMP MAIN
;********************SERIAL ISR**********************************
 ORG 0023H
 PUSH ACC
 PUSH 00H
 LCALL SERIAL_ISR
 POP 00H
 POP ACC
 RETI
;****************************************************************
;LCD CONTROL SIGNALS
 LCD_EN EQU  0B7H
 LCD_RW  EQU  0B6H
 LCD_RS  EQU  0B5H
;LCD CONFIGURATIONS COMMANDS
 FNC_SET EQU 38H  ;8 BIT ,2 LINE , 5X7 MATRIX
 ENT_MOD EQU 06H
 ;DIFFERENT SETTINGS OF BLINK,DISPLAY AND CURSOR ON/OFF
 DOF_COF_BOF EQU 08H
 DOF_COF_BON EQU 09H
 DOF_CON_BOF EQU 0AH
 DOF_CON_BON EQU 0BH
 DON_COF_BOF EQU 0CH   
 DON_COF_BON EQU 0DH    
 DON_CON_BOF EQU 0EH   
 DON_CON_BON EQU 0FH 
 CLR_DISP EQU 01H
 HOME_CUR EQU 02H
 ;DIFFERENT SETTING OF CURSOR/DISPLAY SHIFT RIGHT/LEFT
 CUR_L EQU 10H
 CUR_R EQU 14H
 DISP_L EQU 18H
 DISP_R EQU 1CH
;************************************************************** 
MAIN:
 MOV R0,#BUFF_POINTER
 MOV @R0,#BUFFER   ;STORE THE INTIAL POINT OF WRITING STRING
 ;START TIMER 1 FOR BAUD RATE GENERATION
 MOV TMOD,#21H
 MOV TH1,#-26
 MOV TL1,#-26
 SETB TR1
 MOV SCON,#50H  ;INIT THE SERIAL PORT FOR RECEPTION
 MOV IE,#90H  ;ENABLE SERIAL INTERUPT
 MOV P1,#0H
 MOV P3,#0H
 MOV R0,#BUFFER+1
 MOV @R0,#'A'
 INC R0
 MOV @R0,#'B'
 INC R0
 MOV @R0,#'C'
 INC R0
 MOV @R0,#0H
 MOV R7,#1H ;100  ;SET DELAY TIMER
 ;LCALL DELAY
 ;LCALL INIT
 LCALL PRINT_STR
 SJMP $
;*************************** DELAY ROUTINE *************************
;THE ROUTINE PRODUCES A DELAY OF 10 msec
;VALUE EXPECTED IN R7, FOR NUMBER OF TIMES 
;TO RUN THIS FUNCTION
DELAY:
AGAIN:
 MOV TH0,#HIGH(-10000)
 MOV TL0,#LOW(-10000)
 SETB TR0
 JNB TF0,$
 CLR TF0
 CLR TR0
 DJNZ R7,AGAIN
 RET
;********************************************************************
;******************INITIALIZATION AND RESEST ROUTINE FOR LCD********
INIT:
 CLR LCD_EN
 CLR LCD_RW
 CLR LCD_RS
 MOV R7,#FNC_SET   ;WRITING FUNCTION SET TO LCD
 LCALL WRITE_LCD_INST
 MOV R7,#01H  ;GIVE 10MS DELAY
 MOV R7,#FNC_SET   ;WRITING FUNCTION SET TO LCD
 LCALL WRITE_LCD_INST
 MOV R7,#01H  ;GIVE 10MS DELAY
 MOV R7,#FNC_SET   ;WRITING FUNCTION SET TO LCD
 LCALL WRITE_LCD_INST
 MOV R7,#01H  ;GIVE 10MS DELAY
 MOV R7,#DOF_COF_BOF 
 LCALL WRITE_LCD_INST
 MOV R7,#DON_CON_BOF 
 LCALL WRITE_LCD_INST
 MOV R7,#CLR_DISP 
 LCALL WRITE_LCD_INST
 MOV R7,#ENT_MOD
 LCALL WRITE_LCD_INST
 RET
;*********************************************************************
;*********************WRITING COMMANDS TO LCD*************************
;THE COMMAND TO BE SENT IS PLACED IN R7
WRITE_LCD_INST:
 CLR LCD_EN
 CLR LCD_RS
 CLR LCD_RW
 MOV DATA_LINE,R7
 SETB LCD_EN
 CLR LCD_EN
 LCALL CHK_BZ_FLAG
 MOV R7,#02H
 RET
;*************************************************************
;****************************************************************
;******CHECKS FOR BUSY FLAG FOR THE LCD*******************
;READS LCD STATUS AND CHECKS BZ FLAG IN MSB OF DATA_LINE
CHK_BZ_FLAG:
 CLR LCD_EN
 SETB LCD_EN
 CLR LCD_EN 
 MOV DATA_LINE,#0FFH ;TO CONFIGUREPORT TO READ INPUT
 SETB LCD_RW
 PUSH ACC
CHK_PULSE:
 SETB LCD_EN
 MOV A,DATA_LINE
 CLR LCD_EN
 JB ACC.7,CHK_PULSE
 POP ACC 
 CLR LCD_RW
 RET
;**************************************************************************
;************************WRITING DATA TO LCD*******************************
;WRITES DATA TO LCD. ACCEPTS DATATO BE SENT IN R7
WRITE_LCD_DATA:
 CLR LCD_EN
 SETB LCD_RS
 CLR LCD_RW
 MOV DATA_LINE,R7
 SETB LCD_EN
 CLR LCD_EN
 CLR LCD_RS  
 LCALL CHK_BZ_FLAG
 RET
;**************************************************************************
;*********************PRINTS THE CONTENTS OF BUFFER************************
;bUFFER LOCATION HOLDS THE STRING TO BE TRANSMITTED,IT IS 0 TERMINATED
PRINT_STR:
 MOV R0,#BUFFER+1
 PRINT_NEXT:
 CJNE @R0,#30H,PRINT
 SJMP END_STR
 PRINT:
 MOV A,@R0
 MOV R7,A
 LCALL WRITE_LCD_DATA
 INC R0
 SJMP PRINT_NEXT
END_STR:
 RET
;************************************************************************
;*************************SERIAL ISR HANDLER*****************************
SERIAL_ISR:
 CLR RI
 MOV A,SBUF
 CJNE A,#30H,STORE_VALUE
 MOV R0,BUFF_POINTER
 MOV @R0,#0H
 LCALL PRINT_STR  ;PRINTS THE RECIVED STRING
 RET
STORE_VALUE:
 MOV R0,BUFF_POINTER
 MOV @R0,A
 INC R0
 MOV BUFF_POINTER,R0
 RET
END
Tags:-
Programming Aspects of Moving message display project using 8051,assembly language program for lcd,software named Proteus 7 for simulating the working of our project,8051software ,8051 Software, C Compilers, Basic Editor, and Chip Simulator, PC-based programs, and a development board ,develop your 8051-based project, 8051 Software Tools Overview,Free 8051 Tools, Code and Projects,Free 8051 microcontroller resources,Easy To Use Monitor Program, AS31 Assembler, Development Circuit Board Design, Code Library ,Code Library ,8051 Code Examples,Assembly Language Programming: 8051,Test code for 8051SBC ,An introduction to the 8051, especially programming the 8051 in C using the Keil ,8051 code, with serial port code, math functions,program ming Phillips not working with Atmel code 8051 ,Assembly code for 1sec delay for 8051 ,How to write the 8051 program to control the alarm,Programming and Interfacing the 8051 in C and Assembly,8051 program code to HD44780 ,8051 microcontroller hardware interfacing tutorials ,8051 Microprocessor Example Program,ACCESSING CODE ROM SPACE IN 8051 C,Free 8051 Microcontroller projects