jcsntoll
Junior Member
Offline
Posts: 46
Thank You
-Given: 24
-Receive: 3
|
|
« Reply #25 on: November 22, 2009, 12:07:26 00:07 » |
|
OMG... I feel like a doh! I'm running a mac, so most of my windows things I run in Parallels. I never saw the Output windows in MPLAB. Took me a while but I saw it way off screen. I was able to correct the issues.. and am now able to build and make succesfully.
Ok attached is my Proteus build, one thing to note, the keypad.. since I wanted to try and build it as close as possible, I rotated the keypad so it would match the design.. IGNORE the key labels!!!!! the top left corner is 1, then 2, then 3, then D... Not what it shows. ( of course that shouldn't affect the way the LCD works. ) Please let me know if you see any wiring mistakes or problems. Feel free to make any changes or whatever and post it back.. I'm not very good at layout sometimes, Most of the time it's just me being lazy or trying to match the PCB or Schematic.
I may try DarkClovers suggestion, of commenting everything out except the LCD init and a test message. See if it works in my Proteus build or on the real PCB.
|
|
|
Logged
|
|
|
|
TomJackson69
Active Member
Offline
Posts: 218
Thank You
-Given: 26
-Receive: 63
|
|
« Reply #26 on: November 22, 2009, 12:53:58 00:53 » |
|
jcsntoll,
I just compiled the project and it compiled without error, only warning (lot of warning, but it is OK). Attached is a complete project with new HEX file, this HEX file from a modified delay in main.c. You can take a look in the function "volatile void writeLCD(byte data, byte command)" and "void Delay_Nops(void)" to see what I have changed. You can modify to see if it works.
Download the attached file, unzip in to "C:\Batt_Cap_Meter" and double click on the "Batt_Cap_Meter" project or workspace to open the project. Then compile to see it it will compile on you machine.
Remember to post the Proteus circuit so I can test it.
Best regards,
Tom
During typing, your reply came before I posted hehe
Posted on: November 22, 2009, 01:11:52 01:11 - Automerged
jcsntoll,
I download the Proteus file and try to run it with the HEX file but not thing hapen. There are thousands of error message from the simulation. Memory read write error; some thing is wrong with my Proteus???
I try to simulate it in MPLAB, it seem to run, initialize the LCD, delay .... But this is just in MPLAB.
How about the new HEX file with your real circuit? Does it show anything? Can you compile the project with my ZIP file?
Tom
|
|
|
Logged
|
Con Rong Chau Tien
|
|
|
jcsntoll
Junior Member
Offline
Posts: 46
Thank You
-Given: 24
-Receive: 3
|
|
« Reply #27 on: November 22, 2009, 12:55:19 00:55 » |
|
WOW! I just ran into yet ANOTHER problem!!! sigh! I am getting close to giving up but I REALLY would like to get this project working. ( and I've put so much money into it already to give up now ) Apparently my programmer is unable to erase these pic18f2550 chips. I'm unclear why yet.. I normally use 16f84a or 16f628 chips. I'm looking for another programmer now. Perhaps it's time to upgrade. Update: PICkit 2 unit ordered and on it's way.
|
|
« Last Edit: November 22, 2009, 03:18:57 03:18 by jcsntoll »
|
Logged
|
|
|
|
TomJackson69
Active Member
Offline
Posts: 218
Thank You
-Given: 26
-Receive: 63
|
|
« Reply #28 on: November 22, 2009, 03:54:08 03:54 » |
|
jcsntoll,
I think I found one of the problem. On the circuit, port B connected as follow:
PIC LCD RB7 to D4 RB6 to D5 RB5 to D6 RB4 to D7
Instead, port B should connect as follow: PIC LCD RB7 to D7 RB6 to D6 RB5 to D5 RB4 to D4
On the circuit is wrong if the "writeLCD" function send 1st nibble and then 2nd nibble without flipping it.
You can reconnect the wire as above, it should work. If you don't modify the circuit and use it with the program as is, the LCD will never display because the commands send to the LCD are not commands but JUNK data.
Let me know if this fix.
Also modify the SCH on the Proteus too. But the Proteus not work anyways.
Tom
|
|
|
Logged
|
Con Rong Chau Tien
|
|
|
jcsntoll
Junior Member
Offline
Posts: 46
Thank You
-Given: 24
-Receive: 3
|
|
« Reply #29 on: November 22, 2009, 05:47:47 05:47 » |
|
I wondered about that, but since the Schematic and the PCB layout were the same, I figured it must be right. As someone stated before, this is a public project, and I haven't seen any notes or corrections. I wonder how the author built his own device. I used the PCB trace layout included, and
I will try and make the changes on the real device and see what happens. Why were you not able to get it to work in Proteus?
|
|
|
Logged
|
|
|
|
TomJackson69
Active Member
Offline
Posts: 218
Thank You
-Given: 26
-Receive: 63
|
|
« Reply #30 on: November 22, 2009, 06:37:13 06:37 » |
|
I don't know why the Proteus is not simulating. When I start the simulate, Proteus just give THOUSANDS of error saying it can not read or write to memory. I have not have time to try it again.
About the wiring error, I wonder why it is like that my self. I could be wrong because I have not look into the 4 wire interface spec; there fore I could be wrong. I will research to make sure how is the correct way to connect in 4 wire mode.
Tom
|
|
|
Logged
|
Con Rong Chau Tien
|
|
|
jcsntoll
Junior Member
Offline
Posts: 46
Thank You
-Given: 24
-Receive: 3
|
|
« Reply #31 on: November 22, 2009, 09:34:45 09:34 » |
|
Tom, My proteus did the same thing.. something about trying to write to the Rom.. Bogged the simulation right down.
Anyway, here is an update.. I have tried 3 different displays, I have tried D4-D7 and D7-D4 as suggested.. I have tried original hex and Delay hex.. I either get a blank display or a display with the first row full of blocks.
I'm stumped. I've tried contacting the Silicon chip magazine, and tracking down the author, No luck. Even if someone else could build it and confirm either my results or have a working project.
I'm not sure what else to try. I'm getting really bummed out. I REALLY do appreciate everyone's hard work, time and effort. If we ever figure this out and get it working, I will owe you guys.
|
|
|
Logged
|
|
|
|
DarkClover
Active Member
Offline
Posts: 167
Thank You
-Given: 37
-Receive: 60
Still alive...
|
|
« Reply #32 on: November 22, 2009, 11:32:08 11:32 » |
|
Anyway, here is an update.. I have tried 3 different displays, I have tried D4-D7 and D7-D4 as suggested.. I have tried original hex and Delay hex.. I either get a blank display or a display with the first row full of blocks.
If the display becomes blank it should be initialized. Please can you place a delay (1 second) before and after the display initialisation. Are there blocks on the LCD while the delay? If yes and if it's blank after the delay your display is initialized.
|
|
« Last Edit: November 22, 2009, 11:34:31 11:34 by DarkClover »
|
Logged
|
Not thinking means to believe what others say! TRY & ERROR... the fundamental principle our existence is based on
|
|
|
jcsntoll
Junior Member
Offline
Posts: 46
Thank You
-Given: 24
-Receive: 3
|
|
« Reply #33 on: November 22, 2009, 05:59:35 17:59 » |
|
Hmm.. I'm sorry to disagree, because After it the init, it displays a Welcome screen showing the title of the project, and version, and then a menu. None of that is happening.
|
|
|
Logged
|
|
|
|
Ichan
Hero Member
Offline
Posts: 833
Thank You
-Given: 312
-Receive: 392
|
|
« Reply #34 on: November 22, 2009, 07:01:57 19:01 » |
|
Just a though, is the fuse of code area is set to read protected when burning the PIC? If yes then the LCD routine can not get the string required to displays, looks like they are all on the flash code (rom) area.
I got an impression that your hardware is actually works except that the LCD displays nothing. Is the USB works?
-ichan
|
|
|
Logged
|
There is Gray, not only Black or White.
|
|
|
jcsntoll
Junior Member
Offline
Posts: 46
Thank You
-Given: 24
-Receive: 3
|
|
« Reply #35 on: November 22, 2009, 07:23:27 19:23 » |
|
Thanks for your ideas Ichan, the fuse area is ok, nothing is protected.. I was finally able to erase the Pic using a different programmer. I have not tried the USB yet. I feel the code is working, due to how the Buzzer works, and the LCD backlight lights at first, then slowly dims.. and when a key is pressed it returns to full brightness.
I just do not get any characters on the display.
|
|
|
Logged
|
|
|
|
oldvan
Senior Member
Offline
Posts: 372
Thank You
-Given: 154
-Receive: 107
If the van is a Rockin'...
|
|
« Reply #36 on: November 22, 2009, 08:14:35 20:14 » |
|
Just a though, is the fuse of code area is set to read protected when burning the PIC? If yes then the LCD routine can not get the string required to displays, looks like they are all on the flash code (rom) area. Read-protecting the chip only prevents it from being read from outside the chip via ICSP, it does not interfere with the program reading it.
|
|
|
Logged
|
Give a man a fish and you feed him for a day. Teach a man to fish and he will sit around in a boat drinking beer all day.
|
|
|
TomJackson69
Active Member
Offline
Posts: 218
Thank You
-Given: 26
-Receive: 63
|
|
« Reply #37 on: November 22, 2009, 11:03:09 23:03 » |
|
jcsntoll,
Do you have a scope to look at the waveform? I would look at the waveform signal on pin 4(RS of the LCD) and any data pin to see what the waveform look like. Also the EN pin (pin 6 of the LCD).
Is the LCD still display full block on the top line? how about the second line?
If you can provide a picture or video of the display when you turn the unit on, that will help.
Tom
|
|
|
Logged
|
Con Rong Chau Tien
|
|
|
Top
Senior Member
Offline
Posts: 339
Thank You
-Given: 52
-Receive: 1719
|
|
« Reply #38 on: November 23, 2009, 04:26:26 04:26 » |
|
Can you try this hex file just to test your hardware?
Should work in your Proteus simulation too..
|
|
|
Logged
|
|
|
|
jcsntoll
Junior Member
Offline
Posts: 46
Thank You
-Given: 24
-Receive: 3
|
|
« Reply #39 on: November 23, 2009, 08:11:47 20:11 » |
|
Interesting, yes I tried your file Top and it does indeed work fine in Proteus. But not in the project.. so I backed up.. and build a very simple ( just the chip and the LCD ) mock up. ( See attached picture ) as you can see I get the same display as in the project, just blocks on line one.
So to confirm the LCD was working and able to use 4bit, I built a simple project with a 16f628. ( see second picture ) and it works fine.
It may be hard to tell in the photo but, lines X and Y are Ground, W and Z are +5v on the breadboard. the LCD starts at pin 1 on the Left with the White/Blue wire, to 16 on the far right with Brown ( 15 and 16 being back light of course ) As a note: on the breadboard I'm using a 20Mhz Resonator, but on the PCB I have a 20Mhz crystal. and the 16f628 is being timed internally.
Thoughts or suggestions? I feel I'm missing something simple and waiting for the Doh! moment.
|
|
|
Logged
|
|
|
|
DarkClover
Active Member
Offline
Posts: 167
Thank You
-Given: 37
-Receive: 60
Still alive...
|
|
« Reply #40 on: November 23, 2009, 09:21:52 21:21 » |
|
If not done yet. You can extract the whole LCD code (without the extended write routines) and try to run it. If it doen't work add some extra delays and so on. If you get it to work maybe it will work inside the project too then.
Btw... I made a little test with the KS0066 LCD from my friend. I wrote a simple code for a normal HD44780 (4-bit) and connected the KS0066 display and it worked fine. So it's likely not the display type.
|
|
|
Logged
|
Not thinking means to believe what others say! TRY & ERROR... the fundamental principle our existence is based on
|
|
|
jcsntoll
Junior Member
Offline
Posts: 46
Thank You
-Given: 24
-Receive: 3
|
|
« Reply #41 on: November 23, 2009, 09:58:48 21:58 » |
|
Ok I'll work on it some more.. I really appreciate everyones help. I'm still open to suggestions or other things to try.
DarkClover, I think I read that the KS0066 is backwards compatible with the HD44780, but the HD44780 is not always exchangeable with the KS0066.
Doing some internet research the KS0066 has a faster controller than the HD44780, There is also some built in flash to the KS0066 for storing special characters.
TOP, Can you send the source for your test hex? Did you write something from scratch, or did you just modify the Battery Monitor files?
|
|
|
Logged
|
|
|
|
Top
Senior Member
Offline
Posts: 339
Thank You
-Given: 52
-Receive: 1719
|
|
« Reply #42 on: November 23, 2009, 11:40:29 23:40 » |
|
Can you send the source for your test hex? Did you write something from scratch, or did you just modify the Battery Monitor files?
I used the existing LCD routines and compiled without 'Extended Mode' so Proteus could run the code. Here's a new hex that I think will work on your hardware; only a test but it uses the exact initialization routine from the HD44780 datasheet.
|
|
|
Logged
|
|
|
|
bbarney
Moderator
Hero Member
Offline
Posts: 2429
Thank You
-Given: 405
-Receive: 545
Uhm? where did pickit put my mute button
|
|
« Reply #43 on: November 23, 2009, 11:46:36 23:46 » |
|
don't know if it's the same problem but it looks like it I built the High-accuracy Digital LC Meter and had the same problem and if you look at the 2 pics it looks like the same lcd the problem was pin 13 is pin 14 and 12 is 11 etc. in other words the rows are reversed so 14 13 12 11 10 9 8 7 6 5 4 3 2 1
should be (was on mine) 13 14 11 12 9 10 7 8 5 6 3 4 1 2
|
|
|
Logged
|
Ever wonder why Kamikaze pilot's wore helmet's ?
|
|
|
zuisti
Senior Member
Offline
Posts: 409
Thank You
-Given: 242
-Receive: 780
|
|
« Reply #44 on: November 24, 2009, 09:24:48 09:24 » |
|
...I think I read that the KS0066 is backwards compatible with the HD44780, but the HD44780 is not always exchangeable with the KS0066 Hi; Look at the site Proton forum: http://www.picbasic.org/forum/showthread.php?t=2201Seems they have same problems ... KS0066 Driver LCD modules and 44780 compatibility ... However when I plug it in, it doesn't seem to work, even though the other Hitatchi module I have works fine. All I get is one row of all blue characters - like its powered but not initialised or programmed. ... Sorry I don't have a solving but ... play with the timings (increase!) and use the proper pinouts (see the post at the forum). Have a nice day zuisti
|
|
|
Logged
|
|
|
|
jcsntoll
Junior Member
Offline
Posts: 46
Thank You
-Given: 24
-Receive: 3
|
|
« Reply #45 on: November 24, 2009, 11:53:53 11:53 » |
|
Thanks for the info Zuisti.. Glad it's not just me. I thought about waiting for the new programmer before I mess much more, but if others are having the same problem, maybe it's not that.
I tried Top's LCD_Test2, and again works fine in Proteus, but not on the PCB. Does anyone else have a HD44780 LCD, and a PIC18f2550 that they can confirm one way or the other. I'm going to feel REALLY stupid if it's something I'm doing wrong. I keep thinking back to the comments, Since this is a public project featured in a magazine, must be right. But I have to remind myself I'm using the HD44780 instead of the called for KS0066.
by the way, the HD44780 LCD I'm using have a single row of pins 1-16, not the two column type. I'll work on playing with the timing today, maybe I can figure something out.
|
|
|
Logged
|
|
|
|
Top
Senior Member
Offline
Posts: 339
Thank You
-Given: 52
-Receive: 1719
|
|
« Reply #46 on: November 24, 2009, 02:35:52 14:35 » |
|
I'm really suprised my code didn't work because I modified the existing code to use the exact initialization sequence for the HD44780 to eliminate KS0066 compatibility issues.
I've looked through the PIC18F2550 datasheet and notice 25.10 Single-Supply ICSP Programming, is there any way that the LVP bit has been set and disabled RB5?
PS: Didn't realize until looking at datasheet that default config is for external oscillator, LCD_Test3 code modified for HS oscillator.
|
|
« Last Edit: November 24, 2009, 02:52:04 14:52 by Top »
|
Logged
|
|
|
|
Top
Senior Member
Offline
Posts: 339
Thank You
-Given: 52
-Receive: 1719
|
|
« Reply #47 on: November 25, 2009, 12:44:01 12:44 » |
|
Sorry, checked schematic again and see RA5 needs to be driven low to latch power (thought S1 was a reset then noticed MCLR disabled in code).
LCD_Test.hex - config for external oscillator, modified LCD initialization, no PA5 drive. LCD_Test2.hex - config for external oscillator, new LCD initialization, no PA5 drive. LCD_Test3.hex - config for HS oscillator, new LCD initialization, no PA5 drive. Should work on your demo board but not on project board. LCD_Test4.hex - config for HSPLL_HS oscillator, new LCD initialization, PA5 drive, new timing routines. Should work on your demo board and project board.
All working in Proteus because it doesn't model oscillator config bits.
You still need to check you're using high voltage programming to disable the LVP bit or nothing than uses RB5 will work.
|
|
« Last Edit: November 25, 2009, 01:08:09 13:08 by Top »
|
Logged
|
|
|
|
jcsntoll
Junior Member
Offline
Posts: 46
Thank You
-Given: 24
-Receive: 3
|
|
« Reply #48 on: November 25, 2009, 06:58:54 18:58 » |
|
WOW - FINALLY!!!!!!!! IT's ALIVE!!!!!!!!!
Thank you all SOOOO Much for all your help!
Turns out my Pic+Pro programmer was the problem. I've been using it for years, but mainly stick to the 16F and 12F series.
It said it was programming and verifying the 18f2550, but I guess it wasn't. It says it should be able to work with it, but I can't find much in the way of updates or anything.
I ordered a PICkit 2 and it arrived today. ( got it from ebay, didn't realize Microchip has the PICkit 3 out now ) Inserted the 18f2550 and did an erase and Blank check, then a program of the ORIGINAL hex. Verified it twice, then inserted the chip into the PCB.. applied power, pressed the reset button and TA-DA! Display works, shows the Welcome message, and the setup screen.
WOW!
I'm very sorry for taking up so much of you take, and going though all the code crunching.. Thank you again for all your hard work, and effort. You all rocked!
|
|
|
Logged
|
|
|
|
DarkClover
Active Member
Offline
Posts: 167
Thank You
-Given: 37
-Receive: 60
Still alive...
|
|
« Reply #49 on: November 25, 2009, 11:44:37 23:44 » |
|
Congratulations! Maybe I should change to a new programmer for my AVR too in providence to prevent from such problems Well then have fun with your Battery Monitor
|
|
|
Logged
|
Not thinking means to believe what others say! TRY & ERROR... the fundamental principle our existence is based on
|
|
|
|