OSC is case sensitive, the rest is not.Code:define OSC 32
/Henrik.
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.
Wow, that's the first time I've heard of anything like that. An antivirus program on a PC messing up code on a PIC.
I'm glad you figured that out because I certainly would not have done it from where I'm sitting :-)
/Henrik.
I don't know if I would have figured it out without your last post wanting all my code. I just updated to PBP 3.1, on my system I have to disable ransom ware protection to install programs. I started my program file in PBP when it was still off, then I turned it back on.
To post code for you I started a new file with just the clock info TRIS registers and simple led loop. This time though it would compile but not bring up the programmer. I tried opening the hex manually but the programmer said it couldn't find the file. Hmmmm If it couldn't find the new file something is blocking it was my thinking, that's when I remembered the antivirus software. It lets somethings pass and others not.
So we'll just call this a collaborative effort![]()
Bookmarks