BasicMicro - Forums

www.basicmicro.com
It is currently Sun May 20, 2012 10:52 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Code keeps reseting - help
PostPosted: Fri Aug 28, 2009 8:00 am 
Offline
Citizen

Joined: Sun Jul 05, 2009 12:01 pm
Posts: 12
The code below is looking for the ending (lowest level ")") it runs part way through the byte table and then resets. I don't know why; can anyone help?

version: 02.2.1.1 - because later versions don't work with my rev b development board (another unanswered q)

============================
'======================================================================
' Balloon with a menu System
'======================================================================

'=====Menu Variables
menui var word
menulevel var word
parenlevel var word
menuchoice var word
btn var byte
y var byte
ByteFrom var word
ByteTo var word
one con 1
Menu bytetable "(setup:50(EEPROM(Init#Temp1(Yes:1,No:99),Init#Temp2(Yes:2,No:99),Init#Alt(Yes:3,No:99),Done:99),RTC(SetHour:4,SetMin:5,Done:99)),Test( Servo( Up:6,Down:7,Done:99),Heater( On:8,Off:9,Done:99),Klaxon:10,RTC:11,Temp1:12,Temp2:13,Done:99),Arm(Yes:14,No:99))"

ByteFrom = 0
ByteTo = 0
ParenLevel = 1
repeat
byteto = byteto + one
debug [menu(byteto)]
if menu(ByteTo) = "(" then
parenlevel = parenlevel + one
elseif menu(ByteTo) = ")"
parenlevel = parenlevel - one
endif

until parenlevel = 0

debug [int bytefrom, int byteto]
end
============================


Top
 Profile  
 
 Post subject: Re: Code keeps reseting - help
PostPosted: Fri Aug 28, 2009 8:57 am 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 527
I have not walked through your table and counted ( vs ), but as your count initializes the paren level to 1, so if you don't get back down to zero at your last ) then you will walk through random memory and possibly fault at some point with a bad pointer or the like... So I would check your count at the end and see if your counts are right...

I know nothing about the dev boards, so I will leave that one for someone from Basic Micro. (I currently use boards from Lynxmotion and mostly Atom Pros...)

Kurt


Top
 Profile  
 
 Post subject: Re: Code keeps reseting - help
PostPosted: Fri Aug 28, 2009 9:05 am 
Offline
Citizen

Joined: Sun Jul 05, 2009 12:01 pm
Posts: 12
How did it run for you?


Top
 Profile  
 
 Post subject: Re: Code keeps reseting - help
PostPosted: Fri Aug 28, 2009 1:22 pm 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 527
When I first posted I had not run the program. So I broke out my backup board with the Atom on it and tried it on the beta and had a few issues, so I then tried it on 5.3.1.0 and after I fixed an error in the code. That is on the debug statement the words: Int were replaced with DEC. It compiled fine in debug mode and ran until the end and printed out the two numbers.

Kurt


Top
 Profile  
 
 Post subject: Re: Code keeps reseting - help
PostPosted: Fri Aug 28, 2009 1:31 pm 
Offline
Citizen

Joined: Sun Jul 05, 2009 12:01 pm
Posts: 12
Looks like I will have to find my way through upgrading to 5.3.1.0 .

Thanks for checking that, Tom


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


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 post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO