EPICS Home

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: hex stream processing with StreamDevice?
From: "Barker, Alan M." <[email protected]>
To: "[email protected]" <[email protected]>
Date: Wed, 18 Aug 2010 21:01:26 -0400
Hi Tech-talk, I am trying to build a softIOC to support the ANSI C12.22

communications protocol. C12.22 supports TCP/IP Server/Client messaging

where messages are hex streams of the format



<packet> ::= <stp><identity><ctrl><seq-nbr><length><data><crc>
<ack>    ::= 0x06
<nak>    ::= 0x15



where <stp>,<identity>,<ctrl>,<seq-nbr> are always bytes, <length> and

<crc> are always 2 bytes, and how many bytes of <data> is defined by

<length>.



Messages are typically sent in Request/Response pairs, i.e. the client

will ask the server for something, and the server will respond.
The first byte in a request's <data> indicates the message "type", such as

read or write data to a device. The first byte in a response's <data> is

0x00 for OK, or various other error codes.



Here is an example identification request (0x20) and response to the

request (values shown are hex). You learn from the server its standard is

0x00, version is 0x02, and revision is 0x00.



Client: EE0000000001201310
Server: 06
Server: EE00000000050000020000C6B5
Client: 06



I am new to EPICS, but have seen that StreamDevice with Asyn can send and

receive hex values. Most of the examples I have seen are for simple ASCII

commands like requesting "VOLTAGE?" and receiving "VOLTAGE=120".



In the context of EPICS, where do I parse the incoming hex stream? Where

do I assemble the outgoing hex string? Where do I do my processing (like calculating the CRC)? In a

genSub? Calc record? State Notion Language? Link to a c file?



Are there any examples out there of sending and processing hex streams?



Thanks,



Alan Barker, ORNL

RHEL 5.5, EPICS R3.14.11, asynDriver R4-14, StreamDevice-2




Replies:
RE: hex stream processing with StreamDevice? Mark Rivers
Re: hex stream processing with StreamDevice? Dirk Zimoch

Navigate by Date:
Prev: Re: ASYN Addition Andrew Wagner
Next: RE: ASYN Addition Mark Rivers
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: JCA2 question Michael Oothoudt
Next: RE: hex stream processing with StreamDevice? Mark Rivers
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