Shop OBEX P1 Docs P2 Docs Learn Events
Programming very short delays (BS2) — Parallax Forums

Programming very short delays (BS2)

JohnnyBJohnnyB Posts: 13
edited 2006-03-08 05:17 in BASIC Stamp
I have a project where I need to delay an incoming signal by as little as 30us. The signal frequency ranges up to 200 hz.·

For now I've written this little program:

INPUT 3
DO
IF (IN3 = 0) THEN OUT7 = 0
IF (IN3 = 1) THEN PULSOUT 7, 1000
LOOP

This replicates the signal input on pin 3 to an output on pin 7 but does not delay the signal....at least not by a means controllable by the program.....there is some delay for processing time.

I can't use the pause command because having a minimum 1ms value it's a way larger delay than I need. Is there a good way to do this? Is it even possible at the speed of a BS2.

Could I insert a nested loop with a variable that changed the loop count to achieve various delays below 1ms?

I'm new at this so be kind [noparse]:)[/noparse]
Thanks,
JohnnyB

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-03-08 05:17
    About the shortest delay you can do is PAUSE 0 -- and that's about 100 us.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
Sign In or Register to comment.