You are on page 1of 13

MOVING MESSAGE DISPLAY

Introduction of Moving Message Display Using Liquid Crystal Display and Microcontroller 8051 family.
The objective of the project is to provide non-commercial and purely academic insight into microcontroller assembly programming. The over all goal of the project is to provide connectivity between a desktop computer, microcontroller and a HD44 compatible LCD. Gold Rates Boards are widely used to display listing of product list, price list in corporate sectors, hotels, provision stores. Currency Display Board are widely used for displaying various currency rates at real time and thus find wide applications in various banks and money exchange counters.interest rate boards are in extensive usage and constantly in demand by various banks and money exchange counters.The microcontroller validates the SMS and then displays the. message in the LCD display board. The end user will type the desired string on the desktop and the result can be displayed on the LCD, which is connected to the microcontroller on the circuit board. The end user also has access to attractive features to move the LCD display in a specified direction. The LCD comes with a 14pin interface, which includes pins to receive power supply and ground as well. These 14pins have to be interfaced with microcontroller output ports to send instructions, which initialize the LCD in appropriate modes, and also to send data from the microcontroller is intended for display on the LCD output screen. The microcontroller is interfaced with the desktop through a full-duplex serial port. The pins are utilized to send byte at a time. The byte sent from the desktop can consist of instructions for the LCD and the end user desired new string to be displayed on the LCD. The microcontroller is interfaced with the LCD with 11 pins. The pins are utilized to send byte at a time and three pins are utilized to set the instruction modes on the LCD. The details of their uses and the information they carry will be discussed in depth later on.

Functional Components of Moving Message Display MMD:


Main components used in the project are listed below: ATMEL 89C51 Microcontroller. HD44780 Liquid Crystal Display. Max 232 Serial Interface IC.

Block Diagram of the Functioning of the Moving message display:-

MOVING MESSAGE DISPLAY

below is the block diagram of the moving messgae display using microcontroller.

Liquid Crystal Display LCD


The HD44780 dot-matrix liquid crystal display controller and driver LSI displays alphanumeric characters and symbols. It can be configured to drive a dot-matrix liquid crystal display when interfaced with a processor. A single HD44780 can display up to one 8-character line or two 8character lines. The HD44780 supports 8 dot character fonts and 32 5 10 dot character fonts for a total of 240 different character fonts.

2.1 Function Description of LCD


The following section will introduce the user with some of the important features of the liquid crystal display, that are important for interfacing with the liquid crystal display through software.
2.1.1 Registers of LCD The HD44780 has two 8-bit registers, an instruction register (IR) and a data register (DR). The IR stores instruction information, such as display clear and cursor shift, and address information for display data RAM (DDRAM) and character generator RAM (CGRAM). The DR temporarily stores data to be written into DDRAM or CGRAM and temporarily stores data to be read from DDRAM or CGRAM. Data written into the DR is automatically written into DDRAM or CGRAM by an internal operation. The DR is also used for data storage when reading data from DDRAM or CGRAM. When address information is written into the IR, data is read and then stored into the DR from DDRAM or CGRAM by an internal operation. 2.1.2 Busy Flag of LCD When the busy flag is 1, the HD44780U is in the internal operation mode, and the next instruction will

MOVING MESSAGE DISPLAY not be accepted. When RS = 0 and R/W = 1 (Table 1), the busy flag is output to DB7. The next instruction must be written after ensuring that the busy flag is 0. The following diagram can visualize the timing diagram for the busy flag check for th

Checking the Busy Flag (BF) of LCD 2.1.3 Address Counter of LCD The address counter (AC) assigns addresses to both DDRAM and CGRAM. When an address of an instruction is written into the IR, the address information is sent from the IR to the AC. Selection of either DDRAM or CGRAM is also determined concurrently by the instruction. After writing into (reading from) DDRAM or CGRAM, the AC is automatically incremented by 1 (decremented by 1). The AC contents are then output to DB0 to DB6 when RS = 0 and R/W = 1.e LCD. 2.2 Initializing by Internal Reset Circuit of LCD An internal reset circuit automatically initializes the HD44780 when the power is turned on. The following instructions are executed during the initialization. The busy flag (BF) is kept in the busy state until the initialization ends (BF = 1). The busy state lasts for 10 ms after VCC rises to 4.5 V. 1. Display clear 2. Function set: DL = 1; 8-bit interface data N = 0; 1-line display F = 0; 5 8 dot character font 3. Display on/off control: D = 0; Display off C = 0; Cursor off B = 0; Blinking off 4. Entry mode set: I/D = 1; Increment by 1 S = 0; No shift

