Showing posts with label Initializing by Internal Reset Circuit. Show all posts
Showing posts with label Initializing by Internal Reset Circuit. Show all posts

Sunday, December 4, 2011

Schematic Assembly Language program for LCD code

In this post some routine in Assembly language are written to interface lcd with microcontroller 8051.Most projects you create with the 8051 CPU or any other microcontroller  require some form of display. The display may be LED or LCD. But now use of LCD is increasing/ The most common way to accomplish this is with the LCD (Liquid Crystal Display). LCDs have become a cheap and easy way to get text display for an embedded system Common displays are set up as 16 to 20 characters by 1 to 4 lines. variate of LCD are available and most of them can work on thees ways describes in the sub routines.

Data to be Displayed on LCD using micro controller requires following set of instructions in the form of code as follows.
 lcd_datadisplay: // this is a part of main program call sub routine, the function of this sub routine is to display //data on lcd.
SETB RS //Telling the LCD that the data which is being send is to be displayed
MOV P1,A //Character to be displayed is in Acc
SETB EN // the enable pin of lcd is set to logic one
CLR EN //High to Low pulse on EN to latch the data
CALL DELAY //Delay so that LCD finishes its internal operations
 ret // return from this routine is called
Command or Special Instruction.
 lcd_command: // in this sub-routine of lcd program, how different commands are sent to lcd is shown
CLR RS //Telling the LCD that the data which is being send is a command
MOV P1,A //Character to be displayed is in Acc
SETB EN
CLR EN //High to Low pulse on EN to latch the data
CALL DELAY //Delay so that LCD finishes its internal operations
ret // returning to the main code from where this sub-routine was called
Busy flag checking
ready:  // In this sub-routine the busy flag is checked
setb P1.7 ;D7 as input
clr P3.6 ;RS=0 cmd
setb P3.5 ;RW=1 for read
again:
setb P3.7 ;H->L pulse on E
clr P3.7
jb P1.7, again
ret // returning back to main program where this function is called
Data write Routine
data: // in this sub-routine how data will be written on lcd is shown
mov P1, A ;//move acc. data to port
setb P3.6 ;RS=1 data
clr P3.5 ;RW=0 for write
setb P3.7 ;H->L pulse on E
clr P3.7
lcall ready
ret // end of this sub-routine
Command write Routine
command: // this is another sub-routine showing how to write commands on lcd, you can use any of these //cammand subroutine
mov P1, A ;move acc. data to port
clr P3.6 ;RS=0 for cmd
clr P3.5 ;RW=0 for write
setb P3.7 ;H->L pulse on E
clr P3.7
lcall ready
ret
Initialization of LCD
initialization: // in this sub-routine initialization of LCD is described

mov A, #38H ; Initialize, 2-lines, 5X7 matrix.
lcall Command
mov A, #0EH ; LCD on, cursor on
lcall Command
mov A, #01H ; Clear LCD Screen
lcall Command
mov A, #06H ; Shift cursor right
lcall Command
Display clear
clear: // this is sub-routine to clear the display of LCD
setb p3.7 ;enable EN
clr 3.6 ;RS=0 for cmd.
mov DATA,#01h
clr p3.7 ;disable EN
lcall ready
RET

Note- As we need to clear the LCD frequently and not the whole initialisation , it is better to use this routine separately.

Displaying "HI Friends"

lcall initialization
lcall clear
mov A,#'H'
acall data
mov A,#'I'
lcall data
mov A,#'F'
lcall data
mov A,#'r'
lcall data
lcall data
mov A,#'i'
lcall data
mov A,#'e'
lcall data
mov A,#'n'
lcall data
mov A,#'d'
lcall data
mov A,#'s'
ret
Now following is complete ASSEMBLY LANGUAGE code to show something on LCD
lcall Initialization
lcall clear
mov a,#'H'
lcall data
mov a,#'I'
lcall data
mov a,#8ah
lcall command
mov a,#'8'
lcall data
mov a,#'0'
lcall data
mov a,#'5'
lcall data
mov a,#'1'
lcall data
mov a,#'M'
lcall data
mov a,#'C'
lcall data
end

BACK to Content Page

. Next Page

.   Previous Page
flash programmer for at89c51,up counter based project,up counter chip manufacture with assembly language using 89c51 microcontroller,correlation flow METER 8051,program of 7 segment in 8515,4 CHANNEL RTC,RFID door access software flow diagram,Microcontroller into a Walt Meter assembly download,Microcontroller into a Watt Meter assembly download,AT89S52 PC PROJECTS,MICROCONTROLLER AT89C2051 BASED COUNT DOWN TIMER
read more "Schematic Assembly Language program for LCD code"

Friday, December 2, 2011

Schematic Address Counter (AC) of LCD

3.1.3 Address Counter (AC)
address counter ( ′adres ′kau̇ntər ) ( computer science ) A counter which increments an initial memory address as a block of data is being transferred.

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.
3.1.4 Initializing by Internal Reset Circuit

We have used an LCD (liquid crystal display). They are all around us -- in laptop computers, digital clocks and watches, microwave ovens, CD players and many other electronic devices. LCDs are common because they offer some real advantages over other display technologies. They are thinner and lighter and draw much less power than cathode ray tubes (CRTs), An internal reset circuit automatically initializes theHD44780 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.
3.1.5 Pin Assighnment

The pin assignment shown in Table . is the industry standard for character LCD-modules with a maximum of 80 characters.
Pin number Symbol Level I/O Function


1 Vss - - Power supply (GND)

2 Vcc - - Power supply (+5V)

3 Vee - - Contrast adjust

4 RS 0/1 I 0 = Instruction input

1 = Data input

5 R/W 0/1 I 0 = Write to LCD module

1 = Read from LCD module

6 E 1, 1->0 I Enable signal

7 DB0 0/1 I/O Data bus line 0 (LSB)

8 DB1 0/1 I/O Data bus line 1

9 DB2 0/1 I/O Data bus line 2

10 DB3 0/1 I/O Data bus line 3

11 DB4 0/1 I/O Data bus line 4

12 DB5 0/1 I/O Data bus line 5

13 DB6 0/1 I/O Data bus line 6

14 DB7 0/1 I/O Data bus line 7 (MSB)

Clear display 0 0 0 0 0 0 0 0 0 1 Clears display and returns cursor to the home position (address 0). 1.64mS


Cursor home 0 0 0 0 0 0 0 0 1 * Returns cursor to home position (address 0). Also returns display being shifted to the original position. DDRAM contents remains unchanged. 1.64mS

Write to CGRAM or DDRAM 1 0 write data Writes data to CGRAM or DDRAM. 40uS

Read from CGRAM or DDRAM 1 1 read data Reads data from CGRAM or DDRAM. 40uS




 BACK to Content Page

 . Next Page

 .   Previous Page
tags:- ′adres ′kau̇ntər ,Sample Address Counter ,Program counter ,The program counter, or PC (also called the instruction pointer to a seminal Intel instruction set, such as the 8080 or 4004, or instruction address ,HEX address counter,8051-Assembler,Addresses and Counter-Motions ,Address Counter (AC),“Set DD RAM Address”,Advanced Microprocessors And Peripherals ,auto address increment counter,DDRAM Display data RAM CGRAM Character generator RAM ACC CG RAM address ADD DD RAM address, corresponds to cursor address AC Address counter Program counter address
read more "Schematic Address Counter (AC) of LCD"