Discussion forum for the BasicX family of microcontroller chips.
|
Hi I have debugged the program I send, which was two tasks, one producing a data and putting it in a queue and the other taking the data from the queue. If you remember the scheme: Sub Main() Call OpenQueue(Queue,32) CallTask "Task2",StackTask2 Call Task1 End Sub '------------------------ Sub Task1( ) Do 'produce the data 'put data in the queue Loop End Sub '------------------------ Sub Task2( ) Do 'get the data from the queue 'make operations with the data Loop End Sub '------------------------- As the multitasker gives time slices to each task, it is not necessary to use sleep. The problem is in the part "make operations with data". If you simply take the data and operate with it, the program runs perfectly without errors. But if you make a call to a subprogram (containing the same operations), the program gets stuck and it does not work. So....Can't you make calls to other subprograms in the task?, I mean the ones that you have made, that you have defined at the end of the program. It looks strange, because you can make calls to pre-built procedures like getqueue. Thanks for your interest. [Non-text portions of this message have been removed] |
|
|
|
> The problem is in the part "make operations > with data". If you simply take the data and operate with it, the > program runs perfectly without errors. But if you make a call to a > subprogram (containing the same operations), the program gets stuck > and it does not work. Sounds like a textbook case of stack overrun to me. How much space have you allocated to the stack for task 2? How many local variables do you allocate? __________________________________________________ /">http://mail.yahoo.com/ |
|
On Wed, 30 Aug 2000 04:56:33 +0200, Daniel Navascués Benito <> wrote: > Call OpenQueue(Queue,32) > So....Can't you make calls to other subprograms in the task?, I mean the ones that you have made, that you have defined at the end of the program. It looks strange, because you can make calls to pre-built procedures like getqueue. The problem is your stack (32 bytes) is too small for that task. Increase it to 40 or 50 bytes, and your problems should go away (depending on how many nested calls you make in the task, and how many temps each has, etc). To give you an example, when I spawn a task to read the temperature for a Dallas 1820 1-wire temperature probe, I give it 64 bytes of stack, since it is a fairly complex task. Later, Jon -------------------------------------------------------------- Jon Hylands http://www.huv.com/jon Project: Micro Seeker (Micro Autonomous Underwater Vehicle) http://www.huv.com |
|
|
|
Greetings! I am new to the group and am happy to be here. I am working on a flight simulator (please check out the link below) and I'm a bit frustrated with the current I/O hardware that I'm using (called EPIC) and am looking into pursuing the Basic X route, so I have a few questions: 1. How easy is it to control a network of Basic X controllers via a host computer. For instance in my case, the code residing in multiple Basic X's would simply be for scanning switches, turning on indicators, and networking. The actual processing of what lights to turn on, when, and how to react to switch changes would reside in a host program. 2. Is this networking ability already present in the kits? I've read of being able to upload programs to the Basic X's, but what about running things in a networked, real-time environment. It seems that most of the documentation simply deals with running a network of Basic X's talking back and forth to each other. In my application I need those controllers to actively chat with the Visual Basic program on the computer. Any thoughts, and advice, would be greatly appreciated!! Thanks in advance! Sincerely, Matt Ford Studio City, CA ===================== Check out my Boeing 737 Sim Website at: http://home.earthlink.net/~mattford1 ========================================== [Non-text portions of this message have been removed] |
|
I don't have an answer to your question however, you should investigate the use of a semaphore. It is documented in one of the manuals for the BX24. You set it during each task to prevent the other task from using or modifying the data while the other task is modifying or using the data. Very important when doing what you are trying to do. Also, a sleep(0) is useful to cause the process to give up the rest of its time slice to the next process. Can make your program execute faster. Good luck, Marty Hi I have debugged the program I send, which was two tasks, one producing a data and putting it in a queue and the other taking the data from the queue. If you remember the scheme: Sub Main() Call OpenQueue(Queue,32) CallTask "Task2",StackTask2 Call Task1 End Sub '------------------------ Sub Task1( ) Do 'produce the data 'put data in the queue Loop End Sub '------------------------ Sub Task2( ) Do 'get the data from the queue 'make operations with the data Loop End Sub '------------------------- As the multitasker gives time slices to each task, it is not necessary to use sleep. The problem is in the part "make operations with data". If you simply take the data and operate with it, the program runs perfectly without errors. But if you make a call to a subprogram (containing the same operations), the program gets stuck and it does not work. So....Can't you make calls to other subprograms in the task?, I mean the ones that you have made, that you have defined at the end of the program. It looks strange, because you can make calls to pre-built procedures like getqueue. Thanks for your interest. [Non-text portions of this message have been removed] _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. Share information about yourself, create your own public profile at http://profiles.msn.com. |
|
This sounds like a stack overflow problem. I don't know the specifics of how the BX uses the stack, but in general, the stack size required for a task goes up proportionally with the levels of nested sub-routines the task can call. If you have some ram to spare, try substantially increasing the stack size for the task and see if it works. If you don't have the ram, then you will have to live with not being able to use more sub-routines for that task. When dealing with micros with very limited ram, it's always a tradeoff between effiecient, easy to read code and ram usage. This is especially true when you're multitasking. Kirk Lovewell -----Original Message----- From: Marty Matthews [mailto:] Sent: Thursday, September 07, 2000 9:23 AM To: Subject: Re: [BasicX] More about using queues to share data I don't have an answer to your question however, you should investigate the use of a semaphore. It is documented in one of the manuals for the BX24. You set it during each task to prevent the other task from using or modifying the data while the other task is modifying or using the data. Very important when doing what you are trying to do. Also, a sleep(0) is useful to cause the process to give up the rest of its time slice to the next process. Can make your program execute faster. Good luck, Marty Hi I have debugged the program I send, which was two tasks, one producing a data and putting it in a queue and the other taking the data from the queue. If you remember the scheme: Sub Main() Call OpenQueue(Queue,32) CallTask "Task2",StackTask2 Call Task1 End Sub '------------------------ Sub Task1( ) Do 'produce the data 'put data in the queue Loop End Sub '------------------------ Sub Task2( ) Do 'get the data from the queue 'make operations with the data Loop End Sub '------------------------- As the multitasker gives time slices to each task, it is not necessary to use sleep. The problem is in the part "make operations with data". If you simply take the data and operate with it, the program runs perfectly without errors. But if you make a call to a subprogram (containing the same operations), the program gets stuck and it does not work. So....Can't you make calls to other subprograms in the task?, I mean the ones that you have made, that you have defined at the end of the program. It looks strange, because you can make calls to pre-built procedures like getqueue. Thanks for your interest. [Non-text portions of this message have been removed] _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. Share information about yourself, create your own public profile at http://profiles.msn.com. |