-
At least, your config fuses are not declare the right way. See the following thread
http://www.picbasic.co.uk/forum/showthread.php?t=543
NOW, are you saying that if you change them manually in your device programmer software it doesn't work?
You declare to use an external RC oscillator... are the value of R and C meet the datasheet suggestion? Personnally, i would prefer to use the internal one
Code:
' PIC config fuse using MPASM to compile
@ __CONFIG _INTRC_OSC_NOCLKOUT & _MCLRE_ON & _LVP_OFF & _WDT_OFF & _PWRTE_ON & _BODEN_ON
-
Steve,
I've tried most of the suggestions to include the config settings within the code. The only enties that doesn't halt the compiling process are
Code:
@INTRC_OSC_NOCLKOUT
@WDT_ON
@PWRT_ON
@MCLR_OFF
@BOD_ON
@LVP_OFF
@CPD_OFF
@PROTECT_OFF
However these must me ignored by the compiler as the resulting LST file after the code has compiled shows a config setting of
Code:
__config _XT_OSC & _WDT_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF
So when I come squirt the HEX file to the PIC via WinPIC pro I manually change the device config settings to RC no clockout, and have tried enabling / disabling WDT and MCLR input as well but it has no affect, the PIC seems to freeze after 60-90 seconds of running the code posted above.
Just to prove it isn't the PIC that's faulty, I programmed a simple "Flash LEDs" using JAL and that's been running for the past hour - so the issue must be somthing with either the PBP code, the communications between PBP and MPSAM or the way MPSAM compiles the files from PBP or the manual settings in WinPIC are being overlooked when the HEX is loaded.. but then why would the code run at all if that was the case ??
On the hardware front, as I'm using the internal OSC (or trying to) I have no Resistors or capacitors, or external crystal. The four reed switches are connected between ground and the first four pins of PORTB, with 10K pull-ups to +5v. The only other components are 8 LEDs and their 8 resistors.
Cheers
Malcolm
-
Further Update...
If I keep triggering the LEDs on PORT A (via RB0 and RB1) the PIC runs fine for ages.. I can sit there triggering the reed switches until my hearts content. However if I then trigger RB2 or RB3 and thus the LEDs on RB5,6,7,&8 then it freezes...
I'll try making the last 4 pins of PORTA the inputs and PORTB all output and see what happens
Update:
Well making PORTB all outputs and A0,A1, A6 and A7 inputs (rest port A out) is worse. Now on power up all leds light up in random sequence and the extinguish and it freezes.... I'm going to try a trusty old 12F675 with just 2 inputs and see if that works - I have stack of those PICs so using 1 per pair of sidings is no real hard ship !
-
Last update
Well, thinking that it might be the hardware, I stripped the breadboard and started from scratch making sure there was nothing left floating, or tied down to the wrong supply. Loaded the code and tested. The first two inputs (RB0 and RB1) and thier coresponding LEDs (RA1, RA0 and RA7, RA6) can be triggered until the cows come home. However triggering the any of input three or four (RB2, or RB3) causes the thing to freeze.
I'm off to try it with the 12F675's and see if that works.
-
Poblem sorted
It turns out the problem is human error... I used the wrong varable in one of the couter checks... that will teach me to cut and paste and not pay attention ! (I blame it on the wife, kids, cat for interrupting me and thus causing me to overlook the error !)
Thanks for everyones input...
Malcolm
-
Well don't worry dude, it happen to everybody... you can't imagine how many keyboard and laptop i must change in a year because i destroyed them by frustration after hours/days/week of hard programming/debugging session.