Hello, I have a call logged with OPTO support on this topic, but rather than re-invent the wheel, here goes:
I need to send a digital output pulse for a short duration (through a ODC5SRC on an EB2) using OPTOMMP.
Basically, setting the output ON for xx msecs, then OFF after the interval expires (no less than 50ms, no greater than 5000ms).
The time (or delay) needs to be done on the EB2, as the PC that our software runs on can not be relied on to be precise in the interval between when we send the ON and then when we send the OFF.
(The OPTOMUX protocol did have a command for this: Start On Pulse (k) ).
By code snippet, do you mean OptoScript? (Do you have a control strategy in the mix?) If not, you can do it w/out a strategy (not as pretty) via the Mem Map a couple of different ways; is it a one-off that you’ll trigger from the PC/PAC, or are you looking for a pulse train? How often will you change that interval (50ms - 5000ms) that you mentioned?
Lets not forget SoftPac…if you are using Pac Display, this would be no brainer. On the other hand I do like the idea which I had not thought about using memmap. I need to consider using that in one of my problem programs…
No to the OptoScript - I am using a language (Delphi) and calls to the OPTOMMP library.
So, by code snippet I guess we are looking at pseudo code. What I am doing is opening a valve (one time, no pulse train required), from anywhere from 50ms to 5000ms.
This is currently done by sending a digital ON, wait on the PC for the desired time, then send a digital OFF.
This generally works fine however when getting down to the 50-100ms range we believe the pulse duration as managed by the EB2 would be more reliable and accurate.
The actual interval is changed about every 5000 - 15000 ms, so this does need to be updated quite frequently, as opposed to setting it (for example) on power-up.
If you use SoftPAC (or PAC Sim for free! for 12-hours at a time), it’s super easy, you’d use the command:
StartOnPulse(On Time (Seconds), On Point)
which takes just those 2 parameters, but handles the under-the-covers configuring of the pulse which the EB2 does itself.
Otherwise, there are ways of setting up similar pulses or “digital events” (AKA event-reactions) via the Mem Map but they’re NOT PRETTY.
As an example… you could have one that’s triggered by the digital ON, delays for X ms, then has the reaction be to turn of that same output. But do you have situations where that output might come on for some other reason (and wouldn’t ALWAYS need to be shut for that X amount of time later)?
Here’s a screen shot of what that would look like, in this case where X = 50 ms and I’m controlling the 1st point on the module that’s not right next to the brain, but the next position over:
Note that once I got it configured and working as I wanted in PAC Manager, I used the “Generic Read/Write” to figure out exactly what I need to write to that address F0D4 0044 which configures a few different pieces of the puzzle…