Hey Chunxia,
you could try the following:
Statements in the db file:
recorrd(ai, "$(P)$(R)read")
{
field(DESC, "read pressure")
field(DTYP, "stream")
field(INP, "@pressure.proto SendCommand(9) $(PORT)")
field(SCAN, "1 second")
}
Statements
in the protocol file is like this:
SendCommand{
out $1;
in "%f";
}
Without quotes, the variable is assumend to be the decimal value
of one byte, so it will send one byte with value '9' to your
device, just like "\x09" would do.
HTH,
Florian
Am 21.08.2020 um 03:43 schrieb yincx---
via Tech-talk:
Hello everyone,
I am using the stream device to gat data from a device, and have a problem about format conbersion. I
hope to get some advice and will appreciate for your help.
I want to send data, such as
"09", in hexademical format to the
device. the device will return a float data %f.
Statements in the db file:
recorrd(ai, "$(P)$(R)read")
{
field(DESC, "read pressure")
field(DTYP, "stream")
field(INP, "@pressure.proto SendCommand(09) $(PORT)")
field(SCAN, "1 second")
}
Statements
in the protocol file is like this:
SendCommand{
out "\x\$1";
in "%f";
}
when I run the st.cmd, an
error occurs:
Hex
digit expected after \x: "\X""
if "09" is send directly, not as a variable "\$1":
SendCommand{
out "\x09";
in "%f";
}
everything goes well and I can
get the returned %f correctly.
I wonder how can I send "09"
as a variable? How to change a variable in the record to be
hexadecimal?
Thank you very much for any
advice, I will try it and give feedback.
Bset wishes
Chunxia Yin
--
Ruhr-Universität Bochum
AG der Experimentalphysik I
Dr. Florian Feldbauer
NB 2/131 / Fach 125
Universitätsstr. 150
D-44801 Bochum
Office: NB 2/134
Phone: (+49)234 / 32-23563
Fax: (+49)234 / 32-14170
https://paluma.ruhr-uni-bochum.de
- References:
- data format conversion yincx--- via Tech-talk
- Navigate by Date:
- Prev:
data format conversion yincx--- via Tech-talk
- Next:
Re: Tech-talk Digest, Vol 14, Issue 462 Gofron, Kazimierz via Tech-talk
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
<2020>
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
data format conversion yincx--- via Tech-talk
- Next:
Re: Tech-talk Digest, Vol 14, Issue 462 Gofron, Kazimierz via Tech-talk
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
<2020>
2021
2022
2023
2024
|