_riosbc_set_toggle (BL4S200 -> RIO)


Has anyone of you ever got a _riosbc_set_toggle() to work ?!

What I need to do :
When I receive an input (from an Encoder) I need to send some pulses (very quick, to a comparator and then a motor).

Limits :
My cycle time between 2 encoder ticks (between 2 input rising edges) is 100us.
I need to send like 1 to 20 pulses of 4us during that cycle. But I need to count them to stop after X. So the optimal solution for the timing is to be on the same “block” on the same “rio”, so I could use the same clock / register to send my pulses. So I want to put my Output to “1” and it would toggle ON/OFF on itself with the “toggle” feature.
Because I know my RIO’s clock speed, and the Toggle Scaler, if I want to send 10 pulses, I know when to stop the Ouput and put it back to 0.

1 Input (encoder)
1 Output (motor)

When I receive the input, I “BEGIN” the block’s counter and Activate my Output until Match0. (Mode = Timer until any match)
So that way the “Toggle” would ON/OFF my signal until the counter reaches Match0 (which will be set to NBPulses * TickPerPulses).

I hope I am clear… But anyway, all I need is to get _riosbc_set_toggle() to work. In the RIO lib file is says that the PIN needs to be set to a PWM. No problem, I would set the PWM with 100% duty and my Frenquency will match my Match0 Register. So it will be like having an output ON from BEGIN to MATCH0.