Posted by
Joachim Wesner on
May 23, 2006; 12:37am
URL: http://imagej.273.s1.nabble.com/Microscope-stage-controller-and-serial-communication-Javacomm-tp3702708p3702712.html
Hi Andy,
I´m not sure I fully understand your setup/problem, also because I do not
know that serial plugin you use.
1) What does "waitanswer" mean? I would assume it would already tell the
plugin to NOT return before anything is sent back by the microscope, so
you would probably need no extra do/while at all (you still might need to
check if the result was different from what you expect)
2) Otherwise, if it returns earlier, will you still be able to later (and
repeatedly) read the reply using getResultLabel(0)?
Then you could use a do/while construction like
run(.....);
do {
answer = getResultLabel(0);
} while (answer != "50020xyz");
(or probably simpler)
run(.....);
do {
answer = getResultLabel(0);
} while (answer == "");
Sincerely
Joachim
Andy Weller
<andrew.weller@ER An:
[hidden email]
DW.ETHZ.CH> Kopie: (Blindkopie: Joachim Wesner/DEWET/LMSCentral/Leica)
Gesendet von: Thema: do/while loop, I think?!
ImageJ Interest
Group
<
[hidden email].
GOV>
22.05.2006 19:04
Bitte antworten
an ImageJ
Interest Group
Dear all,
I am controlling a microscope through the serial interface that both reads
and
writes strings. What I would like it to do is only proceed to the next
command after the current one has completed. This is acknowledged by the
microscope re-sending the original command.
So, for example, if I send the microscope the command "50020xyz" the macro
can
only continue once "50020xyz" has been returned. In macro code this is:
run("serial plugin", "waitanswer genericcmd=50020xyz");
//to retrieve the answer through the macro
answer = getResultLabel(0);
So, while answer = "" I want the macro to stay idle, but when answer =
"50020xyz" I want the macro to continue. I guess this needs a do/while loop
(maybe if/then!?)?!
I can't get my head round it at the moment and wonder if anyone has any
ideas/suggestions?
Many thanks, Andy
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit
http://www.messagelabs.com/email
______________________________________________________________________