Porting glcd from 16F877 to 18F458
Porting glcd from 16F877 to 18F458
2 steps forward and 1 back again.
Because I ran out of room on my 16F877 I upgraded to a 18F458. Sadly my previously working display has now gone dark.
On an oscilloscope I have nice clock and data signals on the pins on the 16F877, on the 18F458 absolute silence.
It's all on port C.
Is there any obvious things I'm missing?
Thanks in advance
swatzy
Because I ran out of room on my 16F877 I upgraded to a 18F458. Sadly my previously working display has now gone dark.
On an oscilloscope I have nice clock and data signals on the pins on the 16F877, on the 18F458 absolute silence.
It's all on port C.
Is there any obvious things I'm missing?
Thanks in advance
swatzy
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Porting glcd from 16F877 to 18F458
Have you toggled a pin at 1Hz and verified its toggling OK?
When displays don't work, especially if it did on a previous target device, I would say issue is either target speed is wrong and/or configuration settings are wrong. Have You made sure watchdog low voltage programming and debug are all disabled?
What about your oscillator settings etc.
If your still struggling, and don't mind sharing. If you post your flowchart, it can be checked for you.
When displays don't work, especially if it did on a previous target device, I would say issue is either target speed is wrong and/or configuration settings are wrong. Have You made sure watchdog low voltage programming and debug are all disabled?
What about your oscillator settings etc.
If your still struggling, and don't mind sharing. If you post your flowchart, it can be checked for you.
Martin
Re: Porting glcd from 16F877 to 18F458
Thanks for your quick response.... Here's some details.
I'm using an EB0006 programmer
XT mode and switch set.
An EB058 and EB057 on Port C
Set up and working as for 16F877 so jumper on B
In project options.. chip set to 18F458
clock speed 19660800
In Chip Config Expert Screen
Oscillator=XT
Osc. Switch Enable=Disabled
Power up Timer=
Brown out Detect=Enabled
Brown out voltage=2
WD timer=Disabled
WD Postscaler=1:128
Stack Overflow Reset=Enabled
Low Voltage Program =Disabled
Background Debug=Disabled
Don't get any compile errors or warnings
I'll test the pins next.
Thanks for input, it's appreciated
swatzy
I'm using an EB0006 programmer
XT mode and switch set.
An EB058 and EB057 on Port C
Set up and working as for 16F877 so jumper on B
In project options.. chip set to 18F458
clock speed 19660800
In Chip Config Expert Screen
Oscillator=XT
Osc. Switch Enable=Disabled
Power up Timer=
Brown out Detect=Enabled
Brown out voltage=2
WD timer=Disabled
WD Postscaler=1:128
Stack Overflow Reset=Enabled
Low Voltage Program =Disabled
Background Debug=Disabled
Don't get any compile errors or warnings
I'll test the pins next.
Thanks for input, it's appreciated
swatzy
- Attachments
-
- Test18F458.fcf
- (12.5 KiB) Downloaded 272 times
Re: Porting glcd from 16F877 to 18F458
hmmmm.... digging down a bit, as advised I tried just looking at 1 output and using the LED example and board (EB-004). Without success, so as suspected I'm guessing I have an issue with the set-up of the PIC.
Any Clues anyone?
Any Clues anyone?
Re: Porting glcd from 16F877 to 18F458
Interestingly the LED example works fine when I change the clock to RC and switch to RC on the board. Has my crystal gone phut?
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Porting glcd from 16F877 to 18F458
Only thing I can suggest is 1) change OSC in configuration menu to HS
2) Make sure jumper next to crystal is on the OSC side and RC/ XTAL switch is in XTAL position.
If it was me I would add:
portA2 high
delay 1 sec
portA2 low
delay 1 sec
loop forever
So if display not working, you can check port A2 (or what ever pin you decide) is going alternately high and low every second.
2) Make sure jumper next to crystal is on the OSC side and RC/ XTAL switch is in XTAL position.
If it was me I would add:
portA2 high
delay 1 sec
portA2 low
delay 1 sec
loop forever
So if display not working, you can check port A2 (or what ever pin you decide) is going alternately high and low every second.
Martin
Re: Porting glcd from 16F877 to 18F458
Using the LED program on Port A I found that the clock option that made it spring into life is HS-PLL enabled (which is a little abstract IMO especially as there is 2 XT options)
The gLCD is still not working, but at least I can see data on the lines (sticking the EB-004 on Port C worked if you don't have a 'scope).
My guess is that the power supply is not quite man enough for the job (it seems to be dragging it down to 13Volts), I'll try something beefier.
Thanks for your help so far Med.
The gLCD is still not working, but at least I can see data on the lines (sticking the EB-004 on Port C worked if you don't have a 'scope).
My guess is that the power supply is not quite man enough for the job (it seems to be dragging it down to 13Volts), I'll try something beefier.
Thanks for your help so far Med.
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Porting glcd from 16F877 to 18F458
If you are using PLL option then timing could still be out. If you select HS-PLL, then clock frequency is running x4 the crystal speed.swatzy wrote:I found that the clock option that made it spring into life is HS-PLL enabled
so if using a 19.66MHz, you will need to set your target speed for 19.66 * 4 = 78643200 (that if I have got my facts straight of course). Since that can't be done, then you have target speed set to a different amount. So if still set for 19.6MHz, your timings could still be wrong, stopping display from working. Can you verify the timing signal with a scope on pulse width setting?
I’m surprised you’re not getting any signals with just HS selected
Can someone please confirm if the above is correct please?
If it was working with the same supply with previous target device, then new target device should not draw that much more current in comparison to stop display from working?swatzy wrote:Sadly my previously working display has now gone dark.
swatzy
Have you got a LCD eblock to try? That also requires timing to be accurate.
One other thing I have noticed. You connections are different from the default.
looking at your gLCD connections:
Reset = C1
Chip Select = C0
Clock = C3
and Data = C5
Data Sheet shows: Should you also have same settings?
or have you re-patched?
Plese note: I have not used gLCD myself, so im by far not an expert on it. So last bit of information about pin settings could be wrong.
Martin
Re: Porting glcd from 16F877 to 18F458
Thanks again for your input med. This is really beginning to test my tenacity!
Here's what I've found -
It's not the power supply - doesn't make any difference.
With regards to clocking I set up a small program to output a squarewave on C0 with a 10uS duty cycle, i measured this at 11uS which I think is acceptable with command clocking.
This was in HS mode and the clock set to 16Mhz.
Sadly I think in my fiddling I've fried my gLCD, the 16F877A program doesn't work now.
with regards wiring, I don't know where you got that patch diagram, can't find it in my docs. I'm pretty confident that the way I have it set up is correct, it used to work and ties in the the SDI outputs on the C-Port.
I'm going to go do some LabVIEW and rebuild my shattered engineering ego!
Here's what I've found -
It's not the power supply - doesn't make any difference.
With regards to clocking I set up a small program to output a squarewave on C0 with a 10uS duty cycle, i measured this at 11uS which I think is acceptable with command clocking.
This was in HS mode and the clock set to 16Mhz.
Sadly I think in my fiddling I've fried my gLCD, the 16F877A program doesn't work now.
with regards wiring, I don't know where you got that patch diagram, can't find it in my docs. I'm pretty confident that the way I have it set up is correct, it used to work and ties in the the SDI outputs on the C-Port.
I'm going to go do some LabVIEW and rebuild my shattered engineering ego!
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Porting glcd from 16F877 to 18F458
Ahh I have just doubled checked and posted the wrong table.swatzy wrote:with regards wiring, I don't know where you got that patch diagram, can't find it in my docs. I'm pretty confident that the way I have it set up is correct,

I meant to have posted this one: Which is from EB058 data sheet.
But your probably right, your settings could be correct, since worked before.
Also they do correspond to the above data sheet.
One thing that puzzels me:
if you are using 19660800Hz crystal on matrix programming board, how comes clock is set for 16MHz? I would have thought that would put the timings out.swatzy wrote:This was in HS mode and the clock set to 16Mhz.
Sorry I can't help you anymore.
I will leave it over to the experts.
Martin