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  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024  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  <20232024 
<== Date ==> <== Thread ==>

Subject: some motor driver 3 questions
From: lynn via Tech-talk <tech-talk at aps.anl.gov>
To: tech-talk <tech-talk at aps.anl.gov>
Date: Wed, 24 May 2023 20:11:17 +0800 (CST)
 Hi all,
    Nowadayas i was writing elmo motor driver.
    i modified from MCB4BDriver.cpp (model 3 example).

    I found it was in a loop from AsynTrace message, after starting st.cmd.

********************* AsynTrace out, Begin*************************

2023/05/24 18:30:14.347 wrote 3 to 192.168.1.5:5001 udp, return asynSuccess.
2023/05/24 18:30:14.347 asynOctetSyncIO wrote:
PX;
2023/05/24 18:30:14.347 192.168.1.5:5001 udp read.
2023/05/24 18:30:14.350 192.168.1.5:5001 udp (from 192.
168.1.5:5001) read 11
PX;-106202;
2023/05/24 18:30:14.350 serial1 read 11 bytes eom=0
PX;-106202;
2023/05/24 18:30:14.350 192.168.1.5:5001 udp read.
2023/05/24 18:30:16.352 serial1 read from low-level driver returned 1
2023/05/24 18:30:16.352 serial1 queueUnlockPort
2023/05/24 18:30:16.352 serial1 asynManager::queueUnlockPort waiting for event
2023/05/24 18:30:16.352 serial1 queueUnlockPort unlock mutex 0x7f605c000e90 complete.
2023/05/24 18:30:16.452 serial1 asynManager::queueLockPort locking port
2023/05/24 18:30:16.452 serial1 asynManager::queueLockPort taking mutex 0x7f605c000e90
2023/05/24 18:30:16.452 serial1 asynManager::queueLockPort queueing request
2023/05/24 18:30:16.452 serial1 addr -1 queueRequest priority 0 not lockHolder
2023/05/24 18:30:16.452 serial1 schedule queueRequest timeout in 2.000000 seconds
2023/05/24 18:30:16.452 serial1 asynManager::queueLockPort waiting for event
2023/05/24 18:30:16.452 asynManager::portThread port=serial1 callback
2023/05/24 18:30:16.452 serial1 asynManager::queueLockPortCallback signaling begin event
2023/05/24 18:30:16.452 serial1 asynManager::queueLockPortCallback waiting for mutex from queueUnlockPort
2023/05/24 18:30:16.452 serial1 asynManager::queueLockPort got event from callback
2023/05/24 18:30:16.452 serial1 flush
2023/05/24 18:30:16.452 192.168.1.5:5001 udp flush
2023/05/24 18:30:16.452 192.168.1.5:5001 udp write.
2023/05/24 18:30:16.452 192.168.1.5:5001 udp write 3
PX;

2023/05/24 18:30:16.452 wrote 3 to 192.168.1.5:5001 udp, return asynSuccess.
     Another loop begin.
*************   AsynTrace out, End ******************


    Since loop was about "px;", I checked driver.cpp, found that "PX" only came out in MCB4BAxis::poll function.
    Here is the code of MCB4BAxis::Poll.
********************* MCB4BAxis::poll Begin *************************
asynStatus MCB4BAxis::poll(bool *moving)
{
  int done;
  int driveOn;
  int limit;
  double position;
  asynStatus comStatus;

  sprintf(pC_->outString_, "PX;");
  comStatus = pC_->writeReadController();
  if (comStatus) goto skip;
  position = atof(&pC_->inString_[3]);
  setDoubleParam(pC_->motorPosition_, position);

  // Read the moving status of this motor
  sprintf(pC_->outString_, "ID;");
  comStatus = pC_->writeReadController();
  if (comStatus) goto skip;

  done = (float(pC_->inString_[3]) > 0.009) ? 1:0;
  setIntegerParam(pC_->motorStatusDone_, done);
  *moving = done ? false:true;

********************* MCB4BAxis::poll End *************************

   
    Could someone help me with these questions:
    1) why command "ID;" did not work? Both "PX;" and "ID;" were in MCB4BAxis::poll function. Obviously, "PX;" was send ,"ID;" didn't.
    2) how to achieve it, if I want to send some initialization command ?
    3) 
    When I send "px;". Device would not send "PX=15926;" back.
    It would send "px;" first,then "15268;". I means, they are not send together.
    Does I need to change some in my code?
    4)
    Device required command "PR=1000;", then  send "BG;". it would not work if send together.
    How to write these code ?

    if (relative) {
    sprintf(pC_->outString_, "PR=%d;", NINT(position));   
    sprintf(pC_->outString_, "BG;");                                   // I added a line here. Does it ok?
  } else {
    sprintf(pC_->outString_, "PA=%d;", NINT(position));
    sprintf(pC_->outString_, "BG;");
  
   Any suggestion was appreciate.
   Thanks.

Regards,
Lynn



Replies:
Re: some motor driver 3 questions Mark Rivers via Tech-talk

Navigate by Date:
Prev: How to prevent deadlock for ca_clear_channel() Wang, Lin via Tech-talk
Next: RE: warning: multiple interrupt callbacks between processing when running testAsynPortDriverApp Mark Rivers via Tech-talk
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  <20232024 
Navigate by Thread:
Prev: How to prevent deadlock for ca_clear_channel() Wang, Lin via Tech-talk
Next: Re: some motor driver 3 questions Mark Rivers via Tech-talk
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  <20232024 
ANJ, 26 May 2023 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·