Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:57 01 Mar 2026 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : PicoMite V6.02.01 betas

     Page 7 of 7    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10998
Posted: 02:01pm 28 Feb 2026
Copy link to clipboard 
Print this post

V6.02.01b

PicoMiteV6.02.01b7.zip

All versions
Various internal tidying and coding improvements
New command ONESHOT

  Quote  ONESHOT triggerPin, sense, outputPin, prePulseDelay, pulseWidth
or
ONESHOT DISABLE

Will configure a background one-shot pulse generator.

When the selected trigger edge is detected on 'triggerPin', MMBasic starts a delay of 'prePulseDelay' microseconds, then toggles 'outputPin'.  After 'pulseWidth' microseconds it toggles 'outputPin' again.  This creates a pulse in the opposite sense to the output pin's idle state.

'sense' selects the trigger edge and can be POSITIVE (also POS or RISING) or NEGATIVE (also NEG or FALLING).

Timing is interrupt driven and non-blocking.  Delay and pulse width are specified in microseconds.

Notes:

'outputPin' must be OFF or DOUT when ONESHOT is configured.

If 'outputPin' is OFF it will be configured as DOUT and driven low before ONESHOT is armed.

If 'outputPin' is already DOUT, its current state (high or low) is preserved and the generated pulse is the opposite polarity.

Only one ONESHOT configuration can be active at any one time.

Additional triggers received while ONESHOT is in the pre-pulse delay period or while the pulse is active are ignored.

ONESHOT DISABLE stops background operation, cancels pending timing events and restores the output pin to its idle state if a pulse was in progress.

ClearExternalIO() also disables and clears ONESHOT background activity.

The trigger and output pins must be different pins.

Example:

SETPIN GP2, DIN
SETPIN GP3, DOUT
ONESHOT GP2, POSITIVE, GP3, 50, 200

This waits for a rising edge on GP2, delays 50µs, toggles GP3, then toggles GP3 again 200µs later.
 
     Page 7 of 7    
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026