CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Interfacing LCD 2X16 JHD162A with PIC18F46K22
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
senur



Joined: 11 Dec 2013
Posts: 13

View user's profile Send private message

PostPosted: Mon Dec 30, 2013 7:22 am     Reply with quote

Thank you, Now I've set the VEE with 0.4 volt. But this is the output I get:



http://i.imgur.com/ezhhvBb.jpg
temtronic



Joined: 01 Jul 2010
Posts: 9241
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Dec 30, 2013 8:48 am     Reply with quote

comment: I still don't like the pin soldering.
I suggest you totally remove all connections to the LCD module, clean up with solderwick and install new 'posts'. You need a very fine tipped iron and good eye-hand corodination. I put the posts into the breadboard, position the LCD module ontop of the posts, then solder every other pin, then the ones in between. You need solid support before you solder.Use books, erasers, whatever to make the LCD module firm to the pins BEFORE you solder.You can spend 15 minutes 'setting it up' and 15 seconds to solder.
I've got a few LCD modules that are 10 years old, been in and out of countless breadboards, and still work today.

The picture shows you probably have a few bad connections but the module is 'alive'!

hth
jay
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Mon Dec 30, 2013 9:08 am     Reply with quote

Hi,

Do you know for sure that your PIC is actually running, and at the proper speed?? Every single PIC project I undertake includes a PWR LED
driven off an I/O pin of the PIC. I flash this LED at power-up to let me know that my PIC has actually started up, and is running! This technique has
saved me much aggravation in the past!!

I would connect an LED to an unused I/O pin on your PIC. Connect the anode (+) terminal of the LED directly to the PIC I/O pin. Connect the
cathode (-) terminal of the LED to GND through a series connected current limiting resistor of about 500 ohms value.

In your code, add the following:

Code:

#define PWR_LED Pin_XX   <--- change to match your hardware


Then add the following at the top of your Main():

Code:


int8 iIndex = 0;

   // Here we blip the Power LED at power-up to show that the hardware is working
   for ( iIndex = 0 ; iIndex < 3 ; iIndex++ )
   {
      output_high(PWR_LED);
      delay_ms(250);
      output_low(PWR_LED);
      delay_ms(250);
   }
      
   // Here we leave the Power LED ON
   output_high(PWR_LED);


When you apply power to your board, the PWR LED should blink four times, and then stay on. Also, note the 'rate' of the flashing. The entire
sequence should take about 1 second. Adjust the delay times as needed if you aren't sure of the correct timing!!! You should do this in every
one
of your PIC projects!!

Good Luck and Happy New Year!!

John
senur



Joined: 11 Dec 2013
Posts: 13

View user's profile Send private message

PostPosted: Mon Dec 30, 2013 9:47 am     Reply with quote

temtronic wrote:
comment: I still don't like the pin soldering.

hth
jay


I went to the store today to buy the flux core but they were out. So, I'll check other stores tomorrow. and I'll redo all of them. thank you

Quote:
You should do this in every
one of your PIC projects!!
Good Luck and Happy New Year!!

John


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.

This is my second LCD I damaged the first one and I think I damaged this too Crying or Very sad

Thank you and Happy New Year!!!
gpsmikey



Joined: 16 Nov 2010
Posts: 588
Location: Kirkland, WA

View user's profile Send private message

PostPosted: Mon Dec 30, 2013 10:11 am     Reply with quote

senur wrote:


I went to the store today to buy the flux core but they were out. So, I'll check other stores tomorrow. and I'll redo all of them. thank you

This is my second LCD I damaged the first one and I think I damaged this too Crying or Very sad

Thank you and Happy New Year!!!


You don't say just what store you went to - any decent electronics store should have Rosin core solder.
Your "home improvement" stores typically will not have rosin core solder, but will have either solid core or acid core - never
use either of those with electronics projects - acid core will eat the wiring in a while and solid solder will not "flow"
unless you use a liquid flux (you can get rosin flux in a small bottle with a brush, but that is not the easiest).
Use rosin core solder and a small tipped iron. If you are not sure about soldering, look on Youtube - there are some
good demos there. Good solder joints look good - bad solder joints will drive you nuts trying to find why something
works sometimes and not others (or not at all and you just "know" it is connected).

mikey
_________________
mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3


Last edited by gpsmikey on Mon Dec 30, 2013 10:12 am; edited 1 time in total
temtronic



Joined: 01 Jul 2010
Posts: 9241
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Dec 30, 2013 10:11 am     Reply with quote

hint: Before you damage another LCD module ,get some 'dead' PCBs( maybe old computers) or a copper clad perfboard with a zillion pads on it. Practice soldering by adding just enough solder to a pad to make a nice 'bump'.Repeat, do it again, another one, another one...do the entire board if necessary to better your skill at soldering.It is something you have to learn by doing a 'zillion' times. It takes time to figure out how much time to hold the tip to the PCB, how much solder, how long to hold,etc. Also get thin solder, a bit bigger than a wire wrap pin,smaller than a test lead probe.I've got 50+ years of doing it but can NOT do SMT work. Silly things are way too small for my bad eyes to see, let alone solder! DIPS are getting hard to do now too...sigh...getting old sucks !
Also be sure to have a damp real sponge to clean the tip every few solderings! A clean tip will make the job a LOT easier!!


hth
jay
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Mon Dec 30, 2013 11:06 am     Reply with quote

Hi All,

A bit off-topic, but Jay brings up a good point about being able to see your work clearly! One of the best 'investments' I ever made for my electronics
workbench was a lighted magnifier! Here is the one I got:

http://www.coleparmer.com/buy/product/85389-large-diameter-illuminated-benchtop-magnifier-2x-magnification-31900-4.html

There are certainly cheaper alternatives, but you'd be hard-pressed to go wrong with this one. I use mine virtually every day!

John
senur



Joined: 11 Dec 2013
Posts: 13

View user's profile Send private message

PostPosted: Mon Dec 30, 2013 1:28 pm     Reply with quote

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? Crying or Very sad
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: 19537

View user's profile Send private message

PostPosted: Mon Dec 30, 2013 1:54 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Dec 30, 2013 2:10 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Dec 30, 2013 2:18 pm     Reply with quote

Another thing. I can't tell from your photo what the frequency of your
crystal is. The lighting in the photo washes out the writing on the top of the crystal.

In this photo, another person is using the SK40C board. It shows a
20 MHz crystal is installed:
http://4.bp.blogspot.com/-htSAjS35E0w/UKFRz3F2sdI/AAAAAAAAAHQ/Rm50v1Wqv18/s1600/071120121341.jpg

But your program in this post shows the #use delay() is set to 4 MHz,
as if you have a 4 MHz crystal installed:
http://www.ccsinfo.com/forum/viewtopic.php?t=51667&start=2

Can you look at the crystal on your board and post the actual crystal
frequency ?
senur



Joined: 11 Dec 2013
Posts: 13

View user's profile Send private message

PostPosted: Thu Jan 02, 2014 5:21 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Jan 02, 2014 11:04 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Jan 02, 2014 11:27 am     Reply with quote

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 Crying or Very sad
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

View user's profile Send private message

PostPosted: Thu Jan 02, 2014 11:38 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
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