|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Interrupt timer, executing code asap?
So my example(), if it took 5 seconds (start and end each), then the timer itself would be off by 10 seconds? Well I need a fork().
![]() |
|
#2
|
||||
|
||||
|
Re: Interrupt timer, executing code asap?
technically, even fork() only does one thing at a time
it just interlaces the needs of multiple things, so that part of one function executes, then part of the next, et cetera.solution? no function in your bot code should last 5 seconds ![]() |
|
#3
|
||||
|
||||
|
Re: Interrupt timer, executing code asap?
Quote:
![]() |
|
#4
|
||||
|
||||
|
Re: Interrupt timer, executing code asap?
that too
heck, no individual function should last anywhere near 26ms ![]() |
|
#5
|
|||||
|
|||||
|
Re: Interrupt timer, executing code asap?
except sine
![]() ![]() ![]() Well, if you forgot the lookup table! |
|
#6
|
||||
|
||||
|
Re: Interrupt timer, executing code asap?
wouldn't be that useful a sine function if it took near 26ms - remember, you have do do something with it too
![]() |
|
#7
|
|||
|
|||
|
Re: Interrupt timer, executing code asap?
Real time programming requires the use of a "state machine", which is a programming technique where one state starts the motors, for example, and the second state monitors for a certain amount of time to pass before proceeding to the third state.
The second state can be entered multiple times without causing any problems. So the second state checks the time, then reutrns to the code where the data packets can be handled. Then the same fuction is called to execute the seconds state which looks at the time again. State machines are best implemented using the C "switch" statement, and some long hard thinking. |
|
#8
|
||||
|
||||
|
Re: Interrupt timer, executing code asap?
Quote:
-Kevin |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Inserting Naviagation code into Default code? | actorindp | Programming | 3 | 28-01-2004 18:12 |
| Interrupts Questions | mightywombat | Programming | 0 | 03-01-2004 14:50 |
| EDU Demo Code: Serial Data Transmitter Using a State-Machine | Kevin Watson | Programming | 3 | 28-12-2003 22:56 |
| EDU Interrupt and Timer Template Code | Kevin Watson | Programming | 8 | 22-12-2003 14:11 |
| EDU Demo Code: Real-Time Clock Using a Timer | Kevin Watson | Programming | 1 | 17-12-2003 15:14 |