Not sure if this helps, It's an old (and I mean old) bit of code that I wrote for a friend to fade a light like the one on Dr Who's tardis (I can't actually recall if the code fades the LED correctly as I don't have a 12F675 to hand). It could probably be written a lot simpler, but I was learning PBP at the time (still am so most of my code is never tight
)
If you comment out the config setting in the 12F675.INC file in the PicBasic folder it compiles using MPSAM without error.
Code:
@ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BODEN_ON
__CONFIG
_INTRC_OSC_NOCLKOUT
_WDT_ON
_PWRTE_ON
_MCLRE_OFF
_BODEN_ON
TRISIO.0 = 0 'Set GPIO.0 to output.
ANSEL.0 = 0 'Set GPIO.0 to digital
VRCON = 0 ' Voltage reference disabled
OPTION_REG.7 = 0
led var GPIO.0
i var byte
getout var bit
main:
for i = 1 to 254
Pwm GPIO.0,i,1
pause 5
if i=253 then
i=1
GetOut=1
endif
next i
if Getout=1 then goto down
down:
for i = 254 to 1 step -1
Pwm GPIO.0,i,1
pause 5
if i=2 then
i=1
GetOut=0
endif
next i
if Getout=0 then goto main
Might be worth giving it a go one last time with your old programmer. It's been years (circ 2001) since I used WinPIC and an old JDM programmer, but I do recall it was very hit and miss at programming. I seem to remember some other version like WinPIC-PRO or something as being an alternative which I think worked better. Might be worth a quick google if you still want to try and resolve this.
Bookmarks