Hi,
You may have to have that extra record, although there’s usually a few ways of doing this.
In the bo record documentation it says:
If closed_loop is specified, the VAL field’s value is obtained from the address specified in the Desired Output Link (DOL) field which can be a database link or a channel access link,
but not a constant.
The HIGH field function will set VAL back to 0, so after the first processing you’re writing 0 each time instead of 1, unless you have that second record writing a new 1 each time.
It might make it easier to digest by renaming the record ‘Go’ (or similar), instead of ‘Constant’, and use another bo instead of longout, like:
record(bo, “Go”) {
field(VAL, “1”)
field(OUT, “MoveToPos PP”)
}
record(bo, “MoveToPos”) {
field(OUT, “$(MOVE_OUTLINK) PP”)
field(HIGH, “1”)
}
Or, you could incorporate a seq record to write the position and trigger the move:
record(seq, “MoveToPos”) {
field(DLY0, “0”)
field(DOL0, “SelectAbsPos”)
field(LNK0, “$(POS_OUTLINK) PP”)
field(DLY1, “0”)
field(DOL1, “1”)
field(LNK1, “$(MOVE_OUTLINK) PP”)
field(DLY2, “1”)
field(DOL2, “0”)
field(LNK2, “$(MOVE_OUTLINK) PP”)
}
Also, this FLNK line:
field(FLNK, "MoveToPos PP")
doesn’t need the PP link attribute.
Cheers,
Matt
record(longout, "Constant1") {
field(VAL, "1")
field(OUT, "MoveToPos PP")
}
record(bo, "MoveToPos") {
field(HIGH, "1")
}
From: Tech-talk <tech-talk-bounces at aps.anl.gov>
On Behalf Of Majer Karel via Tech-talk
Sent: Thursday, April 23, 2026 3:45 AM
To: tech-talk at aps.anl.gov
Subject: [EXTERNAL] BO which should switch to 1 whenever processed
Hello, I would like to have a BO record which sets its value to 1 whenever processed (without necessarily writing 1 to VAL), then back to 0. It's
part of PLC-based motion control IOC. The database should allow moving the motor to saved waypoint
I would like to have a BO record which sets its value to 1 whenever processed (without necessarily writing 1 to VAL), then back to 0.
It's part of PLC-based motion control IOC. The database should allow moving the motor to saved waypoint positions; it looks like this:
record(ao, "Waypoint1") {
record(longout, "WaypointIdx") {
field(FLNK, "SelectAbsPos")
record(sel, "SelectAbsPos") {
field(NVL, "WaypointIdx")
field(FLNK, "DesiredPos")
record(ao, "DesiredPos") {
# field(OUT, "OUTLINK") link to PLC
field(DOL, "SelectAbsPos")
field(OMSL, "closed_loop")
field(FLNK, "MoveToPos PP")
The processing chain is WaypointIdx -> SelectAbsPos -> DesiredPos -> MoveToPos
MoveToPos is a BO which tells the PLC to start motion, and it must have HIGH field set to non-zero. I'm having a problem triggering its processing in
a way that its value becomes 1.
# field(OUT, "OUTLINK") link to PLC
field(OMSL, "closed_loop")
I expected that processing the record would set VAL to 1, then back to 0 after 1 second. It works only once; subsequent processing does not switch value
back to 1. Writing 1 into VAL works as expected. Is this the correct functionality of the BO record?
I ended up with the following construct, which provides the desired functionality, but I don't much like having a record which only holds a constant value to be put into
the BO. Is there a better way to do this?
record(ao, "DesiredPos") {
field(DOL, "SelectAbsPos")
field(OMSL, "closed_loop")
record(longout, "Constant1") {
field(OUT, "MoveToPos PP")
record(bo, "MoveToPos") {
Karel Majer | Senior software developer
Phone: +420 266 051 514
E-mail: karel.majer at eli-beams.eu
|
|
ELI Beamlines Facility|The Extreme Light Infrastructure ERIC
Za Radnicí 835, 252 41 Dolní Břežany, The Czech Republic
www.eli-beams.eu
|