Hi Ji Li,
Sorry for the delay in replying. Maybe you have figured this out?
If not, I have some questions:
Your .db file passes 3 arguments to the protocol file, %(P), $(Q), $(CMD). But in the protocol file I only see \$1 and \$2, not \$3. Is this correct?
You have commented out the line that defines the input terminator in the protocol file:
#InTerminator = 0x11;
How will asyn know when to return a string without a timeout if there is no terminator defined?
I think the protocol would be easier to read if you change this:
in "%d %*d %*d %*c%*c%*c%*c%*c%*c\n%*d %*d %*d %*c%*c%*c%*c%*c%*c\n" $ax_status;
to this:
in "%d %*d %*d %*6c\n%*d %*d %*d %*6c\n" $ax_status;
Mark
From: Li, Ji <liji at bnl.gov>
Sent: Thursday, December 24, 2020 5:36 PM
To: Mark Rivers <rivers at cars.uchicago.edu>
Cc: tech-talk at aps.anl.gov
Subject: 回复: Reading multiple parameters from an incoming message.
I was referring to the PV for RATEA -
$(P){$(Q)-Ax:A}:RATE:RBV.
Please see the attached files for the protocol, the database, the substitutions file, and the st.cmd. I only worked on Independent Condition to operate the two syringes separately.
For better clarity I removed other protocols/databases definitions.
The .proto file contains the definition of this protocol and the referenced macro.
I have several .db files for different categories of information (rate/volume/time/...). The attached .db file defines the status PV - currently only RATEA. I expect implementation
of other PVs that get values from this status message would be similar once I'm done with RATEA.
Hi Ji Li,
Can you send the rest of the database and protocol files, or at least the Status record and the $ax_status definition.
> The PV was showing INVALID(UDF_ALARM). Since the IOC didn't throw errors, I suppose the message was parsed correctly. How could this alarm have been caused?
Which PV are you referring to?
Mark
________________________________
From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Li, Ji via Tech-talk <tech-talk at aps.anl.gov>
Sent: Thursday, December 24, 2020 11:04 AM
To: tech-talk at aps.anl.gov
Subject: Reading multiple parameters from an incoming message.
Hi,
I'm working on an EPICS package for a Harvard Pump 33 DDS syringe pump using streamdevice protocols. I need to read several parameters from an incoming message that combines the status of two axes/syringes, which has the following format:
RATEA TIMEA VOLA STATUSA
RATEB TIMEB VOLB STATUSB
RATEA/B, TIMEA/B and VOLA/B are integers, and STATUSA/B are 6-character strings with each character indicating a specific status.
I'm trying to parse the message using multiple protocols and records. For RATEA, only grab the first integer:
Protocol:
=======================
getStatusRateAxA {
out "status";
in "%d %*d %*d %*c%*c%*c%*c%*c%*c\n%*d %*d %*d %*c%*c%*c%*c%*c%*c\n" $ax_status;
}
=======================
Record:
=======================
record(ai, "$(P){$(Q)-Ax:A}:RATE:RBV") {
field(DESC, "Axis A rate readback")
field(DTYP, "stream")
field(INP, "@pump33dds.proto getStatusRateAxA($(P), $(Q), $(CMD)) $(PORT)")
field(PREC, "0")
}
=======================
The .substitutions file referring to this record was loaded without errors. When I tried to retrieve status information, the IOC shell printed the following information without errors:
=======================
epics> 2020/12/24 11:29:06.797 /dev/ttyUSB0 write 8
status\r\n
2020/12/24 11:29:06.833 /dev/ttyUSB0 read 71
50000000000 0 22307784 w...I.\n83333333330 24723 2055394602192 i...I.\n::
=======================
"::" in the incoming message should be parsed by "$ax_status" in the protocol and it worked for other messages.
The PV was showing INVALID(UDF_ALARM). Since the IOC didn't throw errors, I suppose the message was parsed correctly. How could this alarm have been caused?
Best,
-Ji Li