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