06-10-2022 04:42 PM
Hello together
I have an handheld scanner in my station and I need to have it always in the reading command.
I want to start the command read and wait as long as something was scanned, to analyze the data.
At the moment, I have to define a timeout for the max time of staying in read command. Is there a possibility to set up the object, that there is no timeout for the reading command?
I tried to build something on my own, with resetting the command before the timeout error is coming, but then I have a unreliable behaviour with the scanner, sometimes the first scan after resetting the command will be ignored, so I always have to scan twice.
Is this possible for handheld scanner?
Thanks in advance
06-13-2022 08:44 AM - edited 06-13-2022 09:02 AM
I think the right way how to operate the handheld scanner is to create a subchain or help method with CASE construction called from OnunitOperational. In one of these you should execute the read command, set a timeout and when the timeout is reached you should reset Execute and run the whole sequence again.
And as you wrote, you should reset the Execute signal before reaching the object timeout. So your timeout in the sequence should be shorter.
Let me know if it works and if not I will try to find some of our projects with implementation of this.
06-13-2022 09:15 AM
Hello,
actual peripheral for TCP not supported handheld function.
we plan add this function to the tcp peripheral in the future like the serial peripheral.
06-13-2022 10:04 AM - edited 06-13-2022 10:05 AM
Yes that's how I tried it, but I have the problem, after resetting the execute the first scan won't be read. After that it is working, but with some additional checks, like connection still there.
If you have have a running template, would be great to have it.
Thanks
06-13-2022 12:51 PM - edited 06-13-2022 12:56 PM
I found this in one of our projects. It is from real machine, which normally runs, so it should be ok.
Maybe the clue for your problem is additional empty step 2. Object probably needs one PLC scan to process something inside of it.
What I do not understand is, why timeout is not implemented in step 1.
CASE _step OF
0: // Start command
IF ( Scanner1.Unit.ExecState = OpconExecState.READY )
THEN
Scanner1.Unit.Command := ScannerCmd.READ;
Scanner1.Unit.Execute := TRUE;
_step := _step + 1;
END_IF
1: // Wait until finished
IF ( Scanner1.Unit.ExecState <> OpconExecState.RUNNING )
THEN
Scanner1.Unit.Execute := FALSE;
_step := _step + 1;
END_IF
2: // End step
_step := 0;
ELSE
Scanner1.Unit.Execute := FALSE;
_step := 0;
END_CASE