MOVING MESSAGE DISPLAY

2.3 Pin Configuration The pin configuration of LCD along with their functionality is shown below Table 1: Pin Assignments of HD44780

2.4 Instruction Set of LCD Here is the instruction set summary of HD44780 LCD, also some explanation is provided in the following table. Table 2: Instruction Set Summary of HD44780

Introduction to 89C51 Microcontroller


Introduction to 89C51 Microcontroller: The ATMEL 89C51 is used here; some of the features with respect to our project are discussed here. 3.1 Memory Organization The ATMEL 89C51 implements a separate memory space for code and data, both code and data

MOVING MESSAGE DISPLAY

may be internal; however, both expand using external components to a maximum of 64k code memory and 64k data memory. The memory consists of on-chip ROM (4KB) and on-chip RAM (128B). The on-chip RAM contains rich arrangements of general-purpose storage, bit addressable storage, register banks, and special function registers (SFRs). The notable features are The registers and input/output ports are memory mapped The stack memory resides within the internal RAM 3.1.1 General-Purpose RAM There are total of 80 bytes of general-purpose RAM from address 30H to 7FH. Any location in this part can be addressed using direct or indirect addressing modes. 3.1.2 Bit-Addressable RAM The ATMEL 89C51 contain 210 bit-addressable locations, of which 128 are at byte addresses 20H through 2F, and the rest are in SFRs. Bits can be set, cleared, ANDed, ORed, etc with a single instruction. These bits can be accessed as bytes or as bits. 3.1.3 Register Banks The bottom 32 locations of internal memory contain the register banks, each having registers from R0 to R7. The different banks are selected using register bank select bits (RS0 and RS1) in program status word. 3.1.4 Special Function Registers The ATMEL 89C51 internal registers are configured as a part of on chip RAM: therefore each register also has an address. There are 21 special function registers, each having a name and direct address, for example accumulator has name A and address ACC
3.2 Input/output Ports 3.2.1 Port 0 Port 0 is a dual-purpose serving as general-purpose I/O port. For larger design it is used to multiplex the low byte of 16-bit address. 3.2.2 Port 1 Port 1 is a dedicated I/O port, used for interfacing to external devices. No alternate functionality is defined for the port. 3.2.3 Port 2 Port 2 is a dual-purpose port serving as general purpose I/O port, or as high byte of address bus for designs with external code memory exceeding 256 bytes. 3.2.4 Port 3 Port 3 is a dual-purpose port serving also as general-purpose I/O port, the individual pins of the port 3 also has some special features. 3.3 Interrupts There are total of five interrupts in ATMEL 89C51 as given below Two for external interrupts INT0 and INT1 Two for timer1 and timer0 One for serial port 3.4 Two 16-bit Timers The ATMEL 89C51 have two 16-bit timers, controlled by TCON register. They can be operated in four different modes named: 13-bit timer mode, 16-bit timer mode, 8-bit auto-reload mode, and split-timer mode. The mode and clocking sources of timer0 and timer1 are set by TMOD register. Other registers

MOVING MESSAGE DISPLAY that are used in timer operation are THx, and TLx. The timer is started by setting the flag TRx and when an overflow occurs the TFx flag is set automatically. 3.5 Serial Interface The ATMEL 89C51 serial port has four modes of operation, named 8-bit shift register mode (fixed baud rate), 8-bit UART mode (variable baud rate), 9-bit UART mode (fixed baud rate), and 9-bit UART mode (variablebaud rate). The timer1 is used for setting the variable baud rate. The different flags used

in serial interfacing are TI and RI. 3.5.1 MAX 232 Serial Interface IC

MAX 232 converts serial data into parallel in receiving mode while it converts parallel data into serial in transmitting mode. Standard serial interfacing for PC, MAX232, requires negative logic, i.e., logic '1' is -5V to -12V and logic '0' is +5V to +12V. To convert TTL logic, say, TxD and RxD pins of the microcontroller chips thus need a converter chip. A MAX232 chip has long been using in many microcontroller boards. It provides 2-channel RS232C port and requires external 10uF capacitors. Carefully check the polarity of capacitor when soldering the board.

