|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#9
|
||||||
|
||||||
|
Small Step toward signed math...
Small step toward signed math:
The main reason I want to use signed math is I want my division to work out properly. In 2's complement math, adds, subtracts, and multiplies take care of themselves (mostly). It is the divide operation that give folks the hassles. How about if you could tag a part of an expression that may be of unknown sign and then the code could get the math right. For example: PWMoutput = (error term) * FeedbackGain >> FeedbackScaling + $7F MAX $FE + $8000 MIN $8000 - $8000 If would be nice if I could flag (error term) as signed for the purposes of the division ">> FeedbackScaling" The pre-processor could then put in the right IFs, Tests, Gotos, etc. that are typically required to get the division to work right. It would also be nice to an automatic way to make sure that the results are within the right range for an 8 bit PWM output, eliminating the need for all the MAX's & MIN's and $8000's Just a thought. Joe J. Last edited by Joe Johnson : 09-11-2001 at 14:09. |
| 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 |
| 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 |
| emulationFIRST (aka PBasic emulator) | Matt Leese | Programming | 5 | 30-06-2002 12:06 |
| PBASIC Loop Speed? | archiver | 2001 | 3 | 23-06-2002 23:46 |