Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 14, 2024, 10:44:27 22:44


Login with username, password and session length


Pages: 1 2 3 [All]
Print
Author Topic: LCD Special Characters  (Read 15169 times)
0 Members and 1 Guest are viewing this topic.
jcsntoll
Junior Member
**
Offline Offline

Posts: 46

Thank You
-Given: 24
-Receive: 3


« on: November 10, 2009, 07:05:26 19:05 »

Hello,

I have been talking with people in the PROJECTS forum about an Intelligent battery monitor.
http://www.sonsivri.com/forum/index.php?topic=23705.0

I'm told the source code shows the LCD is being loaded with double sized characters.
The original design calls for a KS0066 display, ( hard to find here in the USA. ) and the more common HD44780
is unable to use those special characters.

I've looked over the code, but it has been about 20 years since I programmed in C, and never have with a Pic and LCD.

Is it possible to convert the code to use standard characters so that it is compatible with the HD44780 display?
Or does the code have to be totally re-written ?
http://rapidshare.com/files/257890816/High_Current__High_Voltage_Battery_Capacity_Meter.rar

Thanks!
Logged
DarkClover
Active Member
***
Offline Offline

Posts: 169

Thank You
-Given: 37
-Receive: 60


Still alive...


« Reply #1 on: November 10, 2009, 08:10:04 20:10 »

What exactly do you mean with "double sized characters" ?
Is it the 5x11 dots function ?
The HD44780 is nearly 99% compatible with the KS0066.

Maybe these double size chars are custom generated ones
and you just have to change the RAM-Adress to fit them on
a HD44780 controlled display (I just flow over the KS0066 datasheet)
or if they use some block chars integrated in the ROM they may
have another adress within the HD44780.
I don't think you have to change the code but I'll have a look when
I downloaded it (less free download slots now)
Logged

Not thinking means to believe what others say!
TRY & ERROR... the fundamental principle our existence is based on
DarkClover
Active Member
***
Offline Offline

Posts: 169

Thank You
-Given: 37
-Receive: 60


Still alive...


« Reply #2 on: November 11, 2009, 01:16:05 13:16 »

I skimmed the codes LCD part and I can't see anything
special in the routines. It should work with any usual
HD44780(and compatible) 16x2-LCD too without any problems.
Just give it a try. Otherwise tell me please.

Which program has been used to make those
nice PCB and mechanical illustrations ?
« Last Edit: November 11, 2009, 01:27:58 13:27 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 Offline

Posts: 46

Thank You
-Given: 24
-Receive: 3


« Reply #3 on: November 11, 2009, 05:50:32 17:50 »

Hmmm...    I'm not sure what program was used to make the drawings.
This is from a Silicon Chip Magazine article. ( June/July 2009 )

My display only shows the first line full of blocks. 
I've triple checked the wiring.  I had to connect my HD44780 differently because it has a pin out of 1 - 16 left to right.
Where the KS0066 display they use on the project has a pin out of 14 - 1,16,15 left to right.
With each number being the same.. ( ie. 16,15 backlight,  14 - D7, 13 - D6...... )

As for the special characters I was going by what PicKit2 said in the Projects thread..
Quote
Looking at the code, I see that the programmer uses a load of special grafics that are sent to the display,(ie double sizeds caractors)  is this your problem? your display can't have these in memory.

Personally I couldn't find where it was loading any special graphics but I do not know C that well.
I know the program is running, because it holds the power regulator chip to +5v ( normally at 3v in sleep mode )
and it turns on the back light, and after a few moments slowly dims it until a button is pressed then it turns it back on.

I've tried a couple different displays, but get the same result.  I'm really stumped here.
I really appreciate your help,
Logged
DarkClover
Active Member
***
Offline Offline

Posts: 169

Thank You
-Given: 37
-Receive: 60


Still alive...


« Reply #4 on: November 12, 2009, 05:11:37 17:11 »

Okay if your display only shows one line of blocks it won't be initialized.
Make a test with a simple display code and write some text on it to check if there is no other problem.
Like: http://www.piclist.com/techref/io/lcd/4b16x2lcd-ab.htm
Then connect it again as defined in the schematic. (maybe use 10k pulldown for the ENABLE pin)

