Reading RCTIme into a byte
alnajjar1
Posts: 110
I am controlling a miniSSC (by Scott Edwards) from a BS2. The BS2 reads the value of the pots from a joystick and translates this into the miniSSC. The problem is that the value from the pots can only be read as words, while the values I have to shoot to the servo controller are in bytes.
To do a meaningful translation from a word to a byte, I have to know the max-min range on the RCTime value then do the simple conversion math. The issue here is speed. I don't want to wast so much time doing math every time there is a change in the joystick.
I tried to match the RxC constant so that the total time value stays roughly 0-200 (using the simplified calculation in the manual of 635xRxC) so that I can store the RCTime result in a byte but that doesn't seem reliable - in fact it doesn't work,
Any suggestion how I can rig this so that RCTime reading is in a byte that I can sent without any acrobatics to the miniSSC?
I am not worried about a high resolution reading from the pots. A range of 0-127 is plenty for my purposes.
many thanks in advance,
Al
To do a meaningful translation from a word to a byte, I have to know the max-min range on the RCTime value then do the simple conversion math. The issue here is speed. I don't want to wast so much time doing math every time there is a change in the joystick.
I tried to match the RxC constant so that the total time value stays roughly 0-200 (using the simplified calculation in the manual of 635xRxC) so that I can store the RCTime result in a byte but that doesn't seem reliable - in fact it doesn't work,
Any suggestion how I can rig this so that RCTime reading is in a byte that I can sent without any acrobatics to the miniSSC?
I am not worried about a high resolution reading from the pots. A range of 0-127 is plenty for my purposes.
many thanks in advance,
Al
Comments
Note that you can use a byte variable in an RCTIME statement and the 16-bit result will be truncated to 8 bits (0-255) before storing it.
I did fix the problem by adjusting the angle of the pot and using a couple of small resistors in parallel as you recommended to the get the scaling just under 255. Many thanks.
Al