View previous topic :: View next topic |
Author |
Message |
Stygian
Joined: 26 Apr 2011 Posts: 13
|
i give up |
Posted: Tue Apr 26, 2011 6:22 am |
|
|
First of all sorry for my bad english
I used the Flex LCD driver from my 2x20 LCD (KS0066u chip)
First i connect all data pins (D4-D7) on PORT C
C0 = D4
C1 = D5
C2 = D6
C3 = D7
And the RS RW and E on PORT B
B4 = RS
B5 = RW
B6 = E
I used the example code from here. I got only black squares in the first line.
I put a 10k POT on the VO and adjusted the contrast.
I read the forum several times and do what you suggest to other people but it won't help.
After that i directly wire all on PORT B
B0 = D7
B1 = D6
B2 = D5
B3 = D4
B4 = RS
B5 = RW
B6 = E
But still black squares on my LCD.
My PIC is 16F1938
the comp. version 4.114
Please help if you can |
|
![](templates/subSilver/images/spacer.gif) |
Stygian
Joined: 26 Apr 2011 Posts: 13
|
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Apr 26, 2011 10:41 am |
|
|
Black squares mean the LCD is not being initialized, or that the
contrast voltage is set incorrectly.
Quote: | I put a 10k POT on the VO and adjusted the contrast. |
What voltage do you measure on the contrast pin with a voltmeter ?
1. Post the list of #define statements from the top of your Flex driver file.
2. Post a short test program that shows how you are using the lcd driver.
See the short test program that I posted in this thread as an example:
http://www.ccsinfo.com/forum/viewtopic.php?t=42521
Make a program similar to that, except use the 16F1938 and use your
#fuses and #use delay() settings. |
|
![](templates/subSilver/images/spacer.gif) |
Stygian
Joined: 26 Apr 2011 Posts: 13
|
|
Posted: Tue Apr 26, 2011 2:59 pm |
|
|
The voltage is 0,6 V
This is the only thing what i changed in the LCD Flex driver:
Code: |
#define LCD_DB4 PIN_C1
#define LCD_DB5 PIN_C0
#define LCD_DB6 PIN_C2
#define LCD_DB7 PIN_C3
#define LCD_RS PIN_B4
#define LCD_RW PIN_B5
#define LCD_E PIN_B6 |
my main.h file:
Code: | #include <16F1938.h>
#device adc=10
#FUSES NOWDT //No Watch Dog Timer
#FUSES ECH
#FUSES WDT_SW
#FUSES NOPUT //No Power Up Timer
#FUSES MCLR //Master Clear pin enabled
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOCPD //No EE protection
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOCLKOUT
#FUSES IESO //Internal External Switch Over mode enabled
#FUSES FCMEN //Fail-safe clock monitor enabled
#FUSES NOWRT //Program memory not write protected
#FUSES NOVCAP
#FUSES PLL
#FUSES STVREN //Stack full/underflow will cause reset
#FUSES BORV19
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#use delay(clock=4000000)
#define LAST_VALUE 10 |
And i used this test program:
Code: | #include <main.h>
#include <LCD_Drive.c> //this is the flex lcd driver
void main()
{
lcd_init();
printf(lcd_putc, "\f");
delay_ms(500);
printf(lcd_putc, "Hello");
while(1);
} |
|
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Apr 26, 2011 4:58 pm |
|
|
I noticed something. Here, in your first post, you have listed your connections: Quote: |
C0 = D4
C1 = D5
C2 = D6
C3 = D7 |
But in your 2nd post, you have told the Flex driver that these are your connections:
Quote: |
#define LCD_DB4 PIN_C1
#define LCD_DB5 PIN_C0
#define LCD_DB6 PIN_C2
#define LCD_DB7 PIN_C3 |
You have swapped pins C0 and C1 the #define statements.
That would definitely make it fail to initialize the LCD. |
|
![](templates/subSilver/images/spacer.gif) |
Stygian
Joined: 26 Apr 2011 Posts: 13
|
|
Posted: Tue Apr 26, 2011 5:23 pm |
|
|
Yes I noticed it too and make correction
This is the original:
C0 = D4
C1 = D5
C2 = D6
C3 = D7
I swap the pins and that was the last try
I put it on PORT B. But nothing...
What about my fuses? are they correct? |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Apr 26, 2011 6:04 pm |
|
|
There are some conflicting fuses. For example, you have two oscillator
fuses, ECH and INTRC_IO. The compiler resolves this as INTRC_IO.
You have the PLL fuse, but the compiler changes it to PLL_SW.
I was able to make your program work with my board. I don't have
a 16F1938, but I do have a 16F1937, which is in the same PIC family.
I installed vs. 4.114. I jumpered my PicDem2-Plus board (non-Rohs
version) to connect your specified LCD pins to the built-in LCD on the
board. Then I ran the program. It worked the first time. The LCD says:
And the only thing I changed was the PIC (to 16F1937). |
|
![](templates/subSilver/images/spacer.gif) |
Stygian
Joined: 26 Apr 2011 Posts: 13
|
|
Posted: Thu Apr 28, 2011 8:10 am |
|
|
Today I bought a new lcd display and it's worked at the first time...
Thank you PCM programmer for your help. |
|
![](templates/subSilver/images/spacer.gif) |
|