16F627 working with an LCD, or not

General discussion on mikroC.
Post Reply
Author
Message
Flying PIC_IT
Posts: 3
Joined: 17 Jul 2005 19:32

16F627 working with an LCD, or not

#1 Post by Flying PIC_IT » 17 Jul 2005 19:52

Hi All,

I'm trying to get a 16F627 to run the lcd_demo that ships with MikroC, and is set up to run with the 16F84A pic. The demo runs fine with the 16F84A pic. (I used an external 4MHz crystal between the OSC1 and OSC2 pins, with a 22pF capacitor between each pin and the +5V supply).
When I recompiled the demo for the 16F627 pic nothing happened on the LCD. The LCD is a 2 × 16 display; a HD47780 clone.

The position of the pins for PORTB on the 627 are a mirror image of those of the 84A, and were changed accordingly. I retained the 4MHz crystal and capacitors, and kept the _HS_OSC configuration flag.

Any ideas as to why the 627 doesn't drive the lcd would be very welcome.

Thanks,

Hugh

Charlie
Posts: 2744
Joined: 01 Dec 2004 22:29

#2 Post by Charlie » 18 Jul 2005 23:47

Hi Hugh,

I have the Latest Version of MC and I did'nt see a 16F84 Example.So I looked in Mb and changed the Pic to 16F628 and recompiled and It worked.What are you using for hardware?And dev. board or a Breadboard
Regards Charlie M.

Flying PIC_IT
Posts: 3
Joined: 17 Jul 2005 19:32

#3 Post by Flying PIC_IT » 19 Jul 2005 09:42

Hi Charlie,

Thanks for your help.

I found lcd_demo.asm in the examples folder in the MikroC program folder. The full path to the folder on my system is
C:\Program Files\Mikroelektronika\mikroC\Examples\P16F84A\lcd_demo.
I'm afraid that I don't know what Mb is.
Software: MikroC to compile and Velleman's Progpic2 to load the hex file.
Hardware: I load the hex file via a Velleman k8048 programming and experimenting board. This board has an external 4 MHz crystal linked to the osc1 and osc2 pins of the 18-pin chip (3rd and 4th pins on the right-hand side, or pins 15 and 16). This external crystal is linked via jumpers that can be removed if required - I've tried with and without the jumpers in place when programming.
I then move the chip to a breadboard, which has a nominal +5V supply. The original supply is a 12V battery. Vss is pin 5 and Vdd is pin 14. An external 4 MHz crystal is used on pins 15 and 16. Two 22 pF capacitors go to the +5V supply. I hold mclr high with a 10K resistor on pin 4. The remaining leads are assigned to the RB pins as shown in the help section in MiKroC. The RW lead is earthed. All leads to the LCD are soldered.

I'm assuming that the breadboard system is okay as the example works with the 16F84 pic, just not the 16F627 pic. I ran a test program (Velleman's demo_two.asm) and the 627 pic worked as expected, so I'm assuming that the pic is undamaged.

Hope that this is of use.

Thanks,

Hugh

Charlie
Posts: 2744
Joined: 01 Dec 2004 22:29

#4 Post by Charlie » 19 Jul 2005 10:47

HI Hugh,

Are you using PortA for Anything? The Bread Board setup is OK sense you have a example that works on it.The only other thing I can think of at the moment is make sure your config fuses are set to HS OSC.
Regards Charlie M.

pizon
mikroElektronika team
Posts: 823
Joined: 11 Oct 2004 08:53

#5 Post by pizon » 19 Jul 2005 11:03

I was unable to find the 627 here, so I tested the LCD example with 628. The only difference between the two is the amount of ROM memory available. I re-compiled LCD example for 627 and downloaded it on 628, and it works. The one thing I encountered, though, is that the configuration flags were often messed-up (the oscillator source in particular). I'm not sure why this happens, this used to be a common (mis)behaviour back in the 1.xx version(s). Anyway, the cure for this is to open the Project settings, click the <Default> button, then <OK>, and re-build the project.
pizon

Charlie
Posts: 2744
Joined: 01 Dec 2004 22:29

#6 Post by Charlie » 19 Jul 2005 11:08

HI Pizon,

I noticed the Problem with the config. Flags too.
Regards Charlie M.

pizon
mikroElektronika team
Posts: 823
Joined: 11 Oct 2004 08:53

#7 Post by pizon » 19 Jul 2005 11:38

I'm not sure what could cause this, and 627/628 are currently the only chips where I spotted this behaviour. 877, 84A, 16Fxxxx, 18F's... all behave normally on this issue, meaning that I have some config flags corrupted (while the Project file says everything is OK) once in about 30-40 builds. :?:
pizon

Flying PIC_IT
Posts: 3
Joined: 17 Jul 2005 19:32

#8 Post by Flying PIC_IT » 20 Jul 2005 15:52

Hi Charlie and Pizon,

Thanks for your support.

Charlie, apart from holding mclr high and the 4MHz crystal, I'm not using portA for anything.

I've retried resetting the config. word, but no change.

:oops: :oops: STOP PRESS!!!!! :oops: :oops:
I feel that I've been wasting your time. I am so sorry.
Thinking that the draw from the pics was so low I've been using a couple of old lead-acid batteries as power sources. Not that these supplies were particularly poor, but I haven't recharged them for a few days or so.

I had a problem with the battery pack that supplies power to the programming board - loads of problems, nothing working. So I recharged it, and low and behold the problems disappeared.

I've just linked the supplies together in parallel, and the 627 worked fine.
Just, perhaps, that I haven't wasted too much of your time, here are a few results from some tests I've just run on the 627.

First I ran the 627 as the 84A was set up, with the same config. word and a 4MHz external crystal. The message was displayed.
I then removed the crystal and the message was not displayed - back to the black rectangles.
I changed the config word to include _INTRC_OSC_NOCLKOUT. Again no message was displayed.
However, on removing the _HS_OSC flag the message was displayed.

I know that this has been a good learning experience for me. I'm sorry for wasting your time. Perhaps ensuring that the power supply is sufficient may be a good tip for others. Now to see if I can get the rest of the project to work.

Yours in embarrassmentand shame,

Hugh

Charlie
Posts: 2744
Joined: 01 Dec 2004 22:29

#9 Post by Charlie » 20 Jul 2005 21:14

HI Hugh,

Dont be embrassed.I'm Just Glad to see you got ot working.You have not wasted My time.I see it as a opportunity to Learn. HAve you thought of investing in a Development Board?The Easypic3 just Came out. :shock:
Im not trying to sell you a board its just a thought.Any way Feel free to ask all the Question you want.:)
Regards Charlie M.

pizon
mikroElektronika team
Posts: 823
Joined: 11 Oct 2004 08:53

#10 Post by pizon » 21 Jul 2005 08:22

Let me quote someone that is more distinguished as a teacher than I am :wink: :
Ask, and it shall be given you; seek, and ye shall find; knock, and it shall be opened unto you:
[Mathew 7:7]
There's ABSOLUTELY nothing you should be ashamed of; you didn't ask us to help you build a weapon. You cannot expect all the people to be friendly, but that must not stop you from asking. That's what this forum is for.
pizon

Post Reply

Return to “mikroC General”