08-21-2024 12:38 PM
Hello all,
I have a Handheld Scanner and implemented a continuous Read command in the OnUnitOperational method, as suggested in a forum post.
I implemented a timeout before the scanner read timeout to have the read command continuously.
However, I am having an odd behaviour regarding the Scanner object ExecState. Once my timeout is reached, I reset the Execute flag, but it seems like the scanner object doesn't reset the command timer.
In the next Execute set, the ExecState enters the error state, because it reaches its internal timeout.
Down below I have the code I implemented.
CASE _step OF
0: // Start command
IF ( Loc000B720_Scanner.Unit.ExecState = OpconExecState.READY )
THEN
Loc000B720_Scanner.Unit.Command := ScannerCmd.READ;
Loc000B720_Scanner.Unit.Execute := TRUE;
OpconSetTimeout( PT := T#4S, rTimer := _cmdTimer );
_step := _step + 1;
END_IF
1: // Wait until finished
IF( OpconCheckTimeout( rTimer := _cmdTimer ) = OK ) OR
( Loc000B720_Scanner.Unit.ExecState = OpconExecState.DONE )
THEN
Loc000B720_Scanner.Unit.Execute := FALSE;
_step := _step + 1;
END_IF
2: // End step
_step := 0;
ELSE
Loc000B720_Scanner.Unit.Execute := FALSE;
_step := 0;
END_CASE
Thank you in advance.
08-22-2024 09:22 PM
I am interested in how you communicate with the usb scanner.
Do you use the functions from beckhoff that require a license?
08-23-2024 09:50 AM
Yes, we are using the TF6340 Beckhoff license.