Can anyone share me/us the code for reliable delayed for loop. I'm trying with TON delayed CASE loop, but it is really painfull and not reliable. In my example I'm parametrizig CAN device over SDO protocol, with expedited SDO transfer. So i have eg. index 16#5000 and 20-25 subindexes. Every sub index have to be delayed and sent because of the SDO request-response protocol. My code snipet:
Hello!
Can anyone share me/us the code for reliable delayed for loop. I'm trying with TON delayed CASE loop, but it is really painfull and not reliable. In my example I'm parametrizig CAN device over SDO protocol, with expedited SDO transfer. So i have eg. index 16#5000 and 20-25 subindexes. Every sub index have to be delayed and sent because of the SDO request-response protocol. My code snipet:
ton_sdo_param(IN:= xTonStepEnable , PT:=T#3MS , Q=>xDelayStep , ET=> );
CASE int1 OF
19: xTonStepEnable:=TRUE;
IF xDelayStep THEN
int1:=20;
END_IF
END_CASE
My task for this is 3ms. And I'll be happy to solve this with delayed FOR loop solution, based on buscyle time.
Any ideas?
regards,
Alex
You have a timer as long as your scantime?
Try 'xDelay := xDelay + 1;'
If xDelay is '2' then it has made one more scan rotation.
Check out GETSYSTEMTIME, usaully there is a systemtimer in u-seconds on the system.
/TorbjΓΆrn