|
|
View previous topic :: View next topic |
Author |
Message |
elphi
Joined: 17 Apr 2007 Posts: 20 Location: tijuana,bajacalifornia,mexico
|
Trouble with Flex_LCD420.c |
Posted: Mon Jun 18, 2007 5:58 pm |
|
|
HI, im working with this driver, but i have some problems, check my code please:
Code: |
#include "16f84.h"
#include"stdlib.h"
#define RETURN_HOME 0x2
#fuses XT,NOWDT,NOPROTECT,
#use delay(clock=4000000)
#include <Flex_LCD420>
#use standard_io(b)
void main()
{
int1 i=0;
setup_counters (RTCC_INTERNAL,RTCC_DIV_2);
output_high(PIN_A1);
delay_ms(500);
output_low( PIN_A1);
lcd_init();
printf(lcd_putc, "\f");
delay_ms(500);
output_high(PIN_A0);
/*************************** this is spanish
lcd_putc("Esta es solo una\n");
lcd_putc("prueba de lo que \n");
lcd_putc("se puede hacer con\n");
lcd_putc("un lcd y un pic \n");
********************************/
lcd_putc("This is only a \n");
lcd_putc("sample of what can\n");
lcd_putc("I do with a PIC \n");
lcd_putc("and an LCD display\n");
while(true)
{}
}
|
as easy as that.
it must work but actually it doesn't. i know that this is not a proteus forum, but i have to say that it works in proteus, but is my protoboard it doesn’t.
i made these modifications in flexlcd:
Code: |
#define LCD_RS PIN_B1
#define LCD_RW PIN_B2
#define LCD_E PIN_B3
#define LCD_DB4 PIN_B4
#define LCD_DB5 PIN_B5
#define LCD_DB6 PIN_B6
#define LCD_DB7 PIN_B7
|
and these are my connections.
Code: |
┌───────────┐
| P RB1┼──── RS
| I RB2┼──── RW
| C RB3┼──── E
| 1 RB4┼──── D4
| 6 RB5┼──── D5
| F RB6┼──── D6
| 8 RB7┼──── D7
| 4 |
└───────────┘
|
My LCD only shows blocks, the lcd details are in
i have connected Vcc Vss, an Vee in a trimpot with 0.4 V , and D0-D3 to the "air", the details are in :
http://www.varitronix.com/Product/character/VL-FS-MDLS20464D-41.pdf
It say that has a Samsung KS0066 driver but I don’t know waths up.
I have read almost all the messages with similar details, and I have done some modifications (most in delays)
I hope that anybody can help me. _________________ Every little thing gonna be alright |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jun 18, 2007 6:38 pm |
|
|
If you see black squares, then the LCD is probably not being initialized
properly.
Possible reasons:
1. The connections are not correct. You may two wires swapped, or
maybe all your connections are shifted by one pin. Check it carefully.
2. The list of connections at the start of the Flex driver doesn't match
the connections between the PIC and the LCD.
3. The initial delay after power-up, in the lcd_init() routine, may be
too short for your LCD. It's currently set at 35 ms. Just for a
test, set it to a much larger value such as 100 ms. |
|
|
elphi
Joined: 17 Apr 2007 Posts: 20 Location: tijuana,bajacalifornia,mexico
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jun 19, 2007 12:02 pm |
|
|
Your schematic has different wiring, compared to the board photos.
In the schematic, the R/W pin on the LCD is connected to ground.
But on your actual board, it's connected to a PIC pin. But that
shouldn't matter, because you have the driver configured to use
the R/W pin. It should work.
Things to try:
1. Do you know for certain that the PIC is running ?
Try a simple program that blinks an LED. Connect an LED with a
series resistor (330 to 470 ohms) to pin B0. Then try the program
shown in this post. The LED should be connected with the cathode
to ground. Then a high level on the pin will turn it on.
http://www.ccsinfo.com/forum/viewtopic.php?t=28377&start=1
2. Try running the Flex driver with the R/W pin disabled.
Make these changes:
A. Disconnect the LCD's R/W pin from the PIC. Connect it to Ground.
This means that pin 5 on the LCD should go to Ground.
B. Edit the Flex driver file and comment out this line:
Code: | #define USE_RW_PIN 1 |
Then re-compile, re-program the PIC, and test it.
Because you have made changes through-out the driver, you might
want to put the driver back the way it originally was before you do
this test. (Except leave your Pin definitions the same). |
|
|
elphi
Joined: 17 Apr 2007 Posts: 20 Location: tijuana,bajacalifornia,mexico
|
|
Posted: Tue Jun 19, 2007 12:46 pm |
|
|
Quote: | Your schematic has different wiring, compared to the board photos.
In the schematic, the R/W pin on the LCD is connected to ground.
But on your actual board, it's connected to a PIC pin. But that
shouldn't matter, because you have the driver configured to use
the R/W pin. It should work. |
Yes you're right this was one of the million of changes I've done, but as you said it doesn't matter.
Quote: | Things to try:
1. Do you know for certain that the PIC is running ?
Try a simple program that blinks an LED. Connect an LED with a
series resistor (330 to 470 ohms) to pin B0. Then try the program
shown in this post. The LED should be connected with the cathode
to ground. Then a high level on the pin will turn it on.
http://www.ccsinfo.com/forum/viewtopic.php?t=28377&start=1 |
I made some test to the pic, an it seems to work, but anyway I will use other one.
Quote: | 2. Try running the Flex driver with the R/W pin disabled.
Make these changes:
A. Disconnect the LCD's R/W pin from the PIC. Connect it to Ground.
This means that pin 5 on the LCD should go to Ground.
B. Edit the Flex driver file and comment out this line:
Code: | #define USE_RW_PIN 1 |
|
I did it, but didn't work.
Quote: | Then re-compile, re-program the PIC, and test it.
Because you have made changes through-out the driver, you might
want to put the driver back the way it originally was before you do
this test. (Except leave your Pin definitions the same). |
Actually, anytime I modified the flexlcd drive I renamed it, and changed my declaration, in order to don't lose the original information.
I will try to do everything again and i will let you know how it goes.
One last question, what must i do with the pins D0-D4 of the lcd. to ground, to vcc , in the "air" (spanish version jaja). _________________ Every little thing gonna be alright |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jun 19, 2007 1:02 pm |
|
|
You mean pins D0 to D3.
Leave them unconnected. The LCD has internal pull-ups on the data
pins, so it's no problem.
Also, try the CCS driver. Here's the file location:
c:\Program Files\PICC\Drivers\LCD420.c |
|
|
elphi
Joined: 17 Apr 2007 Posts: 20 Location: tijuana,bajacalifornia,mexico
|
it breathes |
Posted: Tue Jun 19, 2007 2:47 pm |
|
|
Quote: | You mean pins D0 to D3.
Leave them unconnected. The LCD has internal pull-ups on the data
pins, so it's no problem. |
Yes I meant that. An thanks I didn't know about those internal pull-ups.
Quote: | Also, try the CCS driver. Here's the file location:
c:\Program Files\PICC\Drivers\LCD420.c |
I will try it.
but i have news, my LCD “breathes”.
but doesn't work fine, it shows only characters that I didn’t send.
you can see them in the link:
http://picasaweb.google.com/luiz.enrike/Pic_projects/photo#5077873171954786002
I try, with a different LCD, and both works similar, but not at all.
one shows this characters an stop, the other one, shows the characters, an move theme to the right step by step (as a banner). _________________ Every little thing gonna be alright |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jun 19, 2007 4:33 pm |
|
|
Post your compiler version. It's given at the top of the .LST file.
It will be a 4-digit number such as 3.249, 4.013, etc.
Look in your project directory to find the .LST file. |
|
|
Trent___ Guest
|
Similar Problem |
Posted: Wed Jun 20, 2007 9:46 am |
|
|
I am having the same problem,
PIC is 18F2680
Compiler version 4.041 |
|
|
elphi
Joined: 17 Apr 2007 Posts: 20 Location: tijuana,bajacalifornia,mexico
|
Re: Similar Problem |
Posted: Wed Jun 20, 2007 10:09 am |
|
|
PCM programmer my version is 4.013.
The LCD is working now, but shows blocks that I don’t send, it seems to
be a trouble with the \n (i don't know how to say in English, in Spanish is
car return), in some lines the block appears at the end in other at the begin.
Trent___ wrote: | I am having the same problem,
PIC is 18F2680
Compiler version 4.041 |
Trent, what you mean with "the same problem"?, because i have had
many different problems, in first check all the tips that PCM programmer
posted, the solution of my last problem, the random characters, was
caused for bad connections, check very well the data connection, in my
case that was the mistake. _________________ Every little thing gonna be alright |
|
|
Trent___ Guest
|
More info |
Posted: Wed Jun 20, 2007 10:22 am |
|
|
I am using a Powertip 2004-ARS-ASO-A
Pic is 18F2680 and the FLEX LCD.
The LCD does not init().
I am using the internal osc, as well so I am not sure if this is the problem
I have tied the RW down, and remove the #define from the code. Still no joy.
The port def have been checked as has wiring.
If I step through on an ICD, the first init() command set the display to 2 line mode. Any sent byte after this results in 1 line mode with solid block.
I am stuck. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Jun 20, 2007 10:54 am |
|
|
Try the CCS driver. It's in this directory:
c:\Program Files\PICC\Drivers\LCD420.c |
|
|
elphi
Joined: 17 Apr 2007 Posts: 20 Location: tijuana,bajacalifornia,mexico
|
Re: More info |
Posted: Wed Jun 20, 2007 11:09 am |
|
|
try this
Code: | void main()
{
int1 i=0;
setup_counters (RTCC_INTERNAL,RTCC_DIV_2);
output_high(PIN_A1);
delay_ms(500);
output_low( PIN_A1); //------------------>if the led blinks it means that the pic is working even with the internal oscillator
lcd_init();//---------------------------->to initialize the LCD
printf(lcd_putc, "\f");//---------------->
delay_ms(500);
output_high(PIN_A0);//------------------->if this led turns on the LCD has initialized
|
This is only an example, you can do something similar according your code. _________________ Every little thing gonna be alright |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|