|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Can anyone define the argument for Serout (255,255...)? What do the 255's mean? Thanks.
|
|
#2
|
|||
|
|||
|
The 255's are simply signals to the output cpu telling it that this is the start of the stream of bytes.
If the o/p cpu were not to receive them (maybe it missed them on powerup), it woud sit there listening for 255,255. Once received (the next time the Stamp sends an output stream), the bits would be pigeonholed properly as bit 'n' from the start, bit 'n+1' and so on. |
|
#3
|
||||||
|
||||||
|
Why a PWM value should NEVER be 255...
This is also why you should always limit your PWM values to 254 -- NEVER allow them to be 255.
If you look at the output order, there is always a PWM value output between things that could possibly be a value of 255 (for instance you may want all relays ON, in this case relayA may be all 1's which is $FF or 255. If this was next to another thing, say relayB that could also be 255, the master CPU would think, "A HA, This is the start of the data stream" But, Innovation First cleverly put a PWM value in between RelayA and RelayB. So, the only way to make a "255, 255" sequience is to foolishly allow the PWM value to equal 255. This problem can cause very subtle errors. MOST of the time everything is right as rain, then BOOM! Thunder and lighting! your code crashes. Do yourself a favor, make sure you get good at limiting the values of your PWM outputs to 0-254. Joe J. |
|
#4
|
||||
|
||||
|
Last year, we spent a day trying to figure out why our robot would suddenly do a little dance and make the light blink on and off whenever we commanded full forward. We reduced the limit to 254 and it went away. Some software religious thing, I figured. It wasn't until after shipping that I was able to go back and realized that the 255,255 was the serial output initialization identifier. Everytime the second STAMP processor sees a 255,255 it thinks that there is a new stream of data so the next byte is PWM1 and the one after that is RelayA, etc.
The good thing was that I was able to help out another team at Nationals with this tidbit of information and they were able to get their 'bot up and working. They were quite grateful. |
|
#5
|
||||
|
||||
|
If it helps, the robot controller to operator interface data stream is documented in the dashboard port specification that is located on InnovationFIRST's website. We also have a link to it on our team's website: http://www.cvhsrobotics.org/resources.htm
Kevin Last edited by Kevin Watson : 18-01-2002 at 02:53. |
|
#6
|
||||
|
||||
|
that helps
thank you everyone!
|
|
#7
|
|||
|
|||
|
Just for the fun of it... has anyone tried to force the controller to send out a value of 256? Or turned a byte variable into a word and given it some random signal of 300? After reading this post I thought about trying it and I plan to try it durring the off season. Just wondering if anyone has already tried it.
|
|
#8
|
||||||
|
||||||
|
Quote:
|
|
#9
|
|||||
|
|||||
|
256 would become 0, since it works much like a car's odometer, if you go past the limit it starts all over again.
|
|
#10
|
|||
|
|||
|
Quote:
|
|
#11
|
|||
|
|||
|
I'm not sure why you would want to do this, but I guess curiosity is a good thing. More than likely, the robot controller would see the first byte of your new p1_y word variable as the p1_y byte and the second byte as whatever the next variable is supposed to be, like RelayA. My only question then would be which byte of the word variable would the serout command send first, the high byte or the low byte? I didn't see an answer after a quick perusal of the Stamp Manual, let us know if you find out.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PBASIC Syntax Question | Raven_Writer | Programming | 4 | 20-08-2003 08:07 |
| Question Obtaining Pbasic 2.5 | PyroPhin | Programming | 3 | 18-01-2003 01:26 |
| pbasic question | Mike375 | Programming | 14 | 15-01-2003 06:54 |
| PBasic Question | Melissa H. | Programming | 28 | 17-11-2002 18:53 |
| Another PBASIC Question | Ian W. | Programming | 4 | 31-01-2002 21:36 |