Hi Will,
I think my approach in this case would probably be an SNL program.
-
Add a bo record to disable the motor and set the motor record SDIS field to point to that record
-
SNL program reads from the VAL fields of the other records and writes 1 to the disable record
I don’t know if this actually prevents the motor from moving in all cases but I just did a simple test and it worked. I issued the following commands:
# Set the SDIS field to be a bo record
caput 13IDD:m15.SDIS 13IDD:Unidig1Bi15
# Set the bo record to 0. I tested that I could move the motor.
caput 13IDD:Unidig1Bi15 0
# Set the bo record to 1. I tested that I could not move the motor by typing into either the VAL field or pushing the tweak buttons.
caput 13IDD:Unidig1Bi15 1
Note that if the logic is simple enough you may be able to do it in a calcout record, rather than an asub or SNL.
If this is an “interlock” with serious consequences if it does not work then I would suggest a PLC solution and not software!
Mark
From: Tech-talk <tech-talk-bounces at aps.anl.gov>
On Behalf Of William Cork via Tech-talk
Sent: Wednesday, July 8, 2020 4:07 AM
To: tech-talk <tech-talk at aps.anl.gov>
Subject: Get/Set Local Variable in motorAxis From sub Record
Hi All,
I'm trying to find the best solution to interlock motion from multiple other records. My current thinking is to link the VALs of these records to a sub record and have the C function modify a variable within the motor driver.
The issue I have is that I cannot find a way to link the instance of the drive I would like to have access to in the sub record process function. Is there a way to pass a reference of a controller instance to a subroutine process function?
Is there a simpler solution to this? Could the result of the sub record be linked to a field in the motor record to prevent motion?