If it is blinking too fast, that would point to your clock speed being too high which is extremely unlikely. Are you absolutely sure your code is correct? Perhaps you should post your blink code.
If it is blinking too fast, that would point to your clock speed being too high which is extremely unlikely. Are you absolutely sure your code is correct? Perhaps you should post your blink code.
Yes, it's not very likely that the PIC is running faster than 32MHz.
There's two parts to it. Get the PIC to actually run at the desired frequency and inform the compiler what that speed is so it can get its timing calculations correct. If you don't tell the compiler that you're running the PIC at 32MHz it defaults to 4MHz and your PAUSE 1000 will in effect become a PAUSE 125.
/Henrik.
I was following the data sheet and it must be set for 32Mhz because when I used a pause of 1000 and hooked up the oscilloscope to it I was getting 125ms. I used the define 32 in PBP but it doesn't seem to work. I've never used a chip like this, the oscon register is different. I'll try again tomorrow.
OSC is case sensitive, the rest is not.Code:define OSC 32
/Henrik.
I've tried so many thing now with no luck. Here is the config setup in 16f18857.inc file. A pause 1000 led on & off program is giving me 125ms on the scope.
#CONFIG
__config _CONFIG1, _FEXTOSC_HS & _RSTOSC_HFINT32 & _CLKOUTEN_OFF & _CSWEN_ON & _FCMEN_ON
__config _CONFIG2, _MCLRE_ON & _PWRTE_OFF & _LPBOREN_OFF & _BOREN_ON & _BORV_LO & _ZCD_OFF & _PPS1WAY_OFF & _STVREN_ON & _DEBUG_OFF
__config _CONFIG3, _WDTCPS_WDTCPS_11 & _WDTE_ON & _WDTCWS_WDTCWS_7 & _WDTCCS_LFINTOSC
__config _CONFIG4, _WRT_OFF & _SCANE_available & _LVP_OFF
__config _CONFIG5, _CP_OFF & _CPD_OFF
#ENDCONFIG
It's my understanding that on reset the internal clock will be running at 32Mhz with these fuses set. I've tried simply setting Define OSC 32, and adding OSCFRQ = %00000110.
There are three OSCCON registers and OSCEN register. I'm off in the weeds and don't know which way to go at this point.
I did notice that when I program the chip with meProg that the configuration HFINTOSC WITH 2X PLL was set instead of HFINTOSC like the fuse is set for. I changed that and my blink program goes from 125ms to 2sec. For what it's worth. Any help would be appreciated thanks.
Why is it so hard to post the code - as in everything? Not just the code, not just the config, not bits, pieces and snippets for us to piece together and extract information from. You think it's hard at your end, how do you think it is for us?
That tells me that the PIC is actually running 8 times faster than the compiler thinks it is. You tell it to pause for 1000ms but in reallity it only pauses for 125ms, 1000/125=8. As have been said before it's not very likely that the PIC is running faster than 32MHz (or in this case 8 times faster = 256MHz) it's much more likely that it IS actually running at 32MHz but you haven't properly told the compiler that so it thinks it's running at 4MHz (32 / 4 = 8).A pause 1000 led on & off program is giving me 125ms on the scope.
I don't have that chip here but if you post the code, within code tags, which is giving you the 125ms pause when it should be 1000ms I'll see if I can spot the problem.
/Henrik.
Sorry HenrikOlsson for the frustration. I figured it out just now, it wasn't the code. It was my anti-virus software, I had ransom ware protection on. This somehow allowed some of the pic to be programmed but would act screwy. I checked off ransom ware protection and reprogrammed the chip same code, everything works as it should now. Thank you for your help.
Bookmarks