Enable/Disable Digital Events - Exapnded Using OptoScript

I am attempting to disable all Alarm Events and Digital Events - Expanded using OptoScript on a SNAP-PAC-R1 controller. Here is what I am doing:

  1. Use PAC Manager to go to Events -> Alarm Events, then change HIGH ALARM to be Enabled for Alarm Number 0. Then click the Apply button.

  2. Use PAC Manager to go to Events -> Digital Events - Expanded, then change Event Enable/Disable to be Enabled and change ON Mask to be 0x1. Then click the Apply button.

  3. In my Strategy, the OptoScript has the following:

Manager_OptoMPPStatus = WriteNumToIoUnitMemMap(LOCAL, 0xFFFFF1100024, 0x0);
Manager_OptoMPPStatus = WriteNumToIoUnitMemMap(LOCAL, 0xFFFFF0D4004C, 0x0);
Manager_OptoMPPStatus = WriteNumToIoUnitMemMap(LOCAL, 0xFFFFF0D40000, 0x0);

  1. Run the strategy on the controller. When I do, the Alarm Number 0 changed to be disabled as expected. But, the digital event doesn’t change.

Am I missing something?

Hello Don,

Welcome to the OptoForums! What’s probably tripping you up is how 0 = Enabled. Guessing you really want to do is write a 4 instead of a 0 in your OptoScript code.

Here’s the relevant snippet from form 1465, our OptoMMP Protocol Guide:

Event 0: Event state:
0 = event is enabled but not occurring now
1 = event is occurring
2 = event has occurred and reaction has not been sent (in delay period)
3 = event has occurred and reaction has been sent (applies only if bit 8
in F0D4 0044 is set to send the reaction just once)
4 = event is disabled

I realize that’s a bit counter-intuitive, and I have a very vague recollection of why 0 was enabled (I think it had something to do with backward-comparability with the original Digital Events).

In any case, I have a little trick for figuring stuff out like this without having to use 1465 (just PAC Manager), but I’ll include that in another post.

Can you share a little about what you’re doing there? Interesting that you have a combination of OptoScript and Event - Reactions/Alarms. I’m guessing you have something a bit time-critical, or your adding a controller to a system which was already using brains with these features configured? Just curious!

Thanks,
-OptoMary

The “trick” I referred to above, is just to use the generic mem map option in PAC Manager, as I describe in this post. Rather than looking at PID settings like I did in [URL=“http://www.opto22.com/community/showthread.php?t=299&p=940&viewfull=1#post940”]that case, you’d just right-click in your Digital - Events area to copy the address for view in Other > Generic Read / Write.


Typically if I have something working in PAC Manager and I want to get the same functionality working in OptoScript, and I want to see what PAC Manager is REALLY writing to the mem map, I’ll use the Generic Read / Write option.

Hope that helps!

-OptoMary

Ah, yes, using 0x4 was it. I read Form 1465 for the Alarm settings, which worked, but I made a bad assumption that 0x0 was used for the Digital Events also. Thanks!

I took over a project where alarms and events were previously done using PAC Manager only. Very little was done with OptoScript in PAC Control. I’ve now written OptoScript code that does what the previous person was attempting to do with alarms and events and it works well. So, I want to make sure that any alarms and events that were set using PAC Manager are now disabled.

The problems we were having weren’t with the PAC Manager alarms and events. It was that the sensors we have throw out quick false readings once in a while. I wrote OptoScript code to monitor the sensors and make sure they are over their threshold settings for a period of time before acting on the condition.