View previous topic :: View next topic |
Author |
Message |
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
|
senur
Joined: 11 Dec 2013 Posts: 13
|
|
Posted: Mon Dec 30, 2013 1:28 pm |
|
|
Thank you for your replies,
I redid the soldering with rosin flux core. It's not perfect but I think it's better than before however, I'm still getting the same result shown in the previous picture.
Dose that means I damaged this LCD too?
I noticed something, the squares show up only when lcd_init() is called. I tested that by adding a short delay before it. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19538
|
|
Posted: Mon Dec 30, 2013 1:54 pm |
|
|
It's possible.
However I'd say the most likely thing is that a couple of the pins are shorted together, or one of the data pins is still not connected correctly. It looks like it is getting 'garbaged' initialisation data, so being programmed incorrectly.
Lesson is, when you have soldered a device like this, before applying power, sit down with a test meter, and test each adjacent pair of pins and verify they do not connect to each other, then test each pin on the processor does connect to the pin it is meant to go to on the display. Then double check with a magnifying glass that every joint visually looks as it should. A smooth surface running between both parts of the connection.
Another poster has pointed out how easy it is to get scrap electronics. Taking the time to experiment with soldering on this, till you can generate good joints.
Look at:
<http://www.instructables.com/id/How-to-Solder-Videos%3A-Why-is-soldering-difficult-s/step3/Good-and-bad-joint-pictures/>
Best Wishes |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Dec 30, 2013 2:10 pm |
|
|
Your LCD backlight jumper connections shown in the photo in this post
are wrong:
http://www.ccsinfo.com/forum/viewtopic.php?t=51667&start=9
You have jumpered two wires from JP8 over to the LCD connector.
That's wrong.
You should just connect a short jumper wire (0.25 inch, or 6mm)
between the two pads on JP8. Another way to do it, is to install a
a small 2-pin header on JP8, and then push a shunt onto the two pins.
The goal is to connect the two pins of JP8 together.
Your existing connections are actually over-driving the backlight LED.
You are bypassing the 10 ohm series resistor that is supposed to
limit the amount of current used by the backlight. Possibly you may
have damaged the lcd backlight. I don't know.
Last edited by PCM programmer on Mon Dec 30, 2013 2:44 pm; edited 1 time in total |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
senur
Joined: 11 Dec 2013 Posts: 13
|
|
Posted: Thu Jan 02, 2014 5:21 am |
|
|
Thank you for your help.
I've connected everything as you said and changed the clock to 20MHz.
it's shown in the crystal 20MHz. And also connected the JP8.
However, now I can see some output but wrong output.
http://i.imgur.com/S0vPsxD.jpg
Here is my code:
Code: |
#include <18F46K22.h>
#device adc = 8
#FUSES NOWDT //No Watch Dog Timer
#FUSES HSH // High Speed oscillator
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOLVP //Low Voltage Programming on B5 (PIC18)
#FUSES NOWRT //Program memory not write protected
#FUSES BROWNOUT, PUT
#use delay (clock = 20000000)
#include <flex_lcd.c>
void main()
{
delay_ms(250);
lcd_init();
delay_ms(250);
lcd_gotoxy(1,1);
lcd_putc("\fWelcome\n");
lcd_putc("RFID");
//printf(lcd_putc, "Hi.");
while(1);
}
|
For the connection
////
#define LCD_DB4 PIN_D4
#define LCD_DB5 PIN_D5
#define LCD_DB6 PIN_D6
#define LCD_DB7 PIN_D7
#define LCD_E PIN_B5
#define LCD_RS PIN_B4 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jan 02, 2014 11:04 am |
|
|
Quote: | lcd_putc("\fWelcome\n");
lcd_putc("RFID"); |
Your photo shows WloeRIDS is displayed. It's basically missing every 2nd
character that is transmitted. This seems like a timing problem.
Try this. Increase the initial delay in main() to 1000 ms (from 250 ms)
as shown in bold below:
Quote: |
void main()
{
delay_ms(1000);
lcd_init();
delay_ms(250);
lcd_gotoxy(1,1);
lcd_putc("\fWelcome\n");
lcd_putc("RFID");
//printf(lcd_putc, "Hi.");
while(1);
} |
Then, in the flex_lcd.c file, can you verify that you commented out this
line, as shown in bold below:
Quote: |
// If you only want a 6-pin interface to your LCD, then
// connect the R/W pin on the LCD to ground, and comment
// out the following line.
// #define USE_LCD_RW 1 |
|
|
|
senur
Joined: 11 Dec 2013 Posts: 13
|
|
Posted: Thu Jan 02, 2014 11:27 am |
|
|
Quote: | Try this. Increase the initial delay in main() to 1000 ms (from 250 ms)
as shown in bold below:
|
I think you're right but now the output I see is WloeRI
I've tried several delays like
delay_ms(1500);
delay_ms(2000);
delay_ms(600);
but I'm still getting weird results
can it be something else?
and for the flex_lcd.c I'vd verified that it is commented.
//#define USE_LCD_RW 1
P/S: every time I press the RESET button. I get different results. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jan 02, 2014 11:38 am |
|
|
Get an ohmmeter and check all the LCD connections between the LCD
connector and the PIC pins. Verify that each connection is good, and
also verify that adjacent pins on the LCD connector are not shorted
to each other with a solder bridge. |
|
|
senur
Joined: 11 Dec 2013 Posts: 13
|
|
Posted: Thu Jan 02, 2014 11:43 am |
|
|
I have two LCDs and I've tried them both. Same results in both of them. So, I think the soldering is fine. I'll try to double check the ohmmeter.
Thank you |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jan 02, 2014 12:10 pm |
|
|
As a test, you could edit the flex_lcd.c file and increase all the delays:
Everywhere it has delay_cycles(x) change it to delay_us(1).
For other delay statements, such as delay_us() or delay_ms(),
make each one be 2x as long. For example, change delay_us(60)
to delay_us(120). Change delay_ms(5) to delay_ms(10).
If it still doesn't work after doing all this, then I'm not sure what to do. |
|
|
stinky
Joined: 05 Mar 2012 Posts: 99 Location: Central Illinois
|
|
Posted: Thu Jan 02, 2014 12:16 pm |
|
|
This PIC is above my pay grade, so I'll throw my two cents in anyway.
does this enable the brownout reset module?
If so, perhaps bypass that to eliminate one more variable. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Thu Jan 02, 2014 12:55 pm |
|
|
comment: curiouser and curiouser...
Here's my 46k22 working fuses file...
//46k22 fuses
//#fuses H4 //uses PLL*4 speed
//#fuses INTRC_IO //use internal osc (yes !!)
#fuses XT //4MHz xtal with caps
#fuses nopllen //disable PLL (NOT x4 speed !)
#FUSES noMCLR //Master Clear pin disabled,pin 1( RE3 available !)
#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES NOBROWNOUT //No brownout reset
#FUSES BORV20 //Brownout reset at 2.0V
#FUSES PUT //Power Up Timer
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#FUSES NOWRTD //Data EEPROM not write protected
#FUSES NOWRTB //Boot block not write protected
#FUSES NOEBTR //Memory not protected from table reads
#FUSES NOEBTRB //Boot block not protected from table reads
#FUSES NOCPB //No Boot Block code protection
#FUSES NOWRTC //configuration not registers write protected
#FUSES NOFCMEN //Fail-safe clock monitor enabled
#FUSES NOPBADEN //PORTB pins are configured as digital I/O on RESET
#FUSES STVREN //Stack full/underflow will cause reset
#FUSES NOIESO //Internal External Switch Over mode enabled
#FUSES LPT1OSC //Timer1 configured for low-power operation
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
...
top two lines are for internal 16MHx osc set for 64 Megs be sure to remark lines 3 and 4.
lines 3,4 are for real 4 MHz xtal and 22 puff caps..
this fuse file is accessed as
#include "46k22_fuses.h"
saves me a lot of typing( 2 fingers) and it works.
Both configs work just fine and I'm using the flex_lcd driver with a $4 2by16 LCD module.
hth
jay |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Thu Jan 02, 2014 1:04 pm |
|
|
From the beginning you are having problems with timings and setting the correct clock speed.
I'd say, triple and quadruple check your timings!!!
Just a few days ago you wrote: senur wrote: | ezflyr wrote: | You should do this in every
one of your PIC projects!! |
Actually, I did that at the very beginning to check everything. And I just did it again to double check. It is working fine. My problem is with the LCD. | And now it turns out your circuit board is equipped with a 20MHz crystal and not 4MHz. That's a factor 5 difference!
How is it possible you said everything with the timing was working fine?
I'm sure you did a serious job, but somewhere a thinking error was made that led you to the conclusion the timing was correct. Perhaps that same error is still there?
Please redo the blinking LED test to confirm the board is running at 20MHz. Code: | #include <18F46K22.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES HSH // High Speed oscillator
#FUSES NOLVP //Low Voltage Programming on B5 (PIC18)
#FUSES PUT
#use delay (clock = 20MHz)
#define LED1 PIN_B6
void main()
{
while(1)
{
output_toggle(LED1);
delay_ms(500);
}
} |
Measure the time it takes for the LED to go on (and off) for 10 times, this should take 10 seconds. Use a real clock, do not count the seconds in your mind because this is inaccurate.
Perhaps I missed it, but I can't find it after re-reading the whole thread. What is your compiler version number? There might be a known problem.
Also, please post the top of your flex.c file with all the modified lines. |
|
|
senur
Joined: 11 Dec 2013 Posts: 13
|
|
Posted: Tue Jan 07, 2014 1:10 pm |
|
|
I've tried everything so far. I even changed the PIC itself but with no luck still getting weird results. Anyhow, I'll keep on trying and when I solve the problem I'll post it here.
Thank you all so much for helping me. Wish you all a great year. |
|
|
|