Shop OBEX P1 Docs P2 Docs Learn Events
Problems With Program — Parallax Forums

Problems With Program

TomLTomL Posts: 15
edited 2006-10-04 18:17 in BASIC Stamp
Why don't this program work right?

It should pulsout r/c signals after the deadband limits are reached. It pulses out, but only after every other r/c pulse input.

I thought it should pulse out everytime it reads pulses after the deadband limits are satisfied.. R/C pulses in are every 18 ms, but my prog only pulses out every 36 ms after deadband limits.

What boat did I miss here?

Post Edited By Moderator (Chris Savage (Parallax)) : 10/3/2006 7:06:05 PM GMT

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-10-03 19:29
    TomL -

    The logic of the program seems basically okay. Do you happen to have a Stamp BS-2SX or anything faster than a plain BS-2 handy, just for testing purposes?

    It's possible, albeit not probable, that the signals are arriving faster than the BS-2 can process them, and that's how they're getting lost. Just one thought among many.

    Regards,

    Bruce Bates

    Post Edited (Bruce Bates) : 10/3/2006 7:38:50 PM GMT
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-10-03 19:37
    Huh. Outputting the pulse should take less than 2 mSec, worst case, so your code should be waiting in the "PULSIN" most of the time, all of which is correct. Are you SURE the pulse is a zero-one-zero pulse? I believe it should be, and your '1' state on your PULSIN is correct for that.

    I think you're missing the "LOW Servo" statement, which would make the 'default' state of the output pin low -- but that shouldn't matter.

    Bottom line -- I'm not seeing anything 'wrong' with your code. Possibly it's a grounding issue -- you DO have all grounds connected together, right? It could also be a 'reset' issue -- not likely, but possible.
  • TomLTomL Posts: 15
    edited 2006-10-03 22:33
    I checked everything with my O'scope. Futuba receiver output: Ov low, 5v High. Duration of pulse measured at the input pin of the bs2. Output duration also measured at bs2 pin. Grounds are good. Output is a low going high pulse. Duration of input pulse at null is 1.5 ms at 18 ms intervals.

    There is no output pulse until I breach the parameters, then the proper length pulses show up, but at 36 ms intervals.

    Debug? drive (ref program) displayed ~750 count at null (what I expected) and this value decreased or increased relative to the joy stick.

    Tried both greenies and reddies. Same results. I don't have a sx to try, but looks like I should have all day long to do this simple task. I also tried another servo (using a Futuba S3004). No luck.

    I am stumped.
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-10-04 01:21
    Output should be 'normally low', with a 'high' pulse every 18 mSec.

    Oh, you didn't mention if all your grounds are tied together.
  • TomLTomL Posts: 15
    edited 2006-10-04 01:30
    Yep. norm low with high pulse every 18ms (recieve pulse) checked ok with scope

    Yep. grounds good.

    Using BOE for testing. VDD = power to radio receiver VSS = ground to radio receiver

    metered ground to receiver and to servo and to vss and to gnd pins on bs2. all ok.

    I am puzzled.
  • TomLTomL Posts: 15
    edited 2006-10-04 15:00
    Prog still don't work properly.

    totally rewired circuit using different ports.

    changed program somewhat, but still same results.

    I know this circuit is hooked up properly.

    What is going on here?
  • TomLTomL Posts: 15
    edited 2006-10-04 16:02
    Fixed my own problem. Added a small pause at start of program. I don't know why this worked, but it did. My project can now be completed with this fix.

    Can anyone explain this fix?

    Thanx,


    Tom

    Post Edited (TomL) : 10/4/2006 4:08:01 PM GMT
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-10-04 18:17
    Brilliant solution. Might have to do with rise-fall times, then. By putting a 1 mSec pause in your 'main' loop (you call it 'start:') it looks like you insured that the PULSIN wouldn't get confused and wait for the second pulse after the one it had just measured.

    It almost looks like "coupling" noise from your servo output pulse. I could hypothesize all day. The way to solve it would be to put an o'scope on the signal and see what you see.

    I'm just glad you found a way to fix it.
Sign In or Register to comment.