Hardware Aspects of Moving Message Display Project

Hardware Aspects of Moving Message Display Project:The moving message display is fabricated using these major components:1. Micro controller AT89s51 2. LCD 3. RS-232 4. Computer the moving message will be display on the LCD which will be controlled through microcontroller and the message will be sent by computer using RS232. The circuit diagram of the moving message display is shown in this post and how the whole process is completed is discussed here. The Microcontroller in this software is programmed such that it controls the LCD through an interface. An eight-bit interface between in the LCD and Microcontroller is programmed to transfer the data to be written on the LCD display screen. A further three out pins of the Microcontroller are used to generate control signals for the LCD. The three control signals are generated in the same pattern as discussed in the timing diagram in the previous chapters. The project, when looked in totality, can be seen as composing of three components, namely LCD, Microcontroller and serial port. The three components have been discussed independently until now and to give a complete picture, it is necessary to link these components. The linking is not only logical but is also translated into hardware connections.

MOVING MESSAGE DISPLAY 4.1 Serial Port to Microcontroller The serial port is connected to the Microcontroller to provide the end user with the functionality of passing a desired string to LCD in run time. An interface between the serial port and the Microcontroller is required for the data transfer. A variable baud rate is generated by the Microcontroller to synchronize the data transfer between the two ends. The connectivity can be analyzed and understood by the hardware diagram at the end of the chapter. 4.2 Microcontroller to LCD The Microcontroller connects with the LCD with an 8bit interface to for data transfer. Three further pins are required to generate enable, read/write and instruction / data signals for the LCD. These three form a small instruction set that allows different tasks and the functionality provided by the HD44 LCD. 4.2.1 Enable Signal Connection The enable signal is used as a signal to the LCD by the Microcontroller about the availability of data. A high-to-low edge triggers the LCD into reading its data lines. The data meant for the LCD must be present and latched on the data lines before the enable signal switches from high to logic low. It needs to be understood that data lines for sending instructions and display data are the same, the instruction bits help differentiate among the two for the LCD. 4.2.2 Read/Write Signal Connection The read/write signal specifies to the LCD whether the Microcontroller is intends to read data from its DDRAM/CGRAM or intends to write data to its DDRAM/CGRAM. In the former case, the data lines contain the data meant for the destination on the LCD memory and in the latter case; the data lines will have the data written onto from the appropriate DDRAM/CGRAM. 4.2.3 Instruction/Data Signal Connection The instruction/data line specifies whether the data bus contains an instruction or data meant for the LCD. This signal, along with the instruction bits, help LCD in deciding which control signals to generate to fulfill the reque

MOVING MESSAGE DISPLAY

st.

4.2.4 Busy Flag After sending of every request, whether instruction or data, to the LCD; the Microcontroller must check for the busy flag of the LCD to return to low logic again. A high logic for the busy flag signals that an internal operation is being carried out and during this time, no external instruction or data is entertained. Only when the busy flag is at a logic low, the Microcontroller should send the next instruction or data. The busy flag is checked by configuring the LCD into read mode (R/W signal is set to logic high) and then reading the data lines. The MSB of the byte read contains the value of the busy flag. To understand the above concepts, the timing diagram mentioned in Chapter 2 for busy flatesting and data transfer may be used

MOVING MESSAGE DISPLAY

Programming Aspects of Moving message display project using 8051


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 g testing and data transfer may be usENT_MOD EQU 06H
;DIFFERENT SETTINGS OF BLINK,DISPLAY AND CURSOR ON/OFF DOF_COF_BOF EQU 08H DOF_COF_BON EQU 09H

MOVING MESSAGE DISPLAY 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 TR1ed. 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,$

MOVING MESSAGE DISPLAY CLR TF0 CLR TR0 DJNZ R7,AGAINRET ;******************************************************************** ;******************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

MOVING MESSAGE DISPLAY 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 R0SJMP 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:

MOVING MESSAGE DISPLAY MOV R0,BUFF_POINTER MOV @R0,A INC R0 MOV BUFF_POINTER,R0 RET END

You might also like