|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#4
|
||||||
|
||||||
|
How about tring this...
Your syntax is correct.
Counter = Counter +1 Does what it does in nearly every programming language (despite the fact that it makes math profs crazy!). Perhaps a better idea for what you are trying to do is: Time = Time + 1 + Delta_T Where Delta_T is the variable passed to you by the master CPU that tells you how many data packets you have missed since the last time you got a good packet of data from the master CPU. If you use this construct, you will have a more reliable method to have something stay on for 2 seconds for example. If you just use counter as you initially proposed, your loop time figures into the time that passes before you reach a set number. Also figured into the mix is the fact that you may have a noisy radio environment or you may have some other problem communicating with the OE. In these cases, you can have the time until counter reaches a fixed number vary by mulitples of 2 or 3. With Delta_T added in, your program takes into account the fact that you missed packets and thus your time estimations are more robust. Joe J. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PBASIC ARCTAN function | Greg Ross | Programming | 14 | 11-05-2003 12:28 |
| Need to learn PBASIC...Where Should I Go? | IMDWalrus | Programming | 5 | 29-04-2003 16:43 |
| Obscure PBASIC for RoboEmu | rbayer | Programming | 1 | 28-03-2003 23:57 |
| PBasic 2.5 vs. 2.0 | Anthony Kesich | Programming | 6 | 09-02-2003 22:06 |
| RoboEmu v.1a (another PBASIC emulator) | rbayer | Programming | 0 | 07-07-2002 00:45 |