Page 1 of 2

lcd how to do

Posted: Mon Jan 05, 2009 7:20 pm
by foppa
Hello again to you all.
New problems are equal to new issues.
I have made a program which measures
temperature and displays it on a LCD display.

Everything works well in simulation.
When I connect all things.
lcd display shows nothing.
It shows some filled squares.
Run with 16F690, using the internal clock and clockan is set to 4,000,000.

I have read that you should have the same frequency on the chip as the LCD display.

The display is a wintek 2 * 16

Foppa


attach photos

Re: lcd how to do

Posted: Mon Jan 05, 2009 7:22 pm
by foppa
help me

foppa :P

Re: lcd how to do

Posted: Tue Jan 06, 2009 9:16 am
by Steve
What are your configuration settings? And what value crystal (etc) is attached to the chip?

Re: lcd how to do

Posted: Tue Jan 06, 2009 10:45 am
by Benj
Hello

It could be due to the fact you are using PortA. One of the PortA pins is normally an open collector type so it is unable to source any current. For your particular chip RA3 is an input only so connecting via PortA will not work. Maybe try using PortB instead.

Taken from the device datasheet
The exception is RA3, which is input only and its TRIS bit will always read as ‘1’.
Also are you sure your internal clock is running at 4MHz. You can edit the speed by using a C code block to write a value to the OSCCON register. There may also be an OSCTUNE register depending on your chip. You can stick this C code icon right at the start of your program.

Code: Select all

osccon = 0x61;     //Sets the internal clock to 4MHz
Other then this the main problem I can spot is that your LCD Start macro is inside the main loop. Move this to the start of your program eg out of the loop and use an LCD clear inside the loop instead to reset the display.

Re: lcd how to do

Posted: Tue Jan 06, 2009 8:12 pm
by foppa
I use pickit 2.
There are built-in clock in 16F690.
But if you look in PPPv3 so there is no

16F690 in cofig list.
Is it possible to set the config for
16F690 in other places in the program.

I changed to the port c now and there was no difference.
which is the easiest, external clock on the chip or to change clock of chip

can you give me an example / explain how to download OSCCON to chip

"Other then this the main problem I can spot is that your LCD Start macro is inside the main loop. Move this to the start of your program eg out of the loop and use an LCD clear inside the loop instead to reset the display"

No difference


:lol: foppa

Re: lcd how to do

Posted: Wed Jan 07, 2009 9:08 am
by Steve
The configuration word for the internal oscillator needs to be 0x3FF4. You also need that C instruction to set the clock speed of the chip itself appropriately (just put that C code into a C icon at the beginning of your program).

If you are still having difficulty, you should create a very simple LED-flasher program to make sure the hardware configuration of the chip matches the clock settings you are using.

Re: lcd how to do

Posted: Wed Jan 07, 2009 10:50 am
by foppa
Ok steve I will try it tonight.
I will return to how it goes
Thanks
Foppa :P

Re: lcd how to do

Posted: Wed Jan 07, 2009 9:28 pm
by foppa
Ok I have done as you said.
No difference.
Tried to make LED flash, but it does not work
the LED lights up all the time, no wink.
I tried to make a program to test whether an input can light a LED.
And it went well.

Could it be something with the config settings.
Must we tell the chip that uses the internal clock.

Foppa

Re: lcd how to do

Posted: Thu Jan 08, 2009 9:20 am
by Steve
I've just recreated your simple LED flasher program and it works find both on our dev board and Microchip's low-pin count demo board.

My program and HEX file are attached.

To reiterate, you need to do the following three things:

1) set the configuration word within the "configure..." screen
2) set the osccon register appropriately
3) set the clock speed within Flowcode

I can only think that you have not done (1) correctly, or that your programmer is not doing its job right.

If you are using our PPP software, then setting the configuration word is simple. If not, you need to enter "0x2007,0x3ff4" into the "configure..." window.

If this is not the problem, then please describe your hardware / programmer setup and we'll try to help further.

Re: lcd how to do

Posted: Thu Jan 08, 2009 10:23 am
by foppa
Ok I'll try this again tonight.

I use pickit 2.
And when I download hex file, I use flow code "complie to chip"

Must say that you are completely amazing that turn up and help me.

I get the feeling that this may be possible to resolve.

Has placed on the 6-month with different programs and none have been something caught my attention and was too difficult to learn / + 3 kids at home that disrupt
But Flow Code, I can understand and learn

Foppa :P

Re: lcd how to do

Posted: Fri Jan 09, 2009 8:11 am
by foppa
Hello.

Progamet "LED flash" works.
the question of why it works now.
I have not compared my program LED Flasher with what I got from you
Question would you want / time to throw together
a program that I try to get together.
Temperature on the LCD display.
And see how it goes.

Or have you any idea of what can be wrong.
I sat last night and check out the connection and I can not see any errors.

Foppa

Re: lcd how to do

Posted: Fri Jan 09, 2009 8:56 am
by Steve
Post your LED flasher program here and I'll have a look.

Re: lcd how to do

Posted: Fri Jan 09, 2009 10:05 am
by foppa
Ok I vill do that to night.
One more questions:does it matter what type lcd display you use.
foppa :shock:

Re: lcd how to do

Posted: Fri Jan 09, 2009 11:22 am
by Benj
Hello

