Shop OBEX P1 Docs P2 Docs Learn Events
Delay smaller than 1mS — Parallax Forums

Delay smaller than 1mS

BriceHBriceH Posts: 10
edited 2011-07-15 10:03 in BASIC Stamp
This is for the BS2p2...
I need a delay shorter than what Pause 1 produces (1 milisecond), more like in the area of 200 to 300 microseconds.
Thumbed thru the manual and did'nt find any other commands.
Trying to build a programmer for the Melexis 90215 hall effect device.
Thanks... Brice.

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-07-14 23:21
    You could use the PULSOUT command on a spare pin. You will have to accommodate the Stamp's command overhead, too, so some trial and error with a scope is advised.

    -Phil
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2011-07-15 10:03
    To follow up on what Phil suggested, the execution time for a PULSOUT command is close to 220 microseconds on a BS2, plus whatever is in the time parameter (in units of 2 microseconds). So PULSOUT 0,0 gives a delay of 220 µs, and PULSOUT 0,50 adds 100 µs to that. There are slight variations depending on which spare pin is used and position of the command in the program, so the 'scope helps if you need accuracy.

    There are other ways to do this too. For example, the command x=1 chews up about 180 µs, and x=1+1 chews up about 320 µs. I have a chart of execution times posted here.
Sign In or Register to comment.