It's the down side of those nifty 10Fs with most compiler. The use of assembler is handy in this case... but i'll have a look at this one to see what i can do...
It's the down side of those nifty 10Fs with most compiler. The use of assembler is handy in this case... but i'll have a look at this one to see what i can do...
Last edited by mister_e; - 9th October 2006 at 03:58.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Not tested but assuming you're not using any Gosubs... it could work.
Inspiration taken bellow
http://www.picbasic.co.uk/forum/show...light=modifier
Sure it could be dangerous.... compile O.K
Good luck!Code:@ device pic10F202, mclr_off, protect_off, wdt_off TRISIO = %1100 asm dim=SOFT_STACK Time=SOFT_STACK + 2 Time2=SOFT_STACK_PTR endasm dim VAR WORD ext Time VAR WORD ext Time2 VAR BYTE ext b0 VAR BYTE Clear GPIO = 0 dim = 100 Start: time = time + 1 'increment timer in 1/50 seconds IF time > 30000 Then 'make a 10 min increment time = 0 time2 = time2 + 1 EndIF b0 = b0 + 1 'increment for every 4 phase cycles IF b0 >= 3 Then b0 = 0 IF (time2 >= 2) then if b0 = 2 Then dim = dim + 1 'if over 20 min then start dimming dim period 4 cycles = 10 mins endif IF dim > 7500 Then dim = 7500 'down to dim level - 9000 = off, 7500 approx 15% if time2 > 72 then 'turn off after 12 hours dim = 9000 time2 = 73 'prevent from cycling endif LowSide: 'look for GPIO.3 points and GPIO.3 GPIO.2 IF GPIO.3 = 1 Then lowside 'wait for phase to go low GPIO.5 = 0 'weight input to sense zero crossing PauseUs dim 'wait for dim period TRISIO.2=0 'fire GPIO.2 GPIO.2 = 0 PauseUs 400 TRISIO.2=1 HighSide: IF GPIO.3 = 0 Then HighSide GPIO.5 = 1 PauseUs dim TRISIO.2=0 GPIO.2 = 0 PauseUs 400 TRISIO.2=1 GoTo start
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hey steve - that looks like some funky stuff yr doing there - tho it's still saying that it's unable to fit variable b0. Any easy way to solve it? Else I'm gonna move to a 12F - seems such a waste tho as I'm only using 2 I/Os. I'm trying to design it for a production run - so I did like the cost and form of the 10F.
be sure you copy past the whole thing above. It compile ok to me. I did few minors change to the one you posted before.
I guess about a IF (condition a) AND (condition b) then... line... right?
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hey - copied it all across and it compiled thanks - however - it won't program :s
"ROM programming error at address 0x0000
Good 0x0025
Bad 0x0FE7"
Any ideas on what that could mean?
Thanks
Brendon
One thing that strikes me as odd is that when you look at the hex file im my programmer it's in groups of 3 instead of groups of 4 - any clues why?
This programming error message seems to be popular now. Do a search within the forum or the website of your device programmer AND/OR software.
Compile and program fine here.
<img src='http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1111&stc=1&d=116044343 1">
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks