![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
I've just been reading about setting the configuration bits on a 16F88. and it seems from there and a discussion I've been having on another forum that there is a disparity regarding reference to the brown-out configuration. In the 16F88 datasheet it's referred to as "BOREN," but elsewhere, for instance in the .inc headers or configuration bits settings in MPLAB, the same thing is called "BODEN." So is there a typo in the datasheet, or am I witnessing some sort of transition in progress?
Incidentally, I think I've figured out how to set the internal oscillator in code on the 16F88 (_INTRC_IO), but I'm still scratching my head when it comes to how to change the OSCCON register if, for instance, I want to change the internal oscillator to 4MHz. It's no biggie, since I think the default for the internal oscillator is 8MHz, which is fine by me, I'm just curious and was wondering if anyone out there would be willing to enlighten me as to the syntax to do that. Thanks, Hank. Last edited by Hank Fletcher; 25th July 2007 at 05:20 AM. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
For the internal oscillator, you can refer to the datasheet, page 38. You can change the internal oscillator frequency by changing the value of OSCTUNE.
__________________
Superman returns..
|
||
|
|
|
|
|
(permalink) | ||
|
Quote:
Quote:
Code:
movlw 96 movwf SysTemp1 banksel OSCCON movf OSCCON,W banksel SysTemp1 iorwf SysTemp1,W banksel OSCCON movwf OSCCON Last edited by Hank Fletcher; 25th July 2007 at 01:38 AM. |
|||
|
|
|
|
|
(permalink) |
|
Yes, OSCCON can be used. But I think OSCTUNE is useable also.
Besides, you can simplify it to Code:
movlw 96 banksel OSCCON iorwf OSCCON, f Should it be 96? Or it should be .96 or d'96'?
__________________
Superman returns..
|
|
|
|
|
|
|
(permalink) | ||
|
Quote:
Quote:
Last edited by Hank Fletcher; 25th July 2007 at 05:22 AM. |
|||
|
|
|
|
|
(permalink) |
|
I didn't know what Great Cow is, then I just did a quick search from google
__________________
Superman returns..
|
|
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
|
|
(permalink) | ||
|
Quote:
http://ww1.microchip.com/downloads/e...tes/00244A.pdf Quote:
__________________
Superman returns..
|
|||
|
|
|
|
|
(permalink) | ||
|
Quote:
Quote:
If you open "PIC16F628A.inc", for example, that's said explicitly. |
|||
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
|
|
(permalink) |
|
The change is evident for later silicon revisions, that's why I mentioned the PIC16F628A. The sentence I quoted is from a "Migration document". Since there aren't any revisions for the 16F88, you'll very likely find nothing about the BODEN/BOREN terminology in its datasheet.
If you're familiar with the new terminology, why not defining an 'alias' in your programs? Link: http://ww1.microchip.com/downloads/e...Doc/40048a.pdf Last edited by eng1; 25th July 2007 at 09:16 PM. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
The whole BODEN/BOREN thing is just something I saw starting out and said, "Wait a second, that's different - why?" If you're someone like me, you try to explore it till you understand it, because you don't know if it's going to end up biting you in the end. Unfortunately, there are times (like this) where the explanation makes you wonder whether the drama was worth it all, but I still think it's good practice to explore the things you're curious about when they strike you, if you have the time. Last edited by Hank Fletcher; 25th July 2007 at 12:20 PM. |
||
|
|
|
|
|
(permalink) |
|
Hi Hank,
The default OSCCON setting on all reset conditions including power up reset is -000 0000 (from Table 2-1: Special Function Register Summary). This corresponds to an INTOSC frequency of 31.25 KHz (from Register 4-2: OSCCON: Oscillator Control Register). I've never had to change the OSCTUNE setting from the factory calibrated default on a 16F88. Not sure how you'd setup OSCCON using Great Cow but here's an assembly language example that may help (below); Have fun. Regards, Mike Code:
bsf STATUS,RP0 ; select Bank 1 |B1
clrf ANSEL ; setup PORT A digital I/O |B1
clrf TRISA ; setup PORT A all outputs |B1
movlw b'01110000' ; |B1
movwf OSCCON ; select 8-MHz INTOSC clock |B1
STABLE btfss OSCCON,IOFS ; Int Osc Freq Stable bit set? |B1
goto STABLE ; no, branch and wait |B1
bcf STATUS,RPO ; select Bank 0 |B0
|
|
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|