|
|
View previous topic :: View next topic |
Author |
Message |
milner_86 Guest
|
main functions? |
Posted: Tue Jun 09, 2009 5:43 am |
|
|
Hello,
I am pretty new to programming embedded circuits and was wondering if any one can help me? Apologies if this is a really stupid question as I am probably missing something quite obvious
I am building a datalogger that just asks a question and then stores the answer, however I am having some trouble with the main function.
The code I am using will compile fine but when running on the board will keep jumping back to the very beginning (and so initialise the lcd/ display welcome message) instead of to the beginning of the while loop. I have included a very simplified bit of my code as an example:
Code: |
void main()
{
debounce();
lcd_init();
lcd_intro();
init_rtc();
while(TRUE)
{
if (S1_pressed==TRUE)
{
multi_beep(2);
test_question();
}
}
} |
This code is meant to display a test question format when a button is pressed, however will always return to the very beginning of the main function.
I have tried messing around with the format loads (putting brackets left, right and centre) but am guessing I am missing something very obvious.
Any help or pointers would be much appreciated, cheers! |
|
|
Wayne_
Joined: 10 Oct 2007 Posts: 681
|
|
Posted: Tue Jun 09, 2009 5:49 am |
|
|
You will proberbly find you have the WDT watch dog timer enabled which is resetting the pic because you are not kicking it.
If you post your fuse settings we could verify this.
Set NOWDT if you don't need it. |
|
|
milner_86 Guest
|
main function? |
Posted: Tue Jun 09, 2009 7:06 am |
|
|
Thank you so so much! That had been confusing me for days! You were right I had
Code: | #fuses hs, wdt, noprotect, put, nobrownout, |
now
Code: | #fuses hs, nowdt, noprotect, put, nobrownout, |
I never even thought to check that as I didn't really know what it meant (as I said complete novice). Is working fine now Cheers |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|