EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: streamDevice hex format input
From: Gorka Ronda <[email protected]>
To: Mark Rivers <[email protected]>, "Tian, Yuke" <[email protected]>, "[email protected]" <[email protected]>
Date: Mon, 13 Sep 2010 17:07:22 +0200
Thank you very much Mark! That was the problem!

-----Mensaje original-----
De: Mark Rivers [mailto:[email protected]] 
Enviado el: lunes, 13 de septiembre de 2010 16:34
Para: Gorka Ronda; Tian, Yuke; [email protected]
Asunto: RE: streamDevice hex format input

Hi Gorka,
 
Your protocol file indicates that you expect to receive 0xA0 0x55 0xAA, 0x5F, etc.
 

#    in "\xA0\x55\xAA\x5F";

#    in 0xA0 0x55 0xAA 0x5F

 

Actually that is exactly what you are receiving!

 

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_

 

\240 is in octal.  In decimal that is 160, and in hex it is 0xA0.

U is decimal 160, which is hex 0x55.

\252 is in octal, in decimal that is 170, and in hex it is 0xAA

_ is decimal 95, which is hex 0x5F

 

So you are getting exactly what you expect.  If you set the asynTraceIOMask to 0x4 you will see the input printed in hex.  You do need to read as raw to do the conversion you want.

 

Mark

 

 
 

________________________________

From: [email protected] on behalf of Gorka Ronda
Sent: Mon 9/13/2010 9:17 AM
To: Tian, Yuke; [email protected]
Subject: RE: streamDevice hex format input



Thanks Yuke, but I have received the same

 

Could be that I have to configure something on my IOC or somewhere else?

 

Gorka

________________________________

De: Tian, Yuke [mailto:[email protected]] 
Enviado el: lunes, 13 de septiembre de 2010 16:05
Para: Gorka Ronda; [email protected]
Asunto: RE: streamDevice hex format input

 

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
Sent: Monday, September 13, 2010 9:43 AM
To: [email protected]
Subject: streamDevice hex format input

 

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

 



References:
streamDevice hex format input Gorka Ronda
RE: streamDevice hex format input Tian, Yuke
RE: streamDevice hex format input Gorka Ronda
RE: streamDevice hex format input Mark Rivers

Navigate by Date:
Prev: RE: streamDevice hex format input Mark Rivers
Next: RE: debian package update to 3.14.11 Davidsaver, Michael
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: streamDevice hex format input Mark Rivers
Next: asynchronous record behavior apwagner
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 13 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·