The LCD type certainly does matter :mrgreen: For example a computer LCD screen is not going to work.

For compatibility with the LCD component in Flowcode you will need a standard alphanumeric display using a controller chip that is compatible with the Hitachi HD44780 controller.

If your LCD has the following pins then it is most likely compatible.

1. GND
2. 5V
3. LCD Contrast
4. RS
5. R/W
6. E
7-14. DB0 - DB7
15-16. Optional Backlight

Re: lcd how to do

Posted: Fri Jan 09, 2009 1:15 pm
by foppa
1. GND
2. 5V
3. LCD Contrast
4. RS
5. R/W
6. E
7-14. DB0 - DB7
15-16. Optional Backlight

Yes this what I have.
Shall lcd connected like this
DB0 - 11
DB1 - 12
DB2 - 13
DB3 - 14

have tested all the different variants

:P

Re: lcd how to do

Posted: Mon Jan 12, 2009 1:19 pm
by foppa
Hello again.
Here you have the file and I had to make a new file. Because of that I am sitting at work and have only demo program on the job and then became the chip 16f628a.
Perhaps it is better to switch to a chip which is included in the PPV list and could set the config on the chip.
I have also crystal home on 4mhz, it is better to have such a place of using the internal located on the chip.

Foppa

Re: lcd how to do

Posted: Mon Jan 12, 2009 3:15 pm
by Benj
Hello Foppa

I have attached an updated version of your program.

Your code was telling the LCD to print out the word temp and was then immediatly clearing the display again. I have now included a small delay after the LCD print to allow the text to be seen.

To get this program working on the hardware then you must go to the Chip -> Configure menu and select XTAL to assign the oscillator, Then as long as the external crystal has a speed of 4MHz then your program should run without problems.

Re: lcd how to do

Posted: Mon Jan 19, 2009 12:25 pm
by foppa
Hello everyone.
John here, has been working evening for a week now.
Working days again.
I download the new file.
But I can not it work, I have tried to create LED Flasher for 16F628A.
Can not make it work.
I have bought a 16F628A just to be sure it is ok.
I checked my connections and they are ok.
I will not give up to get the LCD display to work.

But I suspect that few 16F628A may be something with the configuration.
And at I program it with icsp pickit2.
Pickit2 says program to chip ok.
I have crystal at 4MHz to 16f628A.
Can anybody tell how configuration should be for 16F628A with crystal.
I know that it is set to XTAL in PPV.
Is there anything I have missed.

I am stupid or what :cry:

Re: lcd how to do

Posted: Mon Jan 19, 2009 12:57 pm
by Benj
Hello

Information on obtaining the correct configuration settings when using PICkit or the Microchip bootloader are detailed here in the attached guide.

Re: lcd how to do

Posted: Wed Jan 21, 2009 11:47 pm
by foppa
Hello Benj

I read this with pickit2.
I found nothing that I have done wrong.
Maybe we should take on everything from the beginning.
LED Flasher operates chip 16F690 but not on 16F628A.
Of course, I have 2 equal program a 16F690
and another for 16F628A.
Can I make a mistake with the link with the crystal on 16F628A RA6, RA7.
How would you have done to achieve this I am trying to do.
And when I download to chip all goes well.
Program success.
Code 0.
Grateful for any assistance

Foppa :|

Re: lcd how to do

Posted: Thu Jan 22, 2009 9:52 am
by Steve
Try a config of 0x3F09.

Re: lcd how to do

Posted: Thu Jan 22, 2009 6:01 pm
by foppa
This does not work either.
I give up.
What I can imagine that is proplemet is icsp
for 16F628A.
or will try to have text on the LCD with 16F690.

foppa

Re: lcd how to do

Posted: Fri Jan 23, 2009 9:52 am
by Steve
If PICkit says the program has gone into the chip ok, then it has. The problem will be either electrical (problems with power or oscillator, or the chip itself) or a problem with the configuration data (LVP, oscillator, MCLR).

Re: lcd how to do

Posted: Fri Jan 23, 2009 11:28 am
by foppa
OK.
But if I want chips 16F690
the text on the LCD display.
So it does not work.
And I understand it thoroughly with time / cycle between the chip and LCD.

How to set the value of this.

LCD shows black boxes.
And when I put light on the RS or the other on port c then flashing light.
Which means that the chip is ok.
I have put in a light flashes in the program to ensure that the chip is ok.

Excuse all the questions but I am new in this.
Thanks for all the help

Foppa :shock:

Re: lcd how to do

Posted: Fri Jan 23, 2009 11:36 am
by Steve
Here's what I would suggest:

First write a simple output-flasher program so you can see that the i/o lines are going on and off with the appropriate timing, and that the i/o lines are all behaving as i/o lines:

Code: Select all

loop while (1)
    output 0xFF -> portb
    delay 250ms
    output 0x00 -> portb
    delay 250ms
end loop
Then, when you know that the timing of the i/o is correct, modify the program so it uses the LCD. Don't forget to include the "LCD::Start" macro at the beginning of your program:

Code: Select all

call macro LCD::Start
call macro LCD::PrintString "Hello World"
delay 2s
loop while (1)
    output 0xFF -> portb
    delay 250ms
    output 0x00 -> portb
    delay 250ms
end loop