Radio control feed back using pulsin HELP

Hi all
I am building a 1/8th scale tank and i have found that when traveling slow is works ok but when it gets to a steep incline i have to blip the stick forwards to give it a bit of extra boost. I have put a shaft encoser on the back of the motor and reading it using pulsin reading it in input pin 0, and was hoping to read the radio control singel into input pin 1, So if the tank came to an incline and the motor slowed down the 14M would detect it and increse the mark space ratio for me to keep it at a constant speed heres what ive got to so far. I do not get a constent number from the encoder so the test servo jumps around> HELP HELP required

start:
pulsin 0,1,b1
debug
if b1 > 31 then servo 1,130
else servo 1,100
end if
pause 20
goto start

Regards Andy Quirot
Jersey Channel Islands
 

lbenson

Senior Member
I think I've read that "debug" messes with some commands (and it takes a long time to execute). It is usually much easier to just look at the registers you want to. To just see the value of b1 which you have read in with pulsin, try

sertxd(#b1)

The "#" converts the value to ascii for display on the terminal.

If you believe the problem may be with the encoder, you will have to provide more information--schematics and photos.
 

Wrenow

Senior Member
Hi Andy,

I have also had flakey pulsin reads, resulting in jittery servos. Interestingly when I read 2-3 channels in (read the RX channels in sequential order, please on older non-2.4gHz systems), only the first channel read was an issue. I had thought that it might be an issue with the input pin floating, and was going to tie it high or low, but the issue went away when i started using the 08M based 3 servo controller board (I used the servo inputs as outputs). I now have that board as the basis for my FCA (Fire Control Asistant) that modifies the stern turret behaviour based on the targeting of the forward turret array (R/C Model Warship Combat - http://www.ntxbg.org). Saved a ton of development fiddling, as the power filtering, etc. is built in It takes the Fwd traverse angle, Aft traverse angle, Depression (range) signals from the RX, does the maths and logic to see if the aft turret can engage (roughly converging fire), and if so, overrides the Aft traverse angle. with the proper angle for converging fire. If not, it merely passes the RX signal on. This requires 3 ionputs, one output. I use two of the normal servo outputs and the other input that is available elsewhere in the board as the inputs and the remaining servo output as the output. The only modification to the board is including the extra servo signal inoput pin (OK, I added an extra Ground pinas well).

Also, instead of using the servo command, if your are getting pulses form the RX, that is handling the servo frame timing, and you may be better off usiing pulsout (then there is also no reason for the pause here - the pause is effectively handled by the pulsin). Not sure how this will interact with your encoder, however.

Another point: the behaviour you are describing is pretty typical with real life (having to give a little extra throttle to go up hills), and realistic. I would have thought the point would be to simulate real behaviours as well as possible?

Cheers,

Wreno
 
Top