moving display using 8051 micro controller

download moving display using 8051 micro controller

of 45

description

how to text display using 8051 micro controller

Transcript of moving display using 8051 micro controller

Moving message display

1. INTRODUCTION1.1 EMBEDDED SYSTEM:An embedded system is a special-purpose system in which the computer is completely encapsulated by or dedicated to the device or system it controls. Unlike a general-purpose computer, such as a personal computer, an embedded system performs one or a few predefined tasks, usually with very specific requirements. Since the system is dedicated to specific tasks, design engineers can optimize it, reducing the size and cost of the product. Embedded systems are often mass-produced, benefiting from economies of scale.Personal digital assistants (PDAs) or handheld computers are generally considered embedded devices because of the nature of their hardware design, even though they are more expandable in software terms. This line of definition continues to blur as devices expand. With the introduction of the OQO Model 2 with the Windows XP operating system and ports such as a USB port both features usually belong to "general purpose computers", the line of nomenclature blurs even more.Physically, embedded systems ranges from portable devices such as digital watches and MP3 players, to large stationary installations like traffic lights, factory controllers, or the systems controlling nuclear power plants.In terms of complexity embedded systems can range from very simple with a single microcontroller chip, to very complex with multiple units, peripherals and networks mounted inside a large chassis or enclosure.As the embedded system is the combination of both software and hardware Software deals with the languages like ALP, C, and VB etc., and Hardware deals with Processors, Peripherals, and Memory.

Memory: It is used to store data or address.

Peripherals: These are the external devices connected

Processor: It is an IC which is used to perform some task1.2 Applications of embedded systems Manufacturing and process control Construction industry Transport Buildings and premises Domestic service Communications Office systems and mobile equipment Medical diagnostics, monitoring and life support Testing, monitoring and diagnostic systems1.3 Embedded C:What is an embedded system?An embedded system is an application that contains at least one programmable computer and which is used by individuals who are, in the main, unaware that the system is computer-based.

Which programming language should you use?Having decided to use an 8051 processor as the basis of your embedded system, the next key decision that needs to be made is the choice of programming language. In order to identify a suitable language for embedded systems, we might begin by making the following observations: Computers (such as microcontroller, microprocessor or DSP chips) only accept instructions in machine code (object codes). Machine code is, by definition, in the language of the computer, rather than that of the programmer. Interpretation of the code by the programmer is difficult and error prone. All software, whether in assembly, C, C++, Java or Ada must ultimately be translated into machine code in order to be executed by the computer. Embedded processors like the 8051 have limited processor power and very limited memory available: the language used must be efficient. The language chosen should be in common use.Summary of C language Features:It is mid-level, with high-level features (such as support for functions and modules), and low-level features (such as good access to hardware via pointers). It is very efficient. It is popular and well understood. Even desktop developers who have used only Java or C++ can soon understand C syntax. Good, well-proven compilers are available for every embedded processor (8-bit to 32-bit or more).

2. BLOCK DIAGRAM

AT

89C5

2

16X2 LCD

Power Supply

POWER SUPPLY BLOCK DIAGRAM:Step down TransformerFilterRegulatorOutput Bridge Rectifier

2.1Block Diagram Explanation:POWER SUPPLY: The circuit uses 5v, 500ma power supply. It converts 230 v to 12 v by using step down transformer. Here we use bridge rectifier to convert from ac to dc. It uses a positive 7805 voltage regulator to obtain dc voltage. MICROCONTROLLER SECTION: In this project work the micro-controller is plays major role. Micro-controllers were originally used as components in complicated process-control systems. However, because of their small size and low price, Micro-controllers are now also being used in regulators for individual control loops. In several areas Micro-controllers are now outperforming their analog counterparts and are cheaper as well. LCD: A liquid crystal display (LCD) is a thin, flat display device made up of any number of color or monochrome pixels arrayed in front of a light source or reflector. Each pixel consists of a column of liquid crystal molecules suspended between two transparent electrodes, and two polarizing filters, the axes of polarity of which are perpendicular to each other.

3. HARDWARE REQUIREMENTS

