propeller freeze up?
Crosswinds
Posts: 182
Hello everyone!
I have a strange problem with my propeller.
I have done my own clock with temperature-information, that displays on the parallax serial 2-line display.
everything works fine, and i have just made the final code for the clock-setting.
So fine i set the clock to test it out, and noticed that about 7 minutes later it have freezed!
I have tested it again and again, and it always freezes at different times, the longest it have "worked" is one hour and 20minutes.
Dont know if its a programming fault or a hardware fault.
Doesnt really seem like a programming fault when its in such a big timespan, but i maybe wrong.
Does anyone have any idea of what it can be?
Its not the time-chip that freezes, becouse if i reset the propeller when it have froze, it gets the right time again, no problem, so the timechip keeps the time.
timekeepingchip: DS1302
temperature: DS1620
Using objects for them downloaded from parallax site.
I hope you guys can have some idea of what it could be!
I have a strange problem with my propeller.
I have done my own clock with temperature-information, that displays on the parallax serial 2-line display.
everything works fine, and i have just made the final code for the clock-setting.
So fine i set the clock to test it out, and noticed that about 7 minutes later it have freezed!
I have tested it again and again, and it always freezes at different times, the longest it have "worked" is one hour and 20minutes.
Dont know if its a programming fault or a hardware fault.
Doesnt really seem like a programming fault when its in such a big timespan, but i maybe wrong.
Does anyone have any idea of what it can be?
Its not the time-chip that freezes, becouse if i reset the propeller when it have froze, it gets the right time again, no problem, so the timechip keeps the time.
timekeepingchip: DS1302
temperature: DS1620
Using objects for them downloaded from parallax site.
I hope you guys can have some idea of what it could be!
Comments
If you want further help with this, you'll have to post your source code (as an attachment to a message ... NOT cut and paste). If you're using objects from the Object Exchange and you've made absolutely no changes to them, you could provide a link to the object rather than a copy of the source code. It's often best to use the archive feature of the Propeller Tool since it includes all the source files that you've used.
i have attached my archive to this post now, hopefully someone can help me with what i have done wrong.
Its probably full of mistakes, new to propeller for about a week or so [noparse]:)[/noparse]
The "roomtemperature.spin" is the· main object.
Doing that is kind of missing the point of calling and returning from subroutines.
There should be a blank "repeat" in main...
Actually, just replace "PUB main" with "repeat" and indent everything underneath it until "PUB watchbutton".
Then remove any and all calls to "main".
main, by itself on a line, in the case of your program is not a "jump" or a "goto". It is saying, "call this", with the intention of returning to the statement right after it. Your call stack just keeps growing and growing, overwriting anything in memory.
Could you please check the code again, to see if i got a hang of what you meant?
I have attatched it here
now it's just a matter of getting rid of the endless loops caused by the repeat statements in:
PUB sethour
PUB setmin
PUB finalsetting
fixing "finalsetting" is easy. just get rid of the repeat. The other two need a bit more work about what exactly you're trying to accomplish.
When it detects one, it goes in "sethour" and the hourset shows at the display, then it waits for a button-stroke again, and for every stroke it detects, it adds +1 to the hour.
And it also "feels" if the user is holding in the button for some time, and the jumps to setmin.
I have to do this, becouse i cant have 2 buttons since the demoboard Pins is full with both the IC´s and one button, probably a bit simpler with atleast 2 buttons!
And im sure there is some simplier way to do this with one button to [noparse]:)[/noparse]
But now you maybe are able to understand how my thoughts are about those loops? [noparse]:)[/noparse]
Thank you again!
Post Edited (Crosswinds) : 10/12/2009 7:37:13 PM GMT
would command: "repeat while" be a good idea for it to repeat until the input get high?
repeat while keeps on looping as long as a condition is TRUE
repeat until keeps on looping as long as a condition is FALSE
so it just depends on your coding
let's assume you want wait until button is pressed which means INA[noparse][[/noparse] 7] = high
WAITING for INA[noparse][[/noparse] 7] = high can be coded
or
a second hint: you use hardcoded ticks in your waitcnt
use the systemvariable ClkFreq. Then the waiting times stay the same even if you change Clocksettings
is around 30_000_000 / 80_000_000 = 0.375 seconds
this can be achived by coding
if you would like to have the exact amount of time
by the way: if you need some more inputs you can use the mouse and keyboard-connector-sockets
If you take a look into the schematic the DIN-connectors have a current-limiting resistor of 100 Ohm (good to have them in serial to the input)
and a 10kOhm pull-up-resistor which you need anyway for buttons
You can make "creative" use of the TV-output as an output-pin to drive a transistor
same with the RGB V- and H-pin of the VGA-connector.
You can use them as Output to drive the base of a transistor.
best regards
Stefan
Post Edited (StefanL38) : 10/13/2009 9:04:54 AM GMT
repeat while ina[noparse][[/noparse]7]==1
··{stuff}
or
if ina[noparse][[/noparse]7]==0
··return
that way, when the button is released, it can fall back to the main loop.
I think you're logic looks like:
Is button pressed?
Is button not held down?
return early if it isn't (debounce)
Is button really still held down?
-If so, go to the portion where we repeatedly change the minutes until button is released, then return.
Else
-Increment the hour once.
Set the final result.
Finally return back to main loop
Wow! Thank you guys very much with all your help and explanations.
You have really helped me on the way with this, and explained (so that i understood) why i shouldnt do what i did in the first place.
I will redesign the whole "setting-code" with my newfound knowledge [noparse]:)[/noparse]
Thank you!