Hi i'm using INTRC with 16F88 @ 8 MHz.
Is there a way to check (in the pic program) that internal clock is really at 8MHz ?
I have some problems with usart at 38400 and I think is due to wrong data rate clock.
Thank you
Hi i'm using INTRC with 16F88 @ 8 MHz.
Is there a way to check (in the pic program) that internal clock is really at 8MHz ?
I have some problems with usart at 38400 and I think is due to wrong data rate clock.
Thank you
Look at page 35 of the 16F88 data sheet. If you set your oscillator configuration to INTIO1, the clock/4 will appear on RA6.
In addition to setting the oscillator configuration, you need to set the OSCCON register to 0x72. (See p. 40 of the data sheet.)
Good luck!
Tom
I didn't think using the internal RC oscillator to run the UART was an accepted practice. I would expect to see exactly what you are seeing, bad timings at the higher data rates. I would think even a cheap ceramic resonator would be more stable than an RC oscillator.
Jim
It depends on the chip. The older RC oscillators, were far too inaccurate for async serial. Current ones on some chips have accuracies warranted to a couple of percent, and better than this over 'typical' temperature ranges. The
16F88, _should_ be good enough, provided the supply is within the range 2.7 to 3.3v, and you are in a normal 'room temperature' enviroment. Outside this, it is not accurate enough.Best Wishes
thanks to all... The same programs runs always OK with a 8Mhz Xtal....
You have this in there, right?
bsf STATUS, RP0 ;Switch to Bank 1 movlw b'01110000' ;Set internal osc to 8Mhz movwf OSCCON bcf STATUS, RP0 ;Switch back to Bank 0
I think you just turned off the internal oscillator. Try b'01110010' instead.
Tom
No, I didn't turn it off. When the bottom two LSBs are zero, the _CONFIG word determines the type of oscillator. So as long as the _CONFIG word is properly set, then 0x70 is the proper value to put into OSCCON. The code I provided was snipped from a working program.
Thanks - good to know!
I've always used 0x72 when I run the internal oscillator. It never occurred to me to try anything else.
Tom
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.