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 2023 <2024> | 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 2023 <2024> |
<== Date ==> | <== Thread ==> |
---|
Subject: | RE: motor model 3 with binary commands PiCo 33 piezo CN30 controller |
From: | Mark Rivers via Tech-talk <tech-talk at aps.anl.gov> |
To: | Mark Rivers <rivers at cars.uchicago.edu>, "Sintschuk, Michael" <michael.sintschuk at bam.de>, tech-talk <tech-talk at aps.anl.gov> |
Date: | Wed, 31 Jan 2024 18:30:49 +0000 |
Typo in my message. This line: pC_->outString[0]=0; should be this: pC_->outString[1]=0; Mark From: Tech-talk <tech-talk-bounces at aps.anl.gov>
On Behalf Of Mark Rivers via Tech-talk Hi Michael,
The Model 3 driver is not limited to ASCII commands. The asynMotorController.h has this comment about the writeController(), readController(), etc. methods: /* These are convenience functions for controllers that use asynOctet interfaces to the hardware */ Some vendor software provides library functions rather than a communication protocol, and Model 3 drivers can be used with those. An example is the Newport XPS where the
vendor function GroupMoveAbsolute or GroupMoveRelative is called to move motors: In your case the controller does use a communications protocol, but it is binary rather than ASCII. That means you can still use the asynOctet methods, you just don’t want
to convert to ASCII or use terminators. Your controller needs you to send it a single binary byte. Your code, however, is sending an ASCII string consisting of the characters 0 and 1.
Your code should look something like this. You can still use pC_->writeController. This assumes that you never want to send a byte that is binary 0, but I think that is
the case. char command; while (steps2Go > 0) { if (steps2Go >= 100) command=0x7, steps = 100; else if (steps2Go >= 50) command=0x6, steps = 50; else if (steps2Go >= 20) command=0x5, steps = 20; else if (steps2Go >= 10) command=x04, steps = 10; else if (steps2Go >= 5) command=0x3, steps = 5; else if (steps2Go >= 2) command=0x2, steps = 2; else if (steps2Go >= 1) command=0x1, steps = 1; pC_->outString[0]=command; pC_->outString[0]=0; pC_->writeController(); epicsThreadSleep(0.001); steps2Go = steps2Go - steps; } You must be sure not to enable terminators on the asyn communications port. Mark From: Tech-talk <tech-talk-bounces at aps.anl.gov>
On Behalf Of Sintschuk, Michael via Tech-talk Dear all, I’m struggling to write a motor driver for an old piezo controller that goes by the name CN30 or PiCo 33 from Mechonics. I guess my problem is that this controller talks only in command-bytes and I’m trying to use the model 3 driver which is based on ASCII-commands. I attached a pdf with a description of the RS232 command-byte and I also found a SPEC driver
for this controller: BLISS: SPEC Macro documentation / Macrofile: mechonics.mac (esrf.fr) This is my move function from the driver: asynStatus CN30Axis::move(double position, int relative, double baseVelocity, double slewVelocity, double acceleration) { asynStatus status; size_t nwrite; int steps, steps2Go; char nsteps[4]; // static const char *functionName = "CN30Axis::move"; // calculate how many steps to do, ca. 200nm/Step and we drive in mm steps2Go = static_cast<int>(position / 200e-7); while (steps2Go > 0) { if (steps2Go >= 100) strcpy(nsteps, "111"), steps = 100; else if (steps2Go >= 50) strcpy(nsteps, "110"), steps = 50; else if (steps2Go >= 20) strcpy(nsteps, "101"), steps = 20; else if (steps2Go >= 10) strcpy(nsteps, "100"), steps = 10; else if (steps2Go >= 5) strcpy(nsteps, "011"), steps = 5; else if (steps2Go >= 2) strcpy(nsteps, "010"), steps = 2; else if (steps2Go >= 1) strcpy(nsteps, "001"), steps = 1; sprintf(pC_->outString_, "00000%s", nsteps); pC_->writeController(); epicsThreadSleep(0.001); steps2Go = steps2Go - steps; } return status; } Here is the IOC console output with asynTraces turned on when trying to do a 1mm move (I also need to work on the step-resolution but this is not the issue right now): 00000111 2024/01/31 16:44:55.492 CN30Port queueUnlockPort 2024/01/31 16:44:55.492 CN30Port asynManager::queueUnlockPort waiting for event 2024/01/31 16:44:55.492 CN30Port queueUnlockPort unlock mutex 0x7f5098000ee0 complete. 2024/01/31 16:44:55.493 CN30Port asynManager::queueLockPort locking port 2024/01/31 16:44:55.493 CN30Port asynManager::queueLockPort taking mutex 0x7f5098000ee0 2024/01/31 16:44:55.493 CN30Port asynManager::queueLockPort queueing request 2024/01/31 16:44:55.493 CN30Port addr -1 queueRequest priority 0 not lockHolder 2024/01/31 16:44:55.493 CN30Port schedule queueRequest timeout in 2.000000 seconds 2024/01/31 16:44:55.493 CN30Port asynManager::queueLockPort waiting for event 2024/01/31 16:44:55.493 asynManager::portThread port=CN30Port callback 2024/01/31 16:44:55.493 CN30Port asynManager::queueLockPortCallback signaling begin event 2024/01/31 16:44:55.493 CN30Port asynManager::queueLockPortCallback waiting for mutex from queueUnlockPort 2024/01/31 16:44:55.493 CN30Port asynManager::queueLockPort got event from callback 2024/01/31 16:44:55.493 192.168.99.20:4001 write. 2024/01/31 16:44:55.493 192.168.99.20:4001 write 8 00000111 2024/01/31 16:44:55.493 wrote 8 to 192.168.99.20:4001, return asynSuccess. 2024/01/31 16:44:55.493 asynOctetSyncIO wrote: 00000111 2024/01/31 16:44:55.493 CN30Port queueUnlockPort 2024/01/31 16:44:55.493 CN30Port asynManager::queueUnlockPort waiting for event 2024/01/31 16:44:55.493 CN30Port queueUnlockPort unlock mutex 0x7f5098000ee0 complete. 2024/01/31 16:44:55.495 CN30Port asynManager::queueLockPort locking port 2024/01/31 16:44:55.495 CN30Port asynManager::queueLockPort taking mutex 0x7f5098000ee0 2024/01/31 16:44:55.495 CN30Port asynManager::queueLockPort queueing request 2024/01/31 16:44:55.495 CN30Port addr -1 queueRequest priority 0 not lockHolder 2024/01/31 16:44:55.495 CN30Port schedule queueRequest timeout in 2.000000 seconds 2024/01/31 16:44:55.495 CN30Port asynManager::queueLockPort waiting for event 2024/01/31 16:44:55.495 asynManager::portThread port=CN30Port callback 2024/01/31 16:44:55.495 CN30Port asynManager::queueLockPortCallback signaling begin event 2024/01/31 16:44:55.495 CN30Port asynManager::queueLockPortCallback waiting for mutex from queueUnlockPort 2024/01/31 16:44:55.495 CN30Port asynManager::queueLockPort got event from callback 2024/01/31 16:44:55.495 192.168.99.20:4001 write. 2024/01/31 16:44:55.495 192.168.99.20:4001 write 8 00000111 2024/01/31 16:44:55.495 wrote 8 to 192.168.99.20:4001, return asynSuccess. 2024/01/31 16:44:55.495 asynOctetSyncIO wrote: 00000111 2024/01/31 16:44:55.495 CN30Port queueUnlockPort 2024/01/31 16:44:55.495 CN30Port asynManager::queueUnlockPort waiting for event 2024/01/31 16:44:55.495 CN30Port queueUnlockPort unlock mutex 0x7f5098000ee0 complete. 2024/01/31 16:44:55.496 CN30Port asynManager::queueLockPort locking port 2024/01/31 16:44:55.496 CN30Port asynManager::queueLockPort taking mutex 0x7f5098000ee0 2024/01/31 16:44:55.496 CN30Port asynManager::queueLockPort queueing request 2024/01/31 16:44:55.496 CN30Port addr -1 queueRequest priority 0 not lockHolder 2024/01/31 16:44:55.496 CN30Port schedule queueRequest timeout in 2.000000 seconds 2024/01/31 16:44:55.496 CN30Port asynManager::queueLockPort waiting for event 2024/01/31 16:44:55.496 asynManager::portThread port=CN30Port callback 2024/01/31 16:44:55.496 CN30Port asynManager::queueLockPortCallback signaling begin event 2024/01/31 16:44:55.496 CN30Port asynManager::queueLockPortCallback waiting for mutex from queueUnlockPort 2024/01/31 16:44:55.496 CN30Port asynManager::queueLockPort got event from callback 2024/01/31 16:44:55.496 192.168.99.20:4001 write. 2024/01/31 16:44:55.496 192.168.99.20:4001 write 8 00000110 2024/01/31 16:44:55.496 wrote 8 to 192.168.99.20:4001, return asynSuccess. 2024/01/31 16:44:55.496 asynOctetSyncIO wrote: 00000110 2024/01/31 16:44:55.496 CN30Port queueUnlockPort 2024/01/31 16:44:55.496 CN30Port asynManager::queueUnlockPort waiting for event 2024/01/31 16:44:55.496 CN30Port queueUnlockPort unlock mutex 0x7f5098000ee0 complete. 2024/01/31 16:44:55.497 CN30Port asynManager::queueLockPort locking port 2024/01/31 16:44:55.497 CN30Port asynManager::queueLockPort taking mutex 0x7f5098000ee0 2024/01/31 16:44:55.497 CN30Port asynManager::queueLockPort queueing request 2024/01/31 16:44:55.497 CN30Port addr -1 queueRequest priority 0 not lockHolder 2024/01/31 16:44:55.497 CN30Port schedule queueRequest timeout in 2.000000 seconds 2024/01/31 16:44:55.497 CN30Port asynManager::queueLockPort waiting for event 2024/01/31 16:44:55.497 asynManager::portThread port=CN30Port callback 2024/01/31 16:44:55.497 CN30Port asynManager::queueLockPortCallback signaling begin event 2024/01/31 16:44:55.497 CN30Port asynManager::queueLockPortCallback waiting for mutex from queueUnlockPort 2024/01/31 16:44:55.497 CN30Port asynManager::queueLockPort got event from callback 2024/01/31 16:44:55.497 192.168.99.20:4001 write. 2024/01/31 16:44:55.497 192.168.99.20:4001 write 8 00000101 2024/01/31 16:44:55.497 wrote 8 to 192.168.99.20:4001, return asynSuccess. 2024/01/31 16:44:55.497 asynOctetSyncIO wrote: 00000101 2024/01/31 16:44:55.497 CN30Port queueUnlockPort 2024/01/31 16:44:55.497 CN30Port asynManager::queueUnlockPort waiting for event 2024/01/31 16:44:55.497 CN30Port queueUnlockPort unlock mutex 0x7f5098000ee0 complete. 2024/01/31 16:44:55.498 CN30Port asynManager::queueLockPort locking port 2024/01/31 16:44:55.498 CN30Port asynManager::queueLockPort taking mutex 0x7f5098000ee0 2024/01/31 16:44:55.498 CN30Port asynManager::queueLockPort queueing request 2024/01/31 16:44:55.498 CN30Port addr -1 queueRequest priority 0 not lockHolder 2024/01/31 16:44:55.498 CN30Port schedule queueRequest timeout in 2.000000 seconds 2024/01/31 16:44:55.498 CN30Port asynManager::queueLockPort waiting for event 2024/01/31 16:44:55.498 asynManager::portThread port=CN30Port callback 2024/01/31 16:44:55.498 CN30Port asynManager::queueLockPortCallback signaling begin event 2024/01/31 16:44:55.498 CN30Port asynManager::queueLockPortCallback waiting for mutex from queueUnlockPort 2024/01/31 16:44:55.498 CN30Port asynManager::queueLockPort got event from callback 2024/01/31 16:44:55.498 192.168.99.20:4001 write. 2024/01/31 16:44:55.498 192.168.99.20:4001 write 8 00000101 2024/01/31 16:44:55.498 wrote 8 to 192.168.99.20:4001, return asynSuccess. 2024/01/31 16:44:55.498 asynOctetSyncIO wrote: 00000101 2024/01/31 16:44:55.499 CN30Port queueUnlockPort 2024/01/31 16:44:55.499 CN30Port asynManager::queueUnlockPort waiting for event 2024/01/31 16:44:55.499 CN30Port queueUnlockPort unlock mutex 0x7f5098000ee0 complete. 2024/01/31 16:44:55.500 CN30Port asynManager::queueLockPort locking port 2024/01/31 16:44:55.500 CN30Port asynManager::queueLockPort taking mutex 0x7f5098000ee0 2024/01/31 16:44:55.500 CN30Port asynManager::queueLockPort queueing request 2024/01/31 16:44:55.500 CN30Port addr -1 queueRequest priority 0 not lockHolder 2024/01/31 16:44:55.500 CN30Port schedule queueRequest timeout in 2.000000 seconds 2024/01/31 16:44:55.500 CN30Port asynManager::queueLockPort waiting for event 2024/01/31 16:44:55.500 asynManager::portThread port=CN30Port callback 2024/01/31 16:44:55.500 CN30Port asynManager::queueLockPortCallback signaling begin event 2024/01/31 16:44:55.500 CN30Port asynManager::queueLockPortCallback waiting for mutex from queueUnlockPort 2024/01/31 16:44:55.500 CN30Port asynManager::queueLockPort got event from callback 2024/01/31 16:44:55.500 192.168.99.20:4001 write. 2024/01/31 16:44:55.500 192.168.99.20:4001 write 8 00000011 2024/01/31 16:44:55.500 wrote 8 to 192.168.99.20:4001, return asynSuccess. 2024/01/31 16:44:55.500 asynOctetSyncIO wrote: 00000011 2024/01/31 16:44:55.500 CN30Port queueUnlockPort 2024/01/31 16:44:55.500 CN30Port asynManager::queueUnlockPort waiting for event 2024/01/31 16:44:55.500 CN30Port queueUnlockPort unlock mutex 0x7f5098000ee0 complete. 2024/01/31 16:44:55.501 CN30Port asynManager::queueLockPort locking port 2024/01/31 16:44:55.501 CN30Port asynManager::queueLockPort taking mutex 0x7f5098000ee0 2024/01/31 16:44:55.501 CN30Port asynManager::queueLockPort queueing request 2024/01/31 16:44:55.501 CN30Port addr -1 queueRequest priority 0 not lockHolder 2024/01/31 16:44:55.501 CN30Port schedule queueRequest timeout in 2.000000 seconds 2024/01/31 16:44:55.501 CN30Port asynManager::queueLockPort waiting for event 2024/01/31 16:44:55.501 asynManager::portThread port=CN30Port callback 2024/01/31 16:44:55.501 CN30Port asynManager::queueLockPortCallback signaling begin event 2024/01/31 16:44:55.501 CN30Port asynManager::queueLockPortCallback waiting for mutex from queueUnlockPort 2024/01/31 16:44:55.501 CN30Port asynManager::queueLockPort got event from callback 2024/01/31 16:44:55.501 192.168.99.20:4001 write. 2024/01/31 16:44:55.501 192.168.99.20:4001 write 8 00000010 2024/01/31 16:44:55.501 wrote 8 to 192.168.99.20:4001, return asynSuccess. 2024/01/31 16:44:55.501 asynOctetSyncIO wrote: 00000010 2024/01/31 16:44:55.501 CN30Port queueUnlockPort 2024/01/31 16:44:55.501 CN30Port asynManager::queueUnlockPort waiting for event 2024/01/31 16:44:55.501 CN30Port queueUnlockPort unlock mutex 0x7f5098000ee0 complete. 2024/01/31 16:44:55.502 CN30Port asynManager::queueLockPort locking port 2024/01/31 16:44:55.502 CN30Port asynManager::queueLockPort taking mutex 0x7f5098000ee0 2024/01/31 16:44:55.502 CN30Port asynManager::queueLockPort queueing request 2024/01/31 16:44:55.502 CN30Port addr -1 queueRequest priority 0 not lockHolder 2024/01/31 16:44:55.502 CN30Port schedule queueRequest timeout in 2.000000 seconds 2024/01/31 16:44:55.502 CN30Port asynManager::queueLockPort waiting for event 2024/01/31 16:44:55.502 asynManager::portThread port=CN30Port callback 2024/01/31 16:44:55.502 CN30Port asynManager::queueLockPortCallback signaling begin event 2024/01/31 16:44:55.502 CN30Port asynManager::queueLockPortCallback waiting for mutex from queueUnlockPort 2024/01/31 16:44:55.502 CN30Port asynManager::queueLockPort got event from callback 2024/01/31 16:44:55.502 192.168.99.20:4001 write. 2024/01/31 16:44:55.502 192.168.99.20:4001 write 8 00000010 2024/01/31 16:44:55.502 wrote 8 to 192.168.99.20:4001, return asynSuccess. 2024/01/31 16:44:55.502 asynOctetSyncIO wrote: 00000010 2024/01/31 16:44:55.502 CN30Port queueUnlockPort 2024/01/31 16:44:55.502 CN30Port asynManager::queueUnlockPort waiting for event 2024/01/31 16:44:55.502 CN30Port queueUnlockPort unlock mutex 0x7f5098000ee0 complete. epics> I can see the axis moving, but it is the wrong axis because Bit 7 and 6 are actually 0 (see attached pdf). Also, the command 00000111 in the output looks right I’m not sure if the controller understands it. Is it right to use: sprintf(pC_->outString_, "00000%s", nsteps); pC_->writeController(); when I want to send a byte-command? Does it matter? So far, I only have experience in write ASCII-based motor drivers, based on examples of model 3. Can someone help? Thanks, and best regards! Michael Michael Sintschuk
|