Hi I am a student working at Edwards Accelerator lab and I am trying to toggle a relay on and off. I am using the EPICS IOC (7.0) and I am interfacing with it using CS-Studio to control an Agilent technologies 34980A. I am really new to EPICS and Controls systems
using databases.
Goal: I want to use a toggle button in CS-Studio. All CS-Studio does is write a 1 or 0 to a PV when the toggle button is toggled on or off so it is not the focus of the problem
Current working system: Currently I can get the relay to toggle with two buttons that have passive bo records. All the buttons do is call a caput command that puts 1 in VAL of the record. The record is processed, correct me if in wrong, because with SCAN set
to passive any event that updates VAL will make the record do its process. My code is below.
record(bo, "$(P)$(R)relay1off"){
field(DESC, "set parameter relay1")
field(DTYP, "stream")
field(SCAN, "Passive")
field(OUT, "@devKS_34980A_EPICS.proto setRouteOpen(5001) $(PORT) $(A)")
field(PINI, "YES")
}
record(bo, "$(P)$(R)relay1on"){
field(DESC, "set parameter for relay1")
field(DTYP, "stream")
field(SCAN, "Passive")
field(OUT, "@devKS_34980A_EPICS.proto setRouteClose(5001) $(PORT) $(A)")
field(PINI, "YES")
}
Question/problem with event record: The question is how to a make a controlling record that can conditionally call the on or off record based upon the VAL of that controlling record.
My guess would be using the event record like I had written below. I think it's supposed to work in the following way. When the VAL of the event record is set by CS-Studio it should cause the record to cause an event with VAL as the event number 0 or
1. With both records that control the relay with scan field set to event this should cause them to process toggling the relay. This did not work for me. I am unsure why and I didn't encounter any error messages. I am open to suggestions on how to accomplish this
goal in different ways or let me know if I just missed something in my code that needs fixed. Thanks!
record(bo, "$(P)$(R)relay1off"){
field(DESC, "set parameter relay1")
field(DTYP, "stream")
# field(SCAN, "Passive")
field(SCAN, "Event")
field(EVNT, 0)
field(OUT, "@devKS_34980A_EPICS.proto setRouteOpen(5001) $(PORT) $(A)")
field(PINI, "YES")
}
record(bo, "$(P)$(R)relay1on"){
field(DESC, "set parameter for relay1")
field(DTYP, "stream")
# field(SCAN, "Passive")
field(SCAN, "Event")
field(EVNT, 1)
field(OUT, "@devKS_34980A_EPICS.proto setRouteClose(5001) $(PORT) $(A)")
field(PINI, "YES")
}
record(event, "$(P)$(R)toggleRelay"){
field(SCAN, "Passive")
field(PINI, "YES")
}
|