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  2010  2011  <20122013  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  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: asyn w/serial device pushing data
From: Eric Norum <[email protected]>
To: "Fong, Nia W." <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Mon, 2 Apr 2012 12:33:53 -0700
The example shown is for a device that produces a message on request.

In your case the device sends unsolicited messages so your plan to invoke readIt rather than writeRead is correct.   You would then not need the epicsThreadSleep -- just make sure that the timeout specified in the readIt invocation is longer than the expected time between hardware triggers.  
If you've interposed the EOS processing module the readIt routine will not return until timeout or receipt of the end-of-string character.

On Apr 2, 2012, at 12:16 PM, Fong, Nia W. wrote:

> Hi,
> 
> I'd like to use asynPortDriver to connect to a serial device that pushes data when triggered by a hardware pulse.
> 
> If I use SCAN=I/O Intr and the pollThread() example code below from a previous tech-talk thread will my record be triggered to read every time there is new data?  Does this code mean my driver is constantly polling the serial port at a POLL_DELAY?
> 
> I only need to read, so can I call pasynOctetSyncIO->readIt() instead?  
> 
> How will I know that the serial device has finished pushing it's data for that trigger?  Does asyn/pasynOctetSynIO->readIt() wait for the OutputEos in the serial buffer before returning the received message?  Or is asyn waiting to read sizeof(receiveMessage) characters?
> 
> 
>> void myPortDriver::pollThread()
>> {
>>    while(1) {
>>          status = pasynOctetSyncIO->writeRead(pasynUserHMS, sendMessage, numSend, 
>>                                         receiveMessage, sizeof(receiveMessage), 
>>                                         WRITE_READ_TIMEOUT, &numSent, responseLen, &eomReason);
>>          sscanf(receiveMessage, "TEMP=%f,CURRENT=%f", &temperature, &current);
>>          setDoubleParam(temperatureParam, temperature);
>>          setDoubleParam(currentParam, current);
>>          callParamCallbacks();
>>          epicsThreadSleep(POLL_DELAY);
>>    }
>> }
>> 
> 
> 
> Thank you in advance for any suggestions or comments.
> 
> Nia 

-- 
Eric Norum
[email protected]






Replies:
Re: asyn w/serial device pushing data Eric Norum
References:
asyn w/serial device pushing data Fong, Nia W.

Navigate by Date:
Prev: asyn w/serial device pushing data Fong, Nia W.
Next: Re: asyn w/serial device pushing data Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: asyn w/serial device pushing data Fong, Nia W.
Next: Re: asyn w/serial device pushing data Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·