Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

4 bit lcd display simulation problem in proteus

Status
Not open for further replies.

BISH

Junior Member level 2
Junior Member level 2
Joined
Nov 3, 2012
Messages
23
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,418
hi all,

as ww already discussed the topic regarding 4 bit lcd..but,now i'm facing a problem with

4 BIT LCD DISPLAY IN PROTEUS...The coding s working well in PIC SIMULATOR.
pls correct me...attachment shows my coding and proteus simulation.

Code:
#include<pic.h>


#define RS RB2
#define EN RB1
#define databits PORTD

void Delay(unsigned int );
/*----------------PIC INITIALIZATION------------*/
void pic_init()
{
    TRISB2 = 0;
    TRISB1 = 0;
    TRISD = 0;
}
 
/*-------------LCD FUNCTIONS BEGIN--------------*/
void LCD_STROBE(void)
{
    EN = 1;
   	Delay(20);
    EN = 0;
}
 
void Lcd4_Write(unsigned char c)
{
    RS = 1;
    Delay(20);
    databits = (c >> 4);
    LCD_STROBE();
    databits = (c);
    LCD_STROBE();
}
 
void Lcd4_Command(unsigned char c)
{
    RS = 0;
    Delay(20);
    databits = (c >> 4);
    LCD_STROBE();
    databits = (c);
    LCD_STROBE();
}
 
void clear(void)
{
    Lcd4_Command(0x01);
    Delay(10);
}
 
void Lcd4_Init()
{
    Delay(10);
    Lcd4_Command(0x38);
    Delay(10);
    Lcd4_Command(0x38);
    Delay(10);
    Lcd4_Command(0x38);
    Lcd4_Command(0x28);            // Function set (4-bit interface, 2 lines, 5*7Pixels)
    Lcd4_Command(0x28);            // Function set (4-bit interface, 2 lines, 5*7Pixels)
    Lcd4_Command(0x0c);            // Make cursorinvisible
    clear();            // Clear screen
    Lcd4_Command(0x6);            // Set entry Mode(auto increment of cursor)
}
 
void Lcd4_Display(const char *q)
{
    while (*q) {
        Lcd4_Write(*q++);
    }
}
 
/*-------------LCD END--------------------*/
 
main()
{
    Delay(10);
    //pic_init();
	TRISD=0x00;
	TRISB=0x00;
    Lcd4_Init();Delay(10);
    TRISC = 0;
    while (1) {
        Lcd4_Command(0x80);
        Lcd4_Write('B');
        Lcd4_Command(0xc0);
        Lcd4_Display("IT IS WORKING:-)");
         
    }
}

void Delay(unsigned int del)
{
	while(del--);
}
 

Attachments

  • eda.pdf
    12.9 KB · Views: 108

Hi, i like to keep it Simple. The same in Basic Language.

- - - Updated - - -

lcd.PNG

The proteus Simulation.

- - - Updated - - -

lcd.PNG (69.2 KB)

EDA LCD.rar (93.2 KB
 

Attachments

  • EDA LCD.rar
    93.2 KB · Views: 95

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top