then have a look for the contrast. I had a problem where the display didn't show anything and it took a while till i checked
that my contrast voltage was to low Smiley (The blocks were shown before initialisation too)

A little tip for the contrast:
Don't connect the potentiometer to VCC too without some savety constructions (e.g. current regulation resistor).
It's because you can burn up the display if you come to close to VCC. It should work the same way if you just control
the contrast to GND and you don't need savety.

Do you hear the beep when you switch on the circuit ?
It should come before the display is initialized. If that works Put the initBeep(); inside the initSequence-function after the initLCD(); call.
If the beep comes and the display still don't work quad check the connections.
Logged

Not thinking means to believe what others say!
TRY & ERROR... the fundamental principle our existence is based on
TomJackson69
Active Member
***
Offline Offline

Posts: 218

Thank You
-Given: 26
-Receive: 63


« Reply #5 on: November 14, 2009, 04:33:40 16:33 »

jcsntoll ,

Since you have the LCD displayed on the first line then I think it is timing problem. If you could increase the delay between LCDE = 0 and LCDE = 1.

Look at the main display routine:

"

volatile void writeLCD(byte data, byte command)
{
      int i;
      byte firstdata;
      byte seconddata;
      byte interrupt;
   
      firstdata=swapBits(data);
      seconddata=swapBits(data<<4);
      LCDE=0;
      if(command==LCDCOMMAND)LCDRS=0; else LCDRS=1;
      PORTB=firstdata;
      interrupt=INTCONbits.GIE;
      INTCONbits.GIE=0;
      _asm
          nop
          nop
      _endasm
      LCDE=1;
      _asm
         nop
         nop
      _endasm
      LCDE=0;
      PORTB=seconddata;
      _asm
          nop
          nop
         nop
         nop
      _endasm
      LCDE=1;
      _asm
         nop
         nop
      _endasm
      LCDE=0;
      PORTB&=scanLn;
      _asm
          nop
         nop
          nop
      _endasm
      if(interrupt)INTCONbits.GIE=1;
      for(i=0; i<LCD_DELAY; i++)
      {   
         _asm
            nop
            nop
         _endasm
      }
}

"
You see lot of "NOP". I think if you increase the delay here, it could help. Try this:

      _asm
             nop
             nop
             nop
             nop
             nop
             nop
             nop
             nop
      _endasm


You can put more or less NOP until you see the display stable.

Since the LCD already show some char on the first line, then contrast is OK. Double size char would not display on one line, unless you custom the double size char to disolay on two lines; which is less likely in this case. I think the designer of this project is use ROM char build-in.

So, goto "volatile void writeLCD(byte data, byte command)" function to change the delay to see if it works. I wish I have more time to look at the program in depth. I will check back to see if you have solve the problem.

Here is a good macro to use:
#ifndef    Nops
   #define Nops(NumTime)  __asm__ volatile(".rept " #NumTime "\n\t nop\n\t .endr")
#endif


Example of use: Nops(10);   // it will insert 10 "nop" in to your program

In the function above, replace all the:

      _asm
             nop
             nop
             nop
      _endasm

with: Nops(10);    // 10 or 12 or 8 or whatever number of nop to get the LCD display.


Use this macro will reduce typing. Remember to put this macro in the header "batterymeter.h" or on the other header.


Good luck,

Tom

« Last Edit: November 14, 2009, 04:47:54 16:47 by TomJackson69 » Logged

Con Rong Chau Tien
DarkClover
Active Member
***
Offline Offline

Posts: 169

Thank You
-Given: 37
-Receive: 60


Still alive...


« Reply #6 on: November 14, 2009, 09:42:26 21:42 »

Does it work now with the tryouts and changed timings ?
If not it could maybe be some problem with the PCB (if you have done one)
maybe there is a little cut in there.
Logged

Not thinking means to believe what others say!
TRY & ERROR... the fundamental principle our existence is based on
TomJackson69
Active Member
***
Offline Offline

Posts: 218

Thank You
-Given: 26
-Receive: 63


