Hi,
I saw this suggested in another thread on this forum to set a PIC to use its internal oscillator:
#config INTRC_OSC_NOCLKOUT
but my understanding is that this will set the PIC to use the internal oscillator at 31.25kHz. How can I use INTOSC with #config to set the internal oscillator on a 16F88 to 8MHz instead, that is, what's the syntax for doing this with #config in GCBASIC? Sorry if that's obvious, I'm a bit new to this! Thanks,
Hank Fletcher.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The best I can deduce is that this ought to accomplish what I want (8MHz internal oscillator on 16F88):
#config OSC = INTI02
although I'm still not sure why it would be "OSC" instead of "FOSC" as it's referred to in the 16F88 datasheet. Is this something done to keep it simple in GCBASIC, and if so, is there somewhere I can refer to the options/syntax for #config? I guess that's what I've been getting at all along! Thanks again,
Hank.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I felt confused in the same way about the configuration bits. Microchip says to look at the individual header files, but they best show the syntax in the Pic Mid-Range MCU Family Reference Manual.
I am going to guess that the configurations given in the GCBasic chipset data folder, are what matter. So from that you would use:
#config INTRC_IO
You wouldn't have to do anything else, as it looks like the default setting in the data folder sets the INTOSC = 8.
I agree the BODEN in the chipdata folder should be BOREN for the 16f88. BOREN must be used on the newer chips.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the tip about the chipdata folder. I'm guessing that while the helpfile on #config is still a work in progress, that users should be directed to the header file on their chip in that folder (as you suggested) to determine the #config options for their mcu, as oppose to the current helpfile which I think directs users to the consult the Microchip datasheet for whatever mcu the user might be using (which I found more confusing).
That said, I'm still a little confused about how this header file works. I tried your suggestion (#config INTRC_IO), but also tried:
#config OSC=INTRC_IO
which when compiled, both resulted in the same .asm file, that is, with the exact same content.
I tried:
#config INTRC_OSC_NOCLKOUT
and on another attempt
#config INTOSC_OSC_NOCLKOUT
but neither would compile (errors with the config setting, of course). The last one is right from the GCBASIC helpfile on configuration, so is it possibly that that's still a legitimate option in the header of some chips, just not in this case the 16F88?
As you've suggested, am I right to think that I ought to check the chipdata header file for whatever mcu I'm using, and look under the [ConfigOps] label for the configuration options as they conform to the GCBASIC syntax? Again, if that's the case and as long as GCBASIC is a work in progress, maybe there ought to directions to that effect in the interim in the helpfile on #config?
Can you tell me why
#config OSC=INTRC_IO
or
#config INTRC_IO
have the same effect, as in why do you not need "OSC="? I know that's splitting hairs as long as it works, I'm just curious how it does. Thanks,
Hank.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Just another question about the default for the internal oscillator: you mentioned the default is
INTOSC = 8
and I see where that is in header, but in case I ever have the desire to, I was wondering if there's a way for me to change INTOSC in GCBASIC to say, 4MHz, without changing the default in the header? I tried to include that after #config (i.e. #config OSC = INTRC_IO, INTOSC = 4), but that doesn't work. Thanks again,
Hank.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Whoops! Just read the release notes for Great Cow BASIC 0.9.3.0, which says:
"Clock frequency of internal oscillators is now set based on the #chip line."
I tested it, and sure enough, it works. So all I need to do to set the INTOSC postscaler to 4MHz is:
#chip 16F88, 4
#config OSC = INTRC_IO
Thanks for watching (and helping) me work through it!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The mhz set the time delay (Wait) routines.
And then you had to set the OSCCON registers internal oscillator too. Like:
OSCCON = 96 'Set internal oscillator to 4 mhz(this was a statement not a config bit).
The help file on the #config directive looks to show the difference between a new GCBasic config syntax or the equally acceptable standard Microchip config syntax.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I saw this suggested in another thread on this forum to set a PIC to use its internal oscillator:
#config INTRC_OSC_NOCLKOUT
but my understanding is that this will set the PIC to use the internal oscillator at 31.25kHz. How can I use INTOSC with #config to set the internal oscillator on a 16F88 to 8MHz instead, that is, what's the syntax for doing this with #config in GCBASIC? Sorry if that's obvious, I'm a bit new to this! Thanks,
Hank Fletcher.
Also, is this a typo?
#config INTRC_OSC_NOCLKOUT
Shouldn't it be #config INTOSC_OSC_NOCLKOUT?
Sorry, I'm just working through it and I'm finding the options/syntax for #config a bit confusing. Thanks,
Hank.
It also says this in the GCBASIC helpfile on configuration bits:
#config INTOSC_OSC_NOCLKOUT, BODEN_OFF
Shouldn't that be:
#config INTOSC_OSC_NOCLKOUT, BOREN_OFF
So... "BOREN_OFF" not "BODEN_OFF"? I'm not nit-picking! I'm just checking things out and trying to figure it all out!
Hank.
The best I can deduce is that this ought to accomplish what I want (8MHz internal oscillator on 16F88):
#config OSC = INTI02
although I'm still not sure why it would be "OSC" instead of "FOSC" as it's referred to in the 16F88 datasheet. Is this something done to keep it simple in GCBASIC, and if so, is there somewhere I can refer to the options/syntax for #config? I guess that's what I've been getting at all along! Thanks again,
Hank.
I felt confused in the same way about the configuration bits. Microchip says to look at the individual header files, but they best show the syntax in the Pic Mid-Range MCU Family Reference Manual.
I am going to guess that the configurations given in the GCBasic chipset data folder, are what matter. So from that you would use:
#config INTRC_IO
You wouldn't have to do anything else, as it looks like the default setting in the data folder sets the INTOSC = 8.
I agree the BODEN in the chipdata folder should be BOREN for the 16f88. BOREN must be used on the newer chips.
Thanks for the tip about the chipdata folder. I'm guessing that while the helpfile on #config is still a work in progress, that users should be directed to the header file on their chip in that folder (as you suggested) to determine the #config options for their mcu, as oppose to the current helpfile which I think directs users to the consult the Microchip datasheet for whatever mcu the user might be using (which I found more confusing).
That said, I'm still a little confused about how this header file works. I tried your suggestion (#config INTRC_IO), but also tried:
#config OSC=INTRC_IO
which when compiled, both resulted in the same .asm file, that is, with the exact same content.
I tried:
#config INTRC_OSC_NOCLKOUT
and on another attempt
#config INTOSC_OSC_NOCLKOUT
but neither would compile (errors with the config setting, of course). The last one is right from the GCBASIC helpfile on configuration, so is it possibly that that's still a legitimate option in the header of some chips, just not in this case the 16F88?
As you've suggested, am I right to think that I ought to check the chipdata header file for whatever mcu I'm using, and look under the [ConfigOps] label for the configuration options as they conform to the GCBASIC syntax? Again, if that's the case and as long as GCBASIC is a work in progress, maybe there ought to directions to that effect in the interim in the helpfile on #config?
Can you tell me why
#config OSC=INTRC_IO
or
#config INTRC_IO
have the same effect, as in why do you not need "OSC="? I know that's splitting hairs as long as it works, I'm just curious how it does. Thanks,
Hank.
Just another question about the default for the internal oscillator: you mentioned the default is
INTOSC = 8
and I see where that is in header, but in case I ever have the desire to, I was wondering if there's a way for me to change INTOSC in GCBASIC to say, 4MHz, without changing the default in the header? I tried to include that after #config (i.e. #config OSC = INTRC_IO, INTOSC = 4), but that doesn't work. Thanks again,
Hank.
Whoops! Just read the release notes for Great Cow BASIC 0.9.3.0, which says:
"Clock frequency of internal oscillators is now set based on the #chip line."
I tested it, and sure enough, it works. So all I need to do to set the INTOSC postscaler to 4MHz is:
#chip 16F88, 4
#config OSC = INTRC_IO
Thanks for watching (and helping) me work through it!
Glad you got it going.
I was about to dis using the configOps syntax as a way of doing things, but see now that is a new GCBasic syntax, and might be more intuitive.
Yea the old way of doing the internal oscillator was to:
#chip chipNumber,mhz
#config INTRC_OSC_NOCLKOUT 'Or whatever oscillator configuration
The mhz set the time delay (Wait) routines.
And then you had to set the OSCCON registers internal oscillator too. Like:
OSCCON = 96 'Set internal oscillator to 4 mhz(this was a statement not a config bit).
The help file on the #config directive looks to show the difference between a new GCBasic config syntax or the equally acceptable standard Microchip config syntax.