OSCCON with 16F886 & 18F2620

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
Ron
Posts: 225
Joined: Wed Apr 11, 2007 6:15 pm
Has thanked: 2 times
Contact:

OSCCON with 16F886 & 18F2620

Post by Ron »

Hi,

I have had a bootloader written for me by a person in Romania, what a mistake. He was able to get the external OSC for 4 & 20 MHz very easy. After several failed attempts at the 8MHz internal I am concerned. He has only gotten the 4MHz to work and I had to set OSCCON to 0x70 to get it to behave like 8MHz with timing of blinking LED.

The datasheet for 16F886, page 62 talks about bit 1 & bit 2. HFINTOSC is stable = 1, not stable = 0.

Are these reported back to me or must bit 2 bet set to 1 in order to make it stable for 8MHz????

In the bootloader code I have found an area where I think the programmer is setting OSCCON to 0x70 (see below) which, I think this would put the bootloader in 8MHz mode.

Is changing OSCCON from whatever the default is, to 0x70 the proper way for the bootloader to run at 8MHz?

In my code can I change the OSCCON to = 4MHz and have it replace his values?

It also looks to me like he is clearing the OSCTUNE register?

Will I be able to set the OSCTUNE register in my program ans have it replace his?

Here is the code, there is also a line in the code that looks like a binary pattern being used, can anyone tell me what this is doing?

StartBoot bcf INTCON,GIE
call bank1
movlw 0x70
movwf OSCCON
clrf OSCTUNE

bsf TXSTA,BRGH
bcf TXSTA, SYNC
movlw UsartCt
movwf SPBRG
call bank0
movlw b'10010000'
movwf RCSTA
movlw 0x55
call Transmit
movlw 0xAA
call Transmit

movlw d'100'
movwf cont3

I know this is not your products or any issues with Flowcode, I only hope to you can help me out.

Thank you,

Ron

Post Reply