|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#10
|
||||
|
||||
|
Actually, I've been thinking.... they give us control over one byte. That means we can send either 8 digital outputs to the dashboard, or one 0-255 output...
If the 0-255 method is done by having bit 0 = 1 bit 1 = 2 bit 2 = 4 bit 3 = 8 bit 4 = 16 bit 5 = 32 bit 6 = 64 bit 7 = 128 then turning on/off the appropriate bits to get any number from 0-255 (1+2+4+8+16+32+64+128 = 255), couldn't this method also be used to get two numbers from 0-15? Meaning.... bit 0 = 1 bit 1 = 2 bit 2 = 4 bit 3 = 8 bit 4 = 1 bit 5 = 2 bit 6 = 4 bit 7 = 8 So, using this method, we could program the Robot Feedback byte to actually carry two PWM values, but just the PWM value ±16. Since the maximum value is 255, if we divide it by 16, we get a number between 0 and 15. Thus, we could send to a dashboard program approximately two PWM values. Say the code outputs a value of, oh, 123 to a pwm. We can take 123 and divide it by 16. Since PBASIC doesn't handle decimals, the final result would be 7 (it's actually 7.6875). This number will always be between 0 and 15, so we could use bits 0 through 3 to 'encode' it (bit 0 - on; bit 1 - on; bit 2 - on; bit 3 - off; 1+2+3 = 7). The same could be used with bits 4-7. In the end, the dashboard program would read the Robot Feedback (LED) byte and from it, decode two numbers between 0 and 15 - or, two PWM outputs to the nearest 16. Sure, it's not perfect, but it's an approximation of what your robot code is sending out to the PWM. This method could also be used to transfer to a dashboard program an approximate PWM value AND 4 digital outputs. You guys understand what I'm trying to say? Last edited by DanL : 02-06-2002 at 01:48. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Creating a dashboard program | Jeff_Rice | Programming | 18 | 04-05-2003 23:21 |
| Anyone looking for more program space? | archiver | 2001 | 13 | 24-06-2002 02:20 |
| Custom dashboard program available. Interest? | archiver | 2001 | 4 | 24-06-2002 00:45 |
| miroboworks dashboard program? | archiver | 2000 | 3 | 23-06-2002 23:04 |
| Yet another dashboard program | Neal Probert | Programming | 3 | 12-05-2002 10:43 |