« Reply #7 on: November 14, 2009, 10:07:21 22:07 »

jcsntoll ,

After my last posted, I have a though about the project. Since, this is a nice project and was public as an artical then, I think the project has to work. The display problem could cause by wiring error?

I think it is better to check out the LCD on a different circuit to make sure the LCD is not a problem. As you have mention that the program is running but the LCD is not. Also, try to check the wiring from the PIC to the LCD, line by line, and all the pins from the LCD to PIC and ground.

Try to solve the LCD problem before edit the software may be the right way. Let me know how it come out.

Tom
Logged

Con Rong Chau Tien
jcsntoll
Junior Member
**
Offline Offline

Posts: 46

Thank You
-Given: 24
-Receive: 3


« Reply #8 on: November 15, 2009, 01:09:45 01:09 »

Thank you everyone one.

I think it has to be a programming issue, something in the init maybe.

I have verified the LCD, and the PCB.
I also agree with your logic of this being a public project..  but the article calls for the KS0066 LCD ( with a weird pin out )
 I do not have any of those, so I'm using a HD44780 with a standard pin out.
I've made a cable to connect the PCB and LCD.. and have verified continuity.
I also agree since the first row is blocks, the power and contrast are correct.

I will try adding the NOP commands, as well as maybe look at the init of the LCD itself.
Thanks for your help, and I will post my results.
Logged
jcsntoll
Junior Member
**
Offline Offline

Posts: 46

Thank You
-Given: 24
-Receive: 3


« Reply #9 on: November 15, 2009, 09:30:10 21:30 »

Well I feel silly.


Could someone help me compile this?   I downloaded both MPLAB C18 ( as stated in the source )
and installed it into MPLAB IDE.

I'm not sure the steps I need to do to compile this into hex so I can load it.
Logged
TomJackson69
Active Member
***
Offline Offline

Posts: 218

Thank You
-Given: 26
-Receive: 63


« Reply #10 on: November 16, 2009, 05:52:43 05:52 »

jcsntoll,

Go to the directory that you unziped the project.
Let say:"\111429_Battery_Capacity_Meter_Software_Version_7.30\Battery Capacity Meter"

In this dirctory you will see two file for the project: "Battery Capacity Meter.Microchip MPLAB. project" and "Battery Capacity Meter.Microchip MPLAB.workspace".

Double click on the "Battery Capacity Meter.Microchip MPLAB.workspace" and you will be in the MPLAB IDE with Battery Capacity Meter project.

I think this project is already setup so you just go to Project > Buildall. The new HEX file will be create in the same project directory if compiled without error.

Good luck,

Tom
Logged

Con Rong Chau Tien
jcsntoll
Junior Member
**
Offline Offline

Posts: 46

Thank You
-Given: 24
-Receive: 3


« Reply #11 on: November 16, 2009, 03:13:05 15:13 »

That's what I figured, but something must not be correct.
All I get is a bunch of .pre and .o files.

also I noticed in the configs that there is a batch file that is called when the compile is complete.
( just copies a file into the PC software folder.  that is not being called either )

wow I never expected this project to be so much trouble.
Logged
TomJackson69
Active Member
***
Offline Offline

Posts: 218

Thank You
-Given: 26
-Receive: 63


« Reply #12 on: November 16, 2009, 04:24:44 16:24 »

jcsntoll,

I have modified the "volatile void writeLCD(byte data, byte command)" routine with some more delay. See below:

Code:
volatile void writeLCD(byte data, byte command)
{
int i;
byte firstdata;
byte seconddata;
byte interrupt;

firstdata=swapBits(data);
seconddata=swapBits(data<<4);
LCDE=0;
if(command==LCDCOMMAND)LCDRS=0; else LCDRS=1;
PORTB=firstdata;
interrupt=INTCONbits.GIE;
INTCONbits.GIE=0;
// _asm
//    nop
//    nop
// _endasm
DelayStrobe();
LCDE=1;
// _asm
// nop
// nop
// _endasm
DelayStrobe();
LCDE=0;
PORTB=seconddata;
// _asm
//    nop
//    nop
// nop
// nop
// _endasm
DelayStrobe();
LCDE=1;
// _asm
// nop
// nop
// _endasm
DelayStrobe();
LCDE=0;
PORTB&=scanLn;
// _asm
//    nop
// nop
//    nop
// _endasm
DelayStrobe();
if(interrupt)INTCONbits.GIE=1;
for(i=0; i<LCD_DELAY; i++)
{
// _asm
// nop
// nop
// _endasm
DelayStrobe();
}
}

