Microcontroller › 8051 › AT89C51 DS1307 ]- LCD only shows bars (updated : schematic and Photo.
- This topic has 12 replies, 7 voices, and was last updated 11 years, 5 months ago by Anonymous.
-
AuthorPosts
-
April 19, 2013 at 6:12 pm #4806Rohan ThackerParticipant
Hey this is my first post on EG, hope to be apart of the community for a long time, moving forward. Im trying to build a simple circut using an AT89C51 with a DS1307 interfaced with a 16×2 LCD. I know there are numerous projects other and thats the reason why im repeating it, to learn. The problem is now when i flash my code to the uC and connect it into the circut the lcd just displays bars. I’ve tried with alot of different programs avaliable online. Due to my lack of experience i have no clue how to debug this issue. I’ve also tried a smiple program to check the LCD and thats not working to a simple Hello World program fails to display. I’ve attached a schematic of my breadboard circuit and a picture of the whole issue.
April 20, 2013 at 4:47 pm #9545AJISH ALFREDParticipantHi Rohan,
Introduce a 1K resistor in series with the 15th or 16th pin.
Most importantly make sure that your code is running on the microcontroller by trying to blink an led along with the current code.
April 21, 2013 at 6:30 pm #9547Rohan ThackerParticipantI’ve got an led blinking off pin 1. I also tried this with a different LCD screen (same 16×2) and the only difference was that the older one showed 4 bars instead of 6. I also put in a different 89c51uC, still no different.
I’ve checked the schematic with the various circuts form a google search and the wiring seem to be correct, can you guys verify that? I’m not really if my reset (pin9) is connected correct.
This is the code i use
<code>
#include<reg51.h>//Function declarationsvoid cct_init(void);void delay(int);void lcdinit(void);void writecmd(int);void writedata(char);void ReturnHome(void);//*******************//Pin description/*P2.4 to P2.7 is data busP1.0 is RSP1.1 is E*///********************// Defines Pinssbit RS = P1^0;sbit E = P1^1;// ***********************************************************// Main program//void main(void){cct_init(); //Make all ports zerolcdinit(); //Initilize LCDwritedata(‘T’); //writewritedata(‘H’); //writewritedata(‘A’); //writewritedata(‘C’); //writewritedata(‘K’); //writewritedata(‘ ‘); //writewritedata(‘E’); //writewritedata(‘l’); //writewritedata(‘e’); //writewritedata(‘c’); //writewritedata(‘t’); //writewritedata(‘r’); //writeReturnHome(); //Return to 0 positionwhile(1){}}void cct_init(void){P0 = 0x00; //not usedP1 = 0x00; //not usedP2 = 0x00; //used as data portP3 = 0x00; //used for generating E and RS}void delay(int a){int i;for(i=0;i<a;i++); //null statement}void writedata(char t){RS = 1; // This is dataP2 &= 0x0F; // Make P2.4 to P2.7 zeroP2 |= (t&0xF0); // Write Upper nibble of dataE = 1; // => E = 1delay(150);E = 0; // => E = 0delay(150);P2 &= 0x0F; // Make P2.4 to P2.7 zeroP2 |= ((t<<4)&0xF0);// Write Lower nibble of dataE = 1; // => E = 1delay(150);E = 0; // => E = 0delay(150);}void writecmd(int z){RS = 0; // This is commandP2 &= 0x0F; // Make P2.4 to P2.7 zeroP2 |= (z&0xF0); // Write Upper nibble of dataE = 1; // => E = 1delay(150);E = 0; // => E = 0delay(150);P2 &= 0x0F; // Make P2.4 to P2.7 zeroP2 |= ((z<<4)&0xF0);// Write Lower nibble of dataE = 1; // => E = 1delay(150);E = 0; // => E = 0delay(150);}void lcdinit(void){///////////// Reset process from datasheet /////////delay(15000);P2 &= 0x0F; // Make P2.4 to P2.7 zeroP2 |= (0x30&0xF0); // Write 0x3E = 1; // => E = 1delay(150);E = 0; // => E = 0delay(150);delay(4500);P2 &= 0x0F; // Make P2.4 to P2.7 zeroP2 |= (0x30&0xF0); // Write 0x3E = 1; // => E = 1delay(150);E = 0; // => E = 0delay(150);delay(300);P2 &= 0x0F; // Make P2.4 to P2.7 zeroP2 |= (0x30&0xF0); // Write 0x3E = 1; // => E = 1delay(150);E = 0; // => E = 0delay(150);delay(650);P2 &= 0x0F; // Make P2.4 to P2.7 zeroP2 |= (0x20&0xF0); // Write 0x2E = 1; // => E = 1delay(150);E = 0; // => E = 0delay(150);delay(650);/////////////////////////////////////////////////////writecmd(0x28); //function setwritecmd(0x0c); //display on,cursor off,blink offwritecmd(0x01); //clear displaywritecmd(0x06); //entry mode, set increment}void ReturnHome(void) //Return to 0 location{writecmd(0x02);delay(1500);}</code>Looks incomplete. is it?April 22, 2013 at 9:30 am #9560AJISH ALFREDParticipantHi,
Keep the connection to the reset pin same for all your projects as you have connected for the led blinking.
April 22, 2013 at 9:32 am #9561AJISH ALFREDParticipantWhy do you think the code is incomplete??
April 22, 2013 at 11:08 am #9566Rohan ThackerParticipantYes the reset pin is the same on all my projects. I’ve also tired the EG code for displaying A on the LCD and that isnt working too. The 16×2 displays boxes on the first line and nothing on the second. Then I tried replacing the cap on the circut, the crystal and the power wires along with programming the uC again but that didnt work either. So then i checked if all the pins on the LCD were receiving electricty so with the help of an Led i check each pin, all good. So now i have no clue what the problem is, I’ve connected it in 8 bit and 4 bit and tried all sorts of code.
April 23, 2013 at 6:20 am #9573alekhyaParticipantsir i kept my query separately but u didnt answ to my query till now…………
April 25, 2013 at 2:59 pm #9584vishwasParticipanthey i am also trying to interface 8051 microcontroller with a 16×2 LCD display but i dont know how to flash a C code into microcontroller.Please help me.
June 25, 2013 at 10:06 am #10024umairParticipantHello Rohan i can not understand your problem completely but i think u want to make project with 8051 and LCD so dont worry i shall try my best to help u.i hv uploaded my project videos and C codes on 4 shared .com u can make free account and then u can download free still if u need my help u can send me mail on [email protected] My project and video link is http://www.4shared.com/rar/F3bhcolV/at89s52_programmer_and_test_bo.html u can find other projects too.
t care bye
June 25, 2013 at 10:33 am #10025umairParticipanthello rohan i hv given my comments but i dont know why that are coming here may be it takes time to come here.any way i can help u for ur 8051 and LCD project u can open this link here i hv uploaded my projects videos and code u can dounload free from here also u can send me mail [email protected]. its 4shared.com u make free account here then dounload my projects.
its link for my 8051 test board project on this board i hv LCD,ADC,ISP Programmer,LEDs and more detail th will help u.
http://www.4shared.com/rar/F3bhcolV/at89s52_programmer_and_test_bo.html .
t cre bye
June 25, 2013 at 10:37 am #10026umairParticipanthello rohan i hv given my comments but i dont know why that are coming here may be it takes time to come here.any way i can help u for ur 8051 and LCD project u can open this link here i hv uploaded my projects videos and code u can dounload free from here also u can send me mail umair_saeed65 on yahoo.com. its 4shared.com u make free account here then dounload my projects.
its link for my 8051 test board project on this board i hv LCD,ADC,ISP Programmer,LEDs and more detail th will help u.
send me mail then i shall send u link as if i paste link here then file is not updating .
t cre bye
June 25, 2013 at 11:30 am #10027Ajay MaityParticipantHello Rohan Thacker,
This post is two months old. Have you rectified your problem? Are you able to get characters on LCD screen? What value of resistor (R4) have you connected at pin no. 3? I recommend instead of resistor, use a potentiometer. After switching on the system and burning the code, try varying the potentiometer shaft until the characters are clearly displayed on the screen. This potentiometer act as a control for LCD contrast. It gives flexibility to the user to vary the brightness from displaying nothing to displaying block patterns (which is exactly what is getting displayed on your screen).
Try this method, and reply if it works, and also if it doesn’t. I’ll think of something else.
Regards,
Ajay Maity.
June 26, 2013 at 1:32 pm #10041AnonymousGuesthello rohan my friend i hv uploded my project videos link on utube write AT89S52 TEST BOARD on utube then u can see the complete circuit from utube page u can go on 4shared site link downlod my test board project files that are in winrar parts downlod all see complete circuit board video also i hv given C codes.
there u can also find my other projects.
best of luck
t care
bye
-
AuthorPosts
- You must be logged in to reply to this topic.