kenkiiro
asked on
Priority in real time process
I hav develop a program in VBA environment, to get data through serial comm.
In the program i use the timer (can be set from 0.5s -> ) to get the data. The process of getting data take around 0.2s.
I face 2 problem:
1) The Timer is not given the highest priority in the program. When an interupt (eg. open a data file) occur, it will then go on with the interupt. This will then stop the process in timer for a while. This will miss out some real time data.
2) When open others application/program in O/S (Win2000), the program will also be interupted. Different with (1) is that the timer will run but overflow in memory happen to be.
How to set the timer to highest priority in program and memory priority?
In the program i use the timer (can be set from 0.5s -> ) to get the data. The process of getting data take around 0.2s.
I face 2 problem:
1) The Timer is not given the highest priority in the program. When an interupt (eg. open a data file) occur, it will then go on with the interupt. This will then stop the process in timer for a while. This will miss out some real time data.
2) When open others application/program in O/S (Win2000), the program will also be interupted. Different with (1) is that the timer will run but overflow in memory happen to be.
How to set the timer to highest priority in program and memory priority?
ASKER
rdrunner,
Thanks for reply.
What actually u mean by STACK overflow?
what u say is good idea, but if i want the getdata() to run at priority process and its run all the time once the program start (eg. getting data every 0.2s), so in between the 0.2s can do other process after doing the getdata().
But problem is that can we run the "process 2" half way and continue running it after the "process 1"(getdata())?
Because the getdata() is time consuming, and the process to most of the time can't be finish between 0.2s (eg. saving a large file to harddisk)
thanks for the proffesional advice!! :)
Thanks for reply.
What actually u mean by STACK overflow?
what u say is good idea, but if i want the getdata() to run at priority process and its run all the time once the program start (eg. getting data every 0.2s), so in between the 0.2s can do other process after doing the getdata().
But problem is that can we run the "process 2" half way and continue running it after the "process 1"(getdata())?
Because the getdata() is time consuming, and the process to most of the time can't be finish between 0.2s (eg. saving a large file to harddisk)
thanks for the proffesional advice!! :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
kenkiiro:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
Experts: Post your closing recommendations! Who deserves points here?
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
Experts: Post your closing recommendations! Who deserves points here?
Moderator, my recommended disposition is:
Accept HarmnKardn's comment(s) as an answer.
DanRollins -- EE database cleanup volunteer
Accept HarmnKardn's comment(s) as an answer.
DanRollins -- EE database cleanup volunteer
Dont you mean a STACK overflow?
This happens when you start to process your getdata() while you are still in it..
You need to make sure that your getdata Function wont start while it is running. This can be acomplished with a static variable inside the function (isRunning) - just set it to true while you process your data and then set it back to false when you leave your function...
Only process data when it is false...
Another thing you might consider is to split up your processes... Create one for gathering data , one for processing and one for controlling the other 2.. So they wont run into each other and cause themself to miss something....
P.s: 0.5 s is no realtime ;)