And here is the "DelayStrobe()"

Code:
void DelayStrobe(void)
{
_asm
   nop
nop // Increase or decrease to make it works
   nop // This is about 4uS delay
   nop
nop
   nop
   nop
nop
   nop
   nop
nop
   nop
   nop
nop
   nop
   nop
nop
   nop
   nop
nop
   nop
_endasm
}

I compiled with some warning (suspicious pointer conversion) which is the way the the owner of this project was using ROM char ....

Anyways, here is the HEX file you can try out to see if it works. Use the above modified routine in your project to compile. The project can be compile as it.



Tom
« Last Edit: November 16, 2009, 04:36:06 16:36 by TomJackson69 » Logged

Con Rong Chau Tien
jcsntoll
Junior Member
**
Offline Offline

Posts: 46

Thank You
-Given: 24
-Receive: 3


« Reply #13 on: November 16, 2009, 06:42:41 18:42 »

Thank you very much.. I think I must have something installed wrong or not setup correctly with the compiler.
Not sure,  I've never compiled C with MPLAB.

I will try the new Hex tonight when I get home..   Sorry for being such a Noob!  I never expected this project
to be so much work! haha
Logged
DarkClover
Active Member
***
Offline Offline

Posts: 169

Thank You
-Given: 37
-Receive: 60


Still alive...


« Reply #14 on: November 16, 2009, 09:30:15 21:30 »

Nah everybody is a noob in his own way, just try try try.

How is it now with the whole thing ?
Does it work ? Does the display as it should Smiley
Logged

Not thinking means to believe what others say!
TRY & ERROR... the fundamental principle our existence is based on
jcsntoll
Junior Member
**
Offline Offline

Posts: 46

Thank You
-Given: 24
-Receive: 3


« Reply #15 on: November 17, 2009, 03:01:58 03:01 »

GRRrrrr..  Same result.

I have RE-verified the wiring.

Could I trouble you for a hex that just holds RA5 low ( two turn on the regulator )
and does the most simple LCD init, and just writes "Testing" or something on the display?
Just to prove the display works ok, or not.

Logged
DarkClover
Active Member
***
Offline Offline

Posts: 169

Thank You
-Given: 37
-Receive: 60


Still alive...


« Reply #16 on: November 17, 2009, 04:02:16 16:02 »

Connect RA5 directly or over a 1k resistor with GND. This should enable LM257.
Then comment everything inside the initSequence except initLCD(); (it should work too).

