Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched.
Close
This is an input of another POU being cyclically written from the main POU.
Does anybody have an idea of why the assigned and actual values differ?
Different assigned value produces different delta.
The only piece of code in the "another" POU that deals with this var looks like this:
(Encoder handling)
IF bInvertEncoder THEN
nActPos:= (DWORD_TO_REAL(SHL(WORD_TO_DWORD (InEncoder[1]XOR 16#FFFF),16) OR InEncoder[0]XOR 16#FFFF)nEncScale)+nEncBias;
ELSE
nActPos:= (DWORD_TO_REAL(SHL(WORD_TO_DWORD (InEncoder[1]),16) OR InEncoder[0])nEncScale)+nEncBias;
END_IF
As I don't have access to any other hardware at the moment I cannot verify this, but I believe that this problem didn't exist prior to updating Runtime from 4.0.1.0 to 4.5.0.0 and IDE to V3.5 SP18 Patch 3.
I've tried the obvious things, reboot of PC and target, origin reset of target. (Which is a RPi 4B with 32-bit OS)
This is an input of another POU being cyclically written from the main POU.
Does anybody have an idea of why the assigned and actual values differ?
Different assigned value produces different delta.
The only piece of code in the "another" POU that deals with this var looks like this:
(Encoder handling)
IF bInvertEncoder THEN
nActPos:= (DWORD_TO_REAL(SHL(WORD_TO_DWORD (InEncoder[1]XOR 16#FFFF),16) OR InEncoder[0]XOR 16#FFFF)nEncScale)+nEncBias;
ELSE
nActPos:= (DWORD_TO_REAL(SHL(WORD_TO_DWORD (InEncoder[1]),16) OR InEncoder[0])nEncScale)+nEncBias;
END_IF
As I don't have access to any other hardware at the moment I cannot verify this, but I believe that this problem didn't exist prior to updating Runtime from 4.0.1.0 to 4.5.0.0 and IDE to V3.5 SP18 Patch 3.
I've tried the obvious things, reboot of PC and target, origin reset of target. (Which is a RPi 4B with 32-bit OS)
Related
Talk.ru: 1
Thats just how reals work. see https://www.h-schmidt.net/FloatConverter/IEEE754.html
Stuff learned every single day, thanks!