3.1 8051 microcontroller:The 8051 is one of the most popular 8 bitmicro controllersand combines an instruction set that allows tight coding of small particularly I/O intensive application with enough power and a large enough program space that it can be used with C.The Intel 8051 is an 8-bit microcontroller which means that most available operations are limited to 8 bits. There are 3 basic "sizes" of the 8051: Short, Standard, and Extended. The Short and Standard chips are often available in DIP (dual in-line package) form, but the Extended 8051 models often have a different form factor, and are not "drop-in compatible". All these things are called 8051 because they can all be programmed using 8051 assembly language, and they all share certain features (although the different models all have their own special features).Some of the features that have made the 8051 popular are: 4 KB on chip program memory. 128 bytes on chip data memory (RAM). 4 reg. banks. 128 user defined software flags. 8-bit data bus 16-bit address bus 32 general purpose registers each of 8 bits 16 bit timers (usually 2, but may have more, or less). 3 internal and 2 external interrupts. Bit as well as byte addressable RAM area of 16 bytes. Four 8-bit ports, (short models have two 8-bit ports). 16-bit program counter and data pointer. 1 Microsecond instruction cycle with 12 MHz Crystal.

3.1.1:pin configuration & description of microcontroller at89c51The AT89S51 is a low-power, high-performance CMOS 8-bit micro controller with 8Kbytes of in-system programmable Flash memory. The device is manufactured Using Atmels high-density non-volatile memory technology and is compatible with the industry-standard 80C51 micro controller

Fig2: pin configuration & description of microcontrollerat89c51

Description of Microcontrollers AT89S51:The AT89S51 is a low-power, high-performance CMOS 8-bit micro controller with 8Kbytes of in-system programmable Flash memory. The device is manufactured Using Atmels high-density non-volatile memory technology and is compatible with the industry-standard 80C51 micro controller. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional non-volatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable flash one monolithic chip; the Atmel 89C51 is a powerful micro controller, which provides a highly flexible and cost-effective solution to many embedded control applications.The 89C51 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the 89C51 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM contents but freezes the oscillator.PORT 0Port 0 is an 8-bit open drain bi-directional I/O port. As an output port, each pin can sink eight TTL inputs. When 1sare written to port 0 pins, the pins can be used as high impedance inputs. Port 0 can also be configured to be the multiplexed low order address/data bus during accesses to external program and data memory. In this mode, P0 has internal pull-ups. Port 0 also receives the code bytes during Flash programming and outputs the code bytes during program verification. External pull-ups are required during program verification.

PORT 1:Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 Output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the internal pull-ups and can be used as inputs. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input.(P1.0/T2) and the timer/counter 2 trigger input P1.1/T2EX), respectively, as shown in the following table. Port 1 also receives the low-order address bytes during Flash programming and verification.

Table 1: Port 1 functionsPORT 2: Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the internal pull-ups and can be used as inputs. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that uses 16-bit addresses (MOVX @DPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s.

During accesses to external data memory that use 8-bit addresses (MOVX @ RI), Port 2emits the contents of the P2 Special Function Register. Port 2 also receives the high-order address bits and some control signals during Flash programming and verification. In this mode, P0 has internal pull-ups. Port 0 also receives the code bytes during Flash programming and outputs the code bytes during program verification. External pull-ups are required during program verification.PORT 3:Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3 output buffers can sink/source four TTL inputs. When 1s are writen 1s are written to Port 3 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-upsPort 3 also serves the functions of various special features of the 89C51, as shown in the following table. Port 3 also receives some control signals for Flash programming and verification.

Table 2: Port 3 functions

RST:Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. ALE/PROG:Address Latch Enable (ALE) is an output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operation, ALE is emitted at a constant rate of1/6 the oscillator frequency and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access to external data Memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the micro controller is in external execution mode.PSEN:Program Store Enable (PSEN) is the read strobe to external program memory. When the 89C51 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory.EA/VPP: External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. A should be strapped to VCC for internal program executions. This pin also receives the 12-voltProgramming enables voltage (VPP) during Flash programming.

XTAL1:Input to the inverting oscillator amplifier and input to the internal clock operating circuit.XTAL2:Output from the inverting oscillator amplifier.OSCILLATOR CHARACTERISTICS:XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that can be configured for use as an on-chip oscillator, as shown in Figure 1. Either a quartz crystal or ceramic resonator may be used. To drive the device from an External clock source, XTAL2 should be left unconnected while XTAL1 is driven, as shown in Figure 2. SPECIAL FUNCTION REGISTER (SFR) MEMORY: Special Function Registers (SFR s) are areas of memory that control specific functionality of the 8051 processor. For example, four SFRs permit access to the 8051s 32 input/output lines. Another SFR allows the user to set the serial baud rate, control and access timers, and configure the 8051s interrupt system.THE ACCUMULATOR:The Accumulator, as its name suggests is used as a general register to accumulate the results of a large number of instructions. It can hold 8-bit (1-byte) value and is the most versatile register. THE R REGISTERS:The R registers are a set of eight registers that are named R0, R1. Etc up to R7. These registers are used as auxiliary registers in many operations.

THE B REGISTERS: The B register is very similar to the accumulator in the sense that it may hold an 8-bit (1-byte) value. Two only uses the B register 8051 instructions: MUL AB and DIV AB.THE DATA POINTER:The Data pointer (DPTR) is the 8051s only user accessible 16-bit (2Bytes) register. The accumulator, R registers are all 1-Byte values. DPTR, as the name suggests, is used to point to data. It is used by a number of commands, which allow the 8051 to access external memory.THE PROGRAM COUNTER AND STACK POINTER:The program counter (PC) is a 2-byte address, which tells the 8051 where the next instruction to execute is found in memory. The stack pointer like all registers except DPTR and PC may hold an 8-bit (1-Byte) value.ADDRESSING MODES:An addressing mode refers that you are addressing a given memory location. In summary, the addressing modes are as follows, with an example of each:Each of these addressing modes provides important fle Immediate Addressing MOV Direct Addressing MOV A, 30 H Indirect Addressing MOV A, @R0 Indexed Addressing a. External Direct MOVX A, @DPTR b. Code In direct MOVC A, @A+DPTR

TIMER 2 REGISTERS: Control and status bits are contained in registersT2CON and T2MOD for Timer 2. The register pair (RCAP2H , RCAP2L) are the Capture / Reload registers for Timer 2 in 16-bit capture mode or 16-bit auto-reload mode INTERRUPT REGISTERS: The individual interrupt enable bits are in the IE register . Two priorities can be set for each of the six interrupt sources in the IP registers

Table 3: Interrupt registers functions

TIMER 2: Timer 2 is a 16-bit Timer / Counter that can operate as either a timer or an event counter. The type of operation is selected by bit C/T2 in.The SFR T2CON. Timer 2 has three operating Modes : capture , auto-reload ( up or down Counting ) , and baud rate generator . The modes are selected by bits in T2CON. Timer 2 consists of two 8-bit registers, TH2 and TL2. In the Timer function, the TL2 register is incremented every machine cycle. Since a machine cycle consists of 12 oscillator periods, the count rate is 1/12 of the oscillator frequency. In the Counter function , the register is incremented in response to a 1-to-0 transition at its corresponding external input pin , T2 .When the samples show a high in one cycle and a low in the next cycle, the count is incremented . Since two machine cycles (24 Oscillator periods ) are required to recognize 1-to-0 transition , the maximum count rate is 1 / 24 of the oscillator frequency . To ensure that a given level is sampled at least once before it changes , the level should be held for atleast one full machine cycle . The modes are selected by bits in T2CON. Timer 2 consists of two 8-bit registers, TH2 and TL2. In the Timer function, the TL2 register is incremented every machine cycle. Since a machine cycle consists of 12 oscillator periods, the count rate is 1/12 of the oscillator frequency

TCON REGISTER: Table 4: timer/counter controller

3.2 INTERNAL ARCHITECHTURE:

Fig : internal schematic diagram of 8051

6 DATA AND PROGRAM MEMORY:The 8051 Microcontroller can be programmed in PL/M, 8051 Assembly, C and a number of other high-level languages. Many compilers even have support for compiling C++ for an 8051. Program memory in the 8051 is read-only, while the data memory is considered to be read/write accessible. When stored on EEPROM or Flash, the program memory can be rewritten when the microcontroller is in the special programmer circuit.PROGRAM START ADDRESS:The 8051 starts executing program instructions from address 0000 in the program memory. The A register is located in the SFR memory location 0xE0. The A register works in a similar fashion to the AX register of x86 processors. The A register is called the accumulator, and by default it receives the result of all arithmetic operations.SPECIAL FUNCTION REGISTER:The Special Function Register (SFR) is the upper area of addressable memory, from address 0x80 to 0xFF. A, B, PSW, DPTR are called SFR.This area of memory cannot be used for data or program storage, but is instead a series of memory-mapped ports and registers. All port input and output can therefore be performed by memory mov operations on specified addresses in the SFR. Also, different status registers are mapped into the SFR, for use in checking the status of the 8051, and changing some operational parameters of the 8051.

GENERAL PURPOSE REGISTERS:The 8051 has 4 selectable banks of 8 addressable 8-bit registers, R0 to R7. This means that there are essentially 32 available general purpose registers, although only 8 (one bank) can be directly accessed at a time. To access the other banks, we need to change the current bank number in the flag status register.

A AND B REGISTERS:The A register is located in the SFR memory location 0xE0. The A register works in a similar fashion to the AX register of x86 processors. The A register is called the accumulator, and by default it receives the result of all arithmetic operations. The B register is used in a similar manner, except that it can receive the extended answers from the multiply and divide operations. When not being used for multiplication and Division, the B register is available as an extra general-purpose register.

3.3 INSTRUCTION SETSARITHMETIC OPERATIONS: ADD A, Rn Add register to Accumulator ADD A, direct Add direct byte to Accumulator ADD A, @Ri Add indirect RAM to Accumulator ADD A, #data Add immediate data to Accumulator ADDC A, Rn Add register to Accumulator with Carry ADDC A,direct Add direct byte to Accumulator with Carry ADDC A,@Ri Add indirect RAM to Accumulator with Carry ADDC A,#data Add immediate data to Acc. with Carry SUBB A, Rn Subtract Register from Acc with borrow SUBB A, direct Subtract direct byte from Acc with borrow SUBB A, @ Ri Subtract indirect RAM from Acc with borrow SUBB A, #data Subtract immediate data from Acc with borrow INC A Increment Accumulator INC Rn Increment register

INC direct Increment direct byte INC @Ri Increment indirect RAM INC DPTR Increment Data Pointer DEC A Decrement Accumulator DEC Rn Decrement Register DEC direct Decrement direct byte DEC @ Ri Decrement indirect RAM MUL AB Multiply A & B DIV AB Divide A by B DA A Decimal Adjust Accumulator

LOGICAL OPERATIONS: ANL A,Rn AND Register to Accumulator ANL A, direct AND direct byte to Accumulator ANL A,@Ri AND indirect RAM to Accumulator ANL A,#data AND immediate data to Accumulator ANL direct, A AND Accumulator to direct byte ANL direct, #data AND immediate data to direct byte ORL A, Rn OR register to Accumulator ORL A, direct OR direct byte to Accumulator ORL A,@ Ri OR indirect RAM to Accumulator ORL A,#data OR immediate data to Accumulator ORL direct, A OR Accumulator to direct byte ORL direct,#data OR immediate data to direct byte XRL A,Rn Exclusive-OR register to Accumulator

XRL A ,direct Exclusive-OR direct byte to Accumulator XRL A,@ Ri Exclusive-OR indirect RAM to Accumulator XRL A,#data Exclusive-OR immediate data to Accumulator XRL direct , A Exclusive-OR Accumulator to direct byte XRL direct , #data Exclusive-OR immediate data to direct byte CLR A Clear Accumulator CPL A Complement Accumulator RL A Rotate Accumulator Left RLC A Rotate Accumulator Left through the Carry RR A Rotate Accumulator Right RRC A Rotate Accumulator Right through the Carry SWAP A Swap nibbles within the Accumulator

DATA TRANSFER: MOV A, Rn Move register to Accumulator MOV A, direct Move direct byte to Accumulator MOV A, @ Ri Move indirect RAM to Accumulator MOV A,#data Move immediate data to Accumulator MOV Rn,direct Move direct byte to register MOV Rn,#data Move immediate data to register MOV direct , A Move Accumulator to direct byte MOV direct ,Rn Move register to direct byte MOV direct,@Ri Move indirect RAM to direct byte MOV direct,#data Move immediate data to direct byte MOV @Ri,A Move Accumulator to indirect RAM

MOV @Ri,direct Move direct byte to indirect RAM MOV @Ri,#data Move immediate data to indirect RAM MOV direct,direct Move direct byte to direct RAM MOV DPTR,#data16 Load Data Pointer with a 16-bit constant MOVC A,@A+DPTR Move Code byte relative to DPTR to Acc MOVC A,@A+PC Move Code byte relative to PC to Acc MOVX A, @Ri Move External RAM (8-bit addr) toAcc MOVX A,@DPTR Move Exernal RAM (16-bit addr) to Acc MOVX @Ri,A Move Acc to External RAM (8-bit addr) MOVX @DPTR,A Move Acc to External RAM (16-bit addr) PUSH direct Push direct byte onto stack POPdirect Pop direct byte from stack XCH A,Rn Exchange register with Accumulator XCH A,direct Exchange direct byte with Accumulator XCH A,@Ri Exchange indirect RAM with Accumulator XCHD A,@Ri Exchange low-order Digit indirect RAM with Acc

BOOLEAN VARIABLE MANIPULATION : CLRCClear Carry(CY=0) CLRbitClear direct bit SETBCSet Carry Flag(CY=1) SETBbitSet direct bit CPLCComplement Carry CPLbitComplement direct bit ANLC,bitAND direct bit to CARRY

ORLC, bitOR direct bit to Carry JBbit , rel Jump if direct Bit is set JNBbit , rel Jump if direct Bit is Not set JBCbit , rel Jump if direct Bit is set & clear bit ACALL addr 11 Absolute Subroutine Call LCALL addr16 Long Subroutine Call RET Return from Subroutine RETI Return from interrupt AJMP addr11 Absolute Jump LJMP addr16 Long Jump SJMP rel Short Jump JMP@A+DPTR Jump indirect relative to the DPTR JZrel Jump if Accumulator is Zero JNZrel Jump if Accumulator is Not Zero CJNE A,direct,rel Compare direct byte to Acc and Jump if Not Equal CJNE A,#data, rel Compare immediate data to Acc and Jump if Not Equal CJNE Rn,#data,rel Compare immediate to register and Jump if Not Equal CJNE @Ri,#data,rel Compare immediate to indirect and Jump if Not Equal DJNZ Rn,rel Decrement register and Jump if Not Zero DJNZ direct,rel Decrement direct byte and Jump if Not Zero NOP No Operation

3.4 LIQUID CRYSTAL DISPLAYS (LCD S)Liquid crystal displays (LCD s) have materials which combine the properties of both liquids and crystals. Rather than having a melting point, they have a temperature range within which the molecules are almost as mobile as they would be in a liquid, but are grouped together in an ordered form similar to a crystal.An LCD consists of two glass panels, with the liquid crystal material sand witched in between them. The inner surface of the glass plates are coated with transparent electrodes which define the character, symbols or patterns to be displayed polymeric layers are present in between the electrodes and the liquid crystal, which makes the liquid crystal molecules to maintain a defined orientation angle.One each polarisers are pasted outside the two glass panels. These polarisers would rotate the light rays passing through them to a definite angle, in a particular directionWhen the LCD is in the off state, light rays are rotated by the two polarisers and the liquid crystal, such that the light rays come out of the LCD without any orientation, and hence the LCD appears transparent.When sufficient voltage is applied to the electrodes, the liquid crystal molecules would be aligned in a specific direction. The light rays passing through the LCD would be rotated by the polarisers, which would result in activating / highlighting the desired characters.The LCDs are lightweight with only a few millimeters thickness. Since the LCDs consume less power, they are compatible with low power electronic circuits, and can be powered for long durations.The LCD s wont generate light and so light is needed to read the display. By using backlighting, reading is possible in the dark. The LCDs have long life and a wide operating temperature range.

The LCD s used exclusively in watches, calculators and measuring instruments is the simple seven-segment displays, having a limited amount of numeric data. The recent advances in technology have resulted in better legibility, more information displaying capability and a wider temperature range. These have resulted in the LCD s being extensively used in telecommunications and entertainment electronics. The LCD s has even started replacing the cathode ray tubes (CRTs) used for the display of text and graphics, and also in small TV applications.3.4.1 LCD operationIn recent years the LCD is finding widespread use replacing LED s (seven-segment LED or other multi segment LED s). This is due to the following reasons:1. The declining prices of LCD s.2. The ability to display numbers, characters and graphics. This is in contract to LED s, which are limited to numbers and a few characters.3. Incorporation of a refreshing controller into the LCD, there by relieving the CPU of the task of refreshing the LCD. In the contrast, the LED must be refreshed by the CPU to keep displaying the data.4. Ease of programming for characters and graphics.

3.4.2 LCD pin description The LCD discussed in this section has 14 pins. The function of each pin is given in table.TABLE 1: Pin description for LCD:

PinsymbolI/ODescription

1Vss--Ground

2Vcc--+5V power supply

3VEE--Power supply to control contrast

4RSIRS=0 to select command registerRS=1 to select data register

5R/WIR/W=0 for writeR/W=1 for read

6EI/OEnable

7DB0I/OThe 8-bit data bus

8DB1I/OThe 8-bit data bus

9DB2I/OThe 8-bit data bus

10DB3I/OThe 8-bit data bus

TABLE 2: LCD Command Codes Code(hex)

Command to LCD Instruction Register

1 Clear display screen

2Return home

4Decrement cursor

6Increment cursor

5Shift display right

7Shift display left

8Display off, cursor off

ADisplay off, cursor on

CDisplay on, cursor off

EDisplay on, cursor on

FDisplay on, cursor blinking

10Shift cursor position to left

14Shift cursor position to right

18Shift the entire display to the left

1CShift the entire display to the right

80Force cursor to beginning of 1st line

C0Force cursor to beginning of 2nd line

382 lines and 5x7 matrix

Table 2: LCD command codes

3.4.3 LCD INTERFACINGSending commands and data to LCDs with a time delay:To send any command from table 2 to the LCD, make pin RS=0. For data, make RS=1.Then place a high to low pulse on the E pin to enable the internal latch of the LCD.

ADVANTAGES: Very compact and light. Low power consumption. Depending on the set display brightness and content being displayed, the older CCFT backlit models typically use 3050% of the power a CRT monitor of the same size viewing area would use, and the modern LED backlit models typically use 1025% of the power a CRT monitor would use. Very little heat emitted during operation, due to low power consumption. No geometric distortion. The possible ability to have little or no flicker depending on backlight technology.Usually no refresh-rate flicker, because the LCD pixels hold their state between refreshes (which are usually done at 200 Hz or faster, regardless of the input refresh rate). Is very thin compared to a CRT monitor, which allows the monitor to be placed farther back from the user, reducing close-focusing related eye-strain.

FIGURE 7:LCD DISPLAY SCREEN WITH PINS

CHAPTER 4: SOFTWARE DESCRIPTION:4.KEIL VISION3 Software:This project is implemented using following softwares: KEIL Compiler-for compilation part Proload-for simulation part

4.1 KEIL Compiler:Keil compiler is software used where the machine language code is written and compiled. After compilation, the machine source code is converted into hex code which is to be dumped into the microcontroller for further processing. Keil compiler also supports C language code.Its important that you know C language for microcontroller which is commonly known as Embedded C. As we are going to use Keil C51 Compiler, hence we also call it Keil C. Keil C is not much different from a normal C program. If you know assembly, writing a C program is not a crisis. In keil, we will have a main function, in which all your application specific work will be defined. In case of embedded C, you do not have any operating system running in there. So you have to make sure that your program or main file should never exit. This can be done with the help of simple while (1) or for (;;) loop as they are going to run infinitely.We have to add header file for controller you are using, otherwise you will not be able to access registers related to peripherals. #include //header file for 89C51

4.1.1 Proload Proload is software which accepts only hex files. Once the machine code is converted into hex code, that hex code has to be dumped into the microcontroller and this is done by the Proload. Proload is a programmer which itself contains a microcontroller in it other than the one which is to be programmed.This microcontroller has a program in it written in such a way that it accepts the hex file from the Kiel compiler and dumps this hex file into the microcontroller which is to be programmed. As the proload programmer kit requires power supply to be operated, this power supply is given from the power supply circuit designed above. It should be noted that this programmer kit contains a power supply section in the board itself but in order to switch on that power supply, a source is required. Thus this is accomplished from the power supply board with an output of 12volts or from an adapter connected to 230V AC.Keil C is not much different from a normal C program. If you know assembly, writing a C program is not a crisis. In keil, we will have a main function, in which all your application specific work will be defined. In case of embedded C, you do not have any operating system running in there. So you have to make sure that your program or main file should never exit. This can be done with the help of simple while (1) or for (;;) loop as they are going to run infinitely.Its important that you know C language for microcontroller which is commonly known as Embedded C. As we are going to use Keil C51 Compiler, hence we also call it Keil C.

4.2 Procedural steps for compilation, simulation and dumping: 4.2.1 Compilation and simulation steps:To create a project, write and test the previous example source code, follow the following steps: 1. Open Keil and start a new project.

Fig 4.1: Step-12. You will be prompted to choose a name for your new project, Create a separate folder where all the files of your project will be stored, choose a name and click save.

3. The following window will appear where you will be asked to select a device for Target 3.From the list at the left, seek for the brand name ATMEL, then under ATMEL, select AT89S52. You will notice that a brief description of the device appears on the right. Leave the two upper check boxes unchecked and click OK. The AT89S52 will be called your 'Target device', which is the final destination of your source code. You will be asked whether to 'copy standard 8051 startup code' click No.

Fig 4.2: Step-2, 3

4. Click File, New, and something similar to the following window should appear. The box named 'Text1' is where your code should be written later.

Fig 4.3: Step-45. Now you have to click 'File, Save as' and choose a file name for your source code ending with the letter '.c'. You can name as 'code.c' for example and click save. Then you have to add this file to your project work space at the left as shown in the following.6.After right-clicking on 'source group 1', click on 'Add files to group...', then you will be prompted to browse the file to add to 'source group 1', choose the file that you just saved, eventually 'code.c' and add it to the source group.

You will notice that the file is added to the project tree at the left.

Fig 4.4: Step-5, 67. In some versions of this software you have to turn ON manually the option to generate HEX files. make sure it is turned ON, by right-clicking on target 1, Options for target 'target 1', then under the 'output' tab, by checking the box 'generate HEX file'. This step is very important as the HEX file is the compiled output of your project that is going to be transferred to the microcontroller.

8. You can then start to write the source code in the window titled 'code.c' then before testing your source code; you have to compile your source code, and correct eventual syntax errors. In KEIL IDE, this step is called 'rebuild all targets' and has this icon.

Fig 4.5: Step-8

9. If after rebuilding the targets, the 'output window' shows that there is 0 errors, then you are ready to test the performance of your code. In keil, like in most development environment, this step is called Debugging, and has this icon. After clicking on the debug icon, you will notice that some part of the user interface will change; some new icons will appear, like the run icon circled in the following figure:

Fig 4.6: Step-910. Select the ports and click on the RUN Option. It will end up the compilation and simulation processes.

4.3 Dumping steps: After designing the project using Keil Compiler, to observe the output, the program should be dumped in microcontroller of your project using a dumper and the procedure for dumping is as follows:1. Install the Proload Software in the PC.2. Now connect the Programmer kit to the PC (CPU) through serial cable.3. Power up the programmer kit from the ac supply through adapter.4. Now place the microcontroller in the GIF socket provided in the Programmer kit. 5. Click on the proload icon in the PC. A window appears providing the information like Hardware model, com port, device type, Flash size etc. Click on browse option to select the hex file to be dumped into the microcontroller and then click on Auto program to program the microcontroller with that particular hex file. 6. The status of the microcontroller can be seen in the small status window in the bottom of the page. 7. After this process is completed, remove the microcontroller from the programmer kit and place it in your system board. Now the system board behaves according to the program written in the microcontroller.

5. IMPLEMENTATAION AND RESULTS5.1 FLOW CHARTSTART

DISPLAY ON, CURSOR ONC

1.CLEAR ACCUMULATORINITIALISE DPTR,#0400H

2. MOVC A,@A+DPTR

3. INC DPTR

MOV A, #0C0H CJNE R6, #2EH

AGAIN INITIALISE . DPTR, #0500H,

REPEAT 1, 2,3

DISPLAY CJNE R7,#2EH

5.1.1 SOURCE CODE#include#define lcd P2sbit rs=P3^5; //Register select (RS)sbit rw=P3^6; //Read write (RW) pinsbit en=P3^7; //Enable (EN) pinunsigned char commands[]={0x38,0x0E,0x01,0x06,'\0'};char name[]={"HELLO"}; //String to be displayed on lcdvoid delay(unsigned int time) //Time delay function{unsigned int i,j;for(i=0;i