And replace the original void main(void){.... with this:
I'm not a pro at PIC but it should work.

Code:
void main(void)
{
byte key;
byte scrollingMode;

TRISC=INIT_TRISC;
TRISB=INIT_TRISB;
PORTC=0;
PORTB=0;
delayMs(100);
initSequence();
writeStringLCD(0, (rom char*)"Test Test 1.2.3");

while(1){}
}
Logged

Not thinking means to believe what others say!
TRY & ERROR... the fundamental principle our existence is based on
jcsntoll
Junior Member
**
Offline Offline

Posts: 46

Thank You
-Given: 24
-Receive: 3


« Reply #17 on: November 18, 2009, 06:09:59 18:09 »

Thanks DarkClover,
But I seem to be missing something with the compiler.

I've installed MPLAB IDE, and MC18, and they are linked together as far as I can tell.
When I click the Build All button, it greys out for a bit, like it's working. Then returns.
When I check my project folder I have some .o files but I do not have a .hex or .asm file at all.
Am I missing a step or software??

Sorry I'm sure this question belongs in another topic.

Maybe I'll try and write a simple PicBasic code to test it, and confirm the wiring and LCD connections.
If I knew were I could find the LCD the project calls for here in the states, I would just order it and be done with it.
But the one they list from Altronics would cost over $50USD after shipping and things.
Logged
DarkClover
Active Member
***
Offline Offline

Posts: 169

Thank You
-Given: 37
-Receive: 60


Still alive...


« Reply #18 on: November 18, 2009, 07:26:57 19:26 »

ummm maybe could you send me the makefile from the Pic C-compiler?
At the AVR C-compiler there is often a line in the makefile which has a
delete command for the hex.

I can't believe that the problem is the controller of the display but
I'll disabuse myself.

At the weekend I'll give it a try to translate the codepart for the LCD to
AVR and try it. Maybe there is really just a timing problem as TomJacksn said.
By the way, at which speed does your PIC run (real speed)?
Logged

Not thinking means to believe what others say!
TRY & ERROR... the fundamental principle our existence is based on
TomJackson69
Active Member
***
Offline Offline

Posts: 218

Thank You
-Given: 26
-Receive: 63


« Reply #19 on: November 19, 2009, 08:32:15 20:32 »

jcsntoll,

Can you post your circuit so I have a look. The reason is that may be the connection is not right; since you have said the LCD you are using is different than the one in the project.

Just show the part that the PIC is connected to the LCD and all 14 pins (or 16 pins) of the LCD. Since  most HD44780 LCD controller have compatible connection.

After you post part of your circuit (specially the LCD connection) I will write a routine for just test the LCD. I think that will help. Right now, even I want to write a routine, I still don't know how is your connection (4 bits or 8 bits). Make sure you give the information of the LCD too (pin out...).

So, in conclusion, I need pin out of the LCD, pin connection fron PIC to LCD and all other pins from the LCD connected to where. Also the crystal speed.

Tom
Logged

Con Rong Chau Tien
jcsntoll
Junior Member
**
Offline Offline

Posts: 46

Thank You
-Given: 24
-Receive: 3


« Reply #20 on: November 21, 2009, 02:39:19 02:39 »

Sure thing Tom,  If you go to the Altronics site and look up the datasheet for the KS0066 LCD they call for in the project,
http://www.altronics.com.au/index.asp?area=item&id=Z7013

You can see the pin out is strange for a LCD.  starting from the left it runs 14 - 1, 16,15
Where must LCD's run 1-14,15,16.

So I wired mine to match, Power,Gnd, E, RW, D4-D7...
It's just a generic LCD with HD44780 and backlight..  the back light works great.. Auto dim works and re-lights when a key is pressed.

The processor is a PIC18F2550, running with a 20Mhz crystal..

Also I think the build fails before it completes, but I'm not sure why.. attached is the error file.
Logged
TomJackson69
Active Member
***
Offline Offline

Posts: 218

Thank You
-Given: 26
-Receive: 63


« Reply #21 on: November 21, 2009, 07:28:40 19:28 »

jcsntoll,

I have looked the output file and see only warning. You have not show the complete output file. Is it successfull compiled? or error?

If it is error then show the error message. May be linker error or missing file due to wrong setup of the Library Search Path ets...

Go to Project/Build Option/Project then
Go to Directories and select where the MCC18 directory is locate. May be you are missing the "c018iz_e.o" file. This file is located at "C:\Program Files\Microchip\MC18\lib". You can go to this dir and copy this file to your project dir (it will be default search dir.

Anyways, show complete compiled output file, it show something about why compiled error.

I don't have Rapid Share account so I can not up load the whole project for you. In few more day when I have time, I will spend more time on your project problems.

Before I get off, I want you to try one thing. Try to take the keypad out of the circuit to see if the display will display. Because the 4 line of the keypad is connected to the 4 data line to the LCD via the diodes. Remove the keypad to see how it works (ofcourse you have no keypad). If you don't want to remove the keypad then disconnect one end of the diode (4 of them, I think D2-6). This should give the LCD 4 data lines without the keypad interfear. The LCD from Allelectronic is just a standard 16x2 LCD and should work with the way the "IniLCD routine" initialize (4 data line, 2 line). Like you said, the system is working then there must be TIMING or CONNECTION problem (maybe both, I doubt it).

Tom
« Last Edit: November 21, 2009, 07:42:36 19:42 by TomJackson69 » Logged

Con Rong Chau Tien
jcsntoll
Junior Member
**
Offline Offline

Posts: 46

Thank You
-Given: 24
-Receive: 3


« Reply #22 on: November 21, 2009, 09:09:23 21:09 »

I must have something setup or installed wrong. I'm not sure what.
I have MPLAB installed with MCC18.  I have MCC18 toolset with correct path names selected as the
Language Toolsuite.

But when I click build all, all that gets created are a series of .o files
( main.o, and 9 usb files )

That's it, I'm not sure what you expect for the output file.  I've attached the main.o but not sure if that's what you
are asking for.

I have tried the project without the keypad and I get the same result.
I really appreciate everyones help with this.  

I've tried to build this project in Proteus, but my computer does not seem to have the resources to run it.
( using the original hex )
« Last Edit: November 21, 2009, 09:11:30 21:11 by jcsntoll » Logged
oldvan
Senior Member
****
Offline Offline

Posts: 372

Thank You
-Given: 154
-Receive: 107


If the van is a Rockin'...


WWW
« Reply #23 on: November 21, 2009, 10:33:59 22:33 »

I took a look at main.o, it is not inteded to be human-readable but may still hold a few clues.

It is possible the length of the path you to your project is a problem to the compiler,
E:\Documents and Settings\Administrator\Desktop\111429_Battery_Capacity_Meter_Software_Version_7.30\Battery Capacity Meter\
is awfully deep.  

It couldn't hurt to try placing the project in c:\pic\meter\ and seing if it compiles there.

Spaces in file names can also cause confusion for some programs, but that is rare these days.
« Last Edit: November 21, 2009, 10:36:31 22:36 by oldvan » 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 Offline

Posts: 218

Thank You
-Given: 26
-Receive: 63


« Reply #24 on: November 21, 2009, 11:44:55 23:44 »

jcsntoll,

Sorry for the comfusing. The output file I am talking about is the output screen when you build the project (in the window OUTPUT/Build). Just like the first one you posted but more detail. At the end of build, it will tell you whether the project is build successfull or fail. Try this, click Project/Build All and then copy the constent of that output window to a file. If you post that file, I think I can see what is wrong. If you are able to compile your project with successfull then it is easier for you to debug.

If you already build the circuit in Proteus, post that project file, I can run on my computer to see if it will display.

Regards,

Tom
Logged

Con Rong Chau Tien
jcsntoll
Junior Member
**
Offline 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 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 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. Tongue

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 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 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 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 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 Offline

Posts: 169

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 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 Offline

Posts: 833

Thank You
-Given: 312
-Receive: 392



WWW
« 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 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 Offline

Posts: 372

Thank You
-Given: 154
-Receive: 107


If the van is a Rockin'...


WWW
« 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 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 Offline

Posts: 339

Thank You
-Given: 52
-Receive: 1718


« 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 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 Offline

Posts: 169

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 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 Offline

Posts: 339

Thank You
-Given: 52
-Receive: 1718


« 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 Offline

Posts: 2430

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 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=2201
Seems 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 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 Offline

Posts: 339

Thank You
-Given: 52
-Receive: 1718


« 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 Offline

Posts: 339

Thank You
-Given: 52
-Receive: 1718


« 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 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 Offline

Posts: 169

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 Smiley
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
Ichan
Hero Member
*****
Offline Offline

Posts: 833

Thank You
-Given: 312
-Receive: 392



WWW
« Reply #50 on: November 26, 2009, 03:54:11 03:54 »

Nice to know, this is the confirmation that the original hex file is working.

How about sharing your experience with compiled source code? Would be glad to hear that.

-ichan
Logged

There is Gray, not only Black or White.
TomJackson69
Active Member
***
Offline Offline

Posts: 218

Thank You
-Given: 26
-Receive: 63


« Reply #51 on: November 26, 2009, 06:43:19 06:43 »

Very good to hear your problem is solved.

Congratulations,

Tom
Logged

Con Rong Chau Tien
Pages: 1 2 3 [All]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC