How can I pass ANY IO unit to a subroutine

I want to write a subroutine that will allow a chart to pass any IO unit type to it in order to perform memory map commands on it.

If I set the parameter type to “Generic OptoMMP Device”, then I can’t pass an R1 to it, etc. Can PAC Control be modified to allow any IO Unit type to be passed to a Generic OptoMMP Device parameter?

You also can’t add the IO Unit twice to the strategy as a generic OptoMMP device, since it won’t allow duplicate IP addresses, so I haven’t found a work around, other than to write a sub for each type of IO unit, which is not very DRY.


I must be missing something really obvious here… but why does the unit type matter?
You can get to any and all of the mem map addresses and data regardless of the unit type?
(I have faint memories of doing this - they could be wrong, but …)

The Types for subroutine parameters have very strict type checking on IO units.

I would like to use a single subroutine for any type of IO unit (Generic OptoMMP Device, EB1, E1, R1, R2, etc.).

I want to access the memory map of whatever IO unit I am sending to the subroutine. I was hoping that by selecting Generic OptoMMP Device as the parameter type, I would be able to pass an R1 to it (Like passing an analog point in a float parameter), but if I do that I will get “Invalid type for argument #”.

To be honest, it seems strange to have a bunch of different types for different IO units available- are there any commands that are IO unit type specific?

Can you just make everything a PAC R1??
Its got all the features and you can do anything you need with an EB2 as an R1.

Yep, that would probably do it. At first I thought you wanted me to buy new hardware! Hah! Someone must of put decaf in the coffee pot this morning.

I actually found a work around. If I assign the IO unit to a pointer table, I can then pass the pointer table into the subroutine and then assign that to a local Generic Opto MMP Device pointer which I can then use to call the IO unit commands. Kind of a silly way, but it works and I am happy.

In summary, I can assign any IO unit type to a Generic OptoMMP Device pointer, but not to a Generic OptoMMP Device parameter.

Heh, I did not even think of that idea until I read your post!!!
Thanks for the smile… and yeah, you should just buy all R1’s!!!

That is a pretty sweet work around. Thanks for posting it.

You got my vote for salesman of the year!