Subject:
|
Re: Multitasking problems
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Sat, 26 Sep 1998 16:09:42 GMT
|
Original-From:
|
Will <willbain@#NoSpam#cs.umt.edu>
|
Reply-To:
|
willbain@cs.(stopspammers)umt.edu
|
Viewed:
|
1456 times
|
| |
| |
Adam Oliver wrote:
> I keep getting this message whenever I try to multitask with my board:
>
> "Not enough stack memory for new process while executing main (process # 1)" <snip>
> int d;
>
> void main()
> {
> sony_init(1);
> while(!stop_button())
> {
> start_process(IRCheck());
> }
> sony_init(0);
> }
>
> void IRCheck()
> {
> while(1){
> d = ir_data(0);}
> }
I think I know what the problem is: Putting a start_process statement
inside a loop like that is going to end up starting so many processes
that the stack fills up almost instantly. I think you probably only
need a single IRCheck process running. Try something like this:
int d; /* note that this is a global variable */
void main() {
int ipid;
sony_init( 1 );
ipid = start_process( IRCheck() );
while( ! stop_button() ) {
printf( "IR data: %d", d );
msleep( 250L );
}
kill_process( ipid );
sony_init( 0 );
}
void IRCheck() {
while( 1 ) {
d = ir_data( 0 );
defer();
}
}
Hope this helps. Good luck!
--Will
, ,
__@_/ \_@__ |/
| /__, o @_/
)\ ) ( \ (\/\\,
~~~~~~~~~ ' ` ~~~~~~~~~~~ ` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Wendy Parson, America's one of the finest countries
Will Bain, anyone ever stole.
& Tatoosh --Bobcat Goldthwait
|
|
Message is in Reply To:
| | Multitasking problems
|
| HELP!! I keep getting this message whenever I try to multitask with my board: "Not enough stack memory for new process while executing main (process # 1)" The only things loaded are the hb libs, my code and the sony ir routines totally nowhere near (...) (26 years ago, 26-Sep-98, to lugnet.robotics.handyboard)
|
2 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|