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 2025 | 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 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | RE: streamDevice hex format input |
From: | "Tian, Yuke" <[email protected]> |
To: | "Gorka Ronda" <[email protected]>, <[email protected]> |
Date: | Mon, 13 Sep 2010 10:04:34 -0400 |
Hi Gorka, I found if you want to read raw byte, you need to use in “%4.4r” as the input format. Please give a try. The Streamdeive
document doesn’t clearly mention this. -Yuke From:
[email protected] [mailto:[email protected]] On
Behalf Of Gorka Ronda Hi all, I’m using streamDevice, attempting to
communicate with a device sending and receiving in hex format. I achieve to
make right the sending, but I have problems with the receiving. I write the
following in the protocol file: ################################################################## cmd1 =
\xC0\x01\xFE\x00\x00\x00\x00\x00\x00%<xor>; c1 { out "\$cmd1"; # in
"\xA0\x55\xAA\x5F"; # in 0xA0 0x55 0xAA 0x5F # in "%s"; in "%*4r"; } ################################################################### Like you could see I try different options
for input, but any of those and others I try work for me. I like to have an
input in hex like, 0xA0 0x55 0xAA 0x5F or A0 55 AA 5F in my soft IOC. Instead,
I have the following, which could be ASCII: ############################################################## epics> 2010/09/13 15:20:08.440
/dev/ttyS0 read 1 \240 2010/09/13 15:20:08.442 /dev/ttyS0 read 3 U\252_ ############################################################### What I have to write exactly for the input? This is the record I use for that command.
What type of record should I use? ########################################################## record(bi, "$(P)$(R)C1") { field(DESC,
"Comando 1") field(DTYP,
"stream") field(INP, "@devwbc6600.proto
c1 $(PORT) $(A)") } ############################################################## This is the st.cmd file: ############################################################################### cd ${TOP} ## Register all support components dbLoadDatabase
"dbd/wbc6600test.dbd" wbc6600test_registerRecordDeviceDriver
pdbbase ############################################################################### # Set up ASYN ports # drvAsynSerialPortConfigure port ipInfo
priority noAutoconnect noProcessEos drvAsynSerialPortConfigure("L0","$(TTY)",0,0,0) asynSetOption("L0", -1,
"baud", "115200") asynSetOption("L0", -1,
"bits", "8") asynSetOption("L0", -1,
"parity", "none") asynSetOption("L0", -1,
"stop", "1") asynSetOption("L0", -1,
"clocal", "Y") asynSetOption("L0", -1,
"crtscts", "N") asynOctetSetInputEos("L0", -1,
"\n") asynOctetSetOutputEos("L0", -1,
"\n") asynSetTraceIOMask("L0",-1,0x2) #0x7
para todos los mensajes asynSetTraceMask("L0",-1,0x9) #0x1f
para todos los mensajes ############################################################################### ## Load record instances dbLoadRecords("db/devwbc6600.db","P=$(P),R=$(R),PORT=L0,A=0") dbLoadRecords("db/asynRecord.db","P=$(P)$(R),R=asyn,PORT=L0,ADDR=-1,OMAX=0,IMAX=0") ############################################################################### ## Start EPICS cd ${TOP}/iocBoot/${IOC} iocInit ###################################################################### Thanks in advance, Gorka |