Just getting started with a 18F45K20 on a 44 pin eval bd. No matter what clock speed I try after declaring the chip, my wait timer is half what it should be. If I 'wait 10sec' the LED is lit for just 5 seconds.
I have tried adding various forms of:
config osc=int
without any luck. Can someone give me some help? Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Everything compiles fine, but my 'wait 10 sec' are still just 5 seconds long!
I have tried 1,2,4,10,16,32 instead of 8 after the #chip 18F45k20. All variations compile, but my LED only blinks on and off for 5 seconds for the 1,2,4,or 8 values. Above 8 it compiles but doesn't run at all.
Thanks for any and all suggestions.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hugh,
I replaced the old system.h with the new one in your link. There were no changes in the PIC timimg, so I rebooted my PC and tried again, but still no changes.
Can I try something else/or other config setting?
Thanks for all your help and effort.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've just made another change to the system.h file, which hopefully will do something. Please try again (same link as above) and see if it is any better!
I think this issue is particular to the 18FxxK20 family, which have some slightly different bit names to most other chips.
(Shouldn't need to restart your PC, GCBASIC should pick up the new file as long as it's in the right place!)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hugh, Should I replace my existing demos with the new?
I got the timer working, went back to the 18F45K20 datasheet and saw where the OSCCON register is used to determine a bunch of oscillator settings.
#chip 18F45K20,16
OSCCON = 118
seems to clear up my timing issue. Thanks for all your help with this.
My next issue is that my standard 2 x 16 LCD that was working fine on my 28 pin demo board doesnt work with my 44 pin demo board. I have the following LCD config code:
One thing I need to check is that the 28 pin demo bd and LCD was running off 5 v. This new 44 pin demo bd is 3.3 volt. Perhaps my (Hitachi HD44780)LCD bd is 5v only? Will need to dig out the specs if I can find them.
Any suggestions for a 2 x 16 LCD that works well on 3.3V?
Thanks again to all for your help.
Last edit: Anobium 2015-02-08
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have used the LCD with the Hitachi HD44780 controller with a 3.3v pic. The way this worked for me was that the power to the lcd (pin2) and the contrast control (using 10k variable resistor to pin 3), were at 5v and the 6 data lines (RS, EN, D4, D5, D6, D7) were connected to the 3.3v pic. Worked just fine!
Last edit: viscomjim 2015-02-09
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
visco,
I tried the same thing (lcd tied to 5v, all interface lines tied to 3.3 v pic chip). It locked up the chip and wouldnt run. I purchased a 3.3 backlit 2 x 16 from sparkfun and it worked fine. Thanks for all the suggestions!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Just getting started with a 18F45K20 on a 44 pin eval bd. No matter what clock speed I try after declaring the chip, my wait timer is half what it should be. If I 'wait 10sec' the LED is lit for just 5 seconds.
I have tried adding various forms of:
config osc=int
without any luck. Can someone give me some help? Thanks!
I think on these type of chips (18F) the config needs to be
OSC=INTIO67
Whatever that is supposed to mean.
You can find these values in the GCBasic chipdata file.
INTIO67 means internal oscillator and B6, B7 are I/O pins.
I use the 18F26K22 (I believe from the same family) and can confirm that INTIO67 works fine when using the internal oscillator block.
Peter.
I have the following header code:
chip 18F45K20,8
config OSC = INTIO67
Everything compiles fine, but my 'wait 10 sec' are still just 5 seconds long!
I have tried 1,2,4,10,16,32 instead of 8 after the #chip 18F45k20. All variations compile, but my LED only blinks on and off for 5 seconds for the 1,2,4,or 8 values. Above 8 it compiles but doesn't run at all.
Thanks for any and all suggestions.
Please send me a personal message and I will provide a release that has some fixes for your chip.
There was an issue with the some of the automatic initialisation code for the internal oscillators on some PIC chips. They were fixed just the other day, try replacing your copy of system.h (in include\lowlevel) with the one from https://sourceforge.net/p/gcbasic/code/HEAD/tree/GCBASIC/trunk/include/lowlevel/system.h?format=raw and see if that helps!
Hugh,
I replaced the old system.h with the new one in your link. There were no changes in the PIC timimg, so I rebooted my PC and tried again, but still no changes.
Can I try something else/or other config setting?
Thanks for all your help and effort.
Here is my config for a 18f26k20 way back in 2009. Had problems with INTIO67 back then too it would appear?
I've just made another change to the system.h file, which hopefully will do something. Please try again (same link as above) and see if it is any better!
I think this issue is particular to the 18FxxK20 family, which have some slightly different bit names to most other chips.
(Shouldn't need to restart your PC, GCBASIC should pick up the new file as long as it's in the right place!)
Kent,
I tried your #config OSC= HSPLL but no changes. Thanks for your post, though.
Hugh, tried the latest system.h, again no changes.
Heading out for a few hours, will try the code you sent via email then.
Thanks!
Hugh, Should I replace my existing demos with the new?
I got the timer working, went back to the 18F45K20 datasheet and saw where the OSCCON register is used to determine a bunch of oscillator settings.
seems to clear up my timing issue. Thanks for all your help with this.
My next issue is that my standard 2 x 16 LCD that was working fine on my 28 pin demo board doesnt work with my 44 pin demo board. I have the following LCD config code:
One thing I need to check is that the 28 pin demo bd and LCD was running off 5 v. This new 44 pin demo bd is 3.3 volt. Perhaps my (Hitachi HD44780)LCD bd is 5v only? Will need to dig out the specs if I can find them.
Any suggestions for a 2 x 16 LCD that works well on 3.3V?
Thanks again to all for your help.
Last edit: Anobium 2015-02-08
We need to get this sorted in the compiler. I know Hugh is looking into this issue.
Regarding the LCD. It depends. You would have to check the datasheet for the operating voltages - there are many, many different LCD on the market.
For you current LCD try setting the following, it may work.
And, what is the release date for your GCBASIC.EXE compiler?
Re: 'Should I replace my existing demos with the new?' - no sure what you mean. Do you mean the new demo's?
I appear to be running version 0.8.3697.40784 created June 13, 2013.
Adding #define LCD_SPEED SLOW helped with the writing to the LCD - Thanks
The LCD still has almost no contrast at 3.3v. I found and ordered a couple new LCDs that are claimed to be 3V compatible.
Thanks again for everyone's help. This is a great site with quick, knowledgeable contributors.
Hopefully the OSCCON =118 info will help others getting started with the 18F45K20 44 pin demo bd oscillator issue.
Hello James,
I have used the LCD with the Hitachi HD44780 controller with a 3.3v pic. The way this worked for me was that the power to the lcd (pin2) and the contrast control (using 10k variable resistor to pin 3), were at 5v and the 6 data lines (RS, EN, D4, D5, D6, D7) were connected to the 3.3v pic. Worked just fine!
Last edit: viscomjim 2015-02-09
visco,
I tried the same thing (lcd tied to 5v, all interface lines tied to 3.3 v pic chip). It locked up the chip and wouldnt run. I purchased a 3.3 backlit 2 x 16 from sparkfun and it worked fine. Thanks for all the suggestions!