Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Forums > Electronic Projects Design/Ideas/Reviews


Electronic Projects Design/Ideas/Reviews Are you building an electronic project or want to? Maybe you need some assistance? Come and submit your electronic questions here and let our experienced members find a solution.

Reply
 
LinkBack Thread Tools Display Modes
Old 11th June 2007, 05:39 PM   (permalink)
Question lcd interface to PIC16F877

hello everybody,
i need to interface LCD to PIC..

details are as under--
rs--portc0;
en--portc1;
data--portd;

the program tat i ve written (in embedded C using HT-PIC compiler) is as follows--
#include"pic1687x.h"

void cmd(unsigned char);
void datawrt(unsigned char);
void delay(void);
void initlcd(void);

static bit RS @ ((unsigned) & PORTC *8+0);
//static bit RW @ ((unsigned) & PORTC *8+1);
static bit EN @ ((unsigned) & PORTC *8+1);
//static bit SCK @ ((unsigned) & PORTC *8+3);


void initlcd()
{
unsigned char b[]={0x38,0x0c,0x01,0x80};
unsigned int c;

for(c=0;c<;c++)
cmd(b[c]);
}


void cmd(unsigned char y)
{
delay();
PORTD=y;
RS=0;
EN=1;
EN=0;
}


void datawrt(unsigned char x)

{
delay();
PORTD=x;
RS=1;
EN=1;
EN=0;
}

void delay()
{
/*EN=0;
RS=0;
TRISD=0x80;
RW=1;
EN=1;
EN=0;
while(BUSY !=0);
TRISD=0x00;*/
int f=0,g=0;
for(g=0xff;g!=0;g--)
for(f=0xff;f!=0;f--);
}

void main()
{
TRISD=0x00;
TRISC=0x00;
initlcd();
datawrt('1');
}

in the lcd, the first 5X7 blk is being selected & highlightened but no display of char..also, the lcd is working fine fr a pre-pgmed IC..
cd ne 1 plz help me out in dis regard...thanq in advance...
ahseerhsg is offline  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
rs232 serial interface pic16f877 pinky Micro Controllers 10 7th August 2008 02:08 PM
PIC16F877 interface to 2 unipolar stepper motors denis_b Robotics Chat 8 23rd June 2007 07:05 PM
interfacing ADC0808 with 89C51 mnoman Micro Controllers 20 10th April 2007 01:58 PM
PIC16F877 interface with RS232 program winsthon Micro Controllers 1 10th December 2003 09:27 AM
pic16f84 or pic16f877, interface with leds watty Micro Controllers 13 15th August 2003 02:42 AM



All times are GMT. The time now is 10:43 AM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker