Hello everyone I need help. You need to get coordinates from the siemens controller. I/O communication is set up. How to convert using WorkVisual, without using MultiProg?
Transmitting coordinates
-
coolvitaly -
October 27, 2021 at 3:32 PM -
Thread is marked as Resolved.
-
-
SIGNAL XCoordinate $OUT[1] TO $OUT[8]
XCoordinate=$POS_ACT_MES.X
-
it is the other way around when getting position value from PLC
SIGNAL XCoordinate_x1000 $IN[1] TO $IN[32]
SIGNAL YCoordinate_x1000 $IN[33] TO $IN[64]
SIGNAL ZCoordinate_x1000 $IN[65] TO $IN[96]
DECL POS Coordinate_From_PLC
Coordinate_From_PLC.X = XCoordinate_x1000 * 0.001
Coordinate_From_PLC.Y = YCoordinate_x1000 * 0.001
Coordinate_From_PLC.Z = ZCoordinate_x1000 * 0.001
LIN Coordinate_From_PLC
-
it is the other way around when getting position value from PLC
Derp. Saw "transmit," thought "from robot."
Coordinate_From_PLC.X = XCoordinate_x1000 * 0.001
Needs the PLC to multiply by 1000 before sending.
-
it is the other way around when getting position value from PLC
SIGNAL XCoordinate_x1000 $IN[1] TO $IN[32]
SIGNAL YCoordinate_x1000 $IN[33] TO $IN[64]
SIGNAL ZCoordinate_x1000 $IN[65] TO $IN[96]
DECL POS Coordinate_From_PLC
Coordinate_From_PLC.X = XCoordinate_x1000 * 0.001
Coordinate_From_PLC.Y = YCoordinate_x1000 * 0.001
Coordinate_From_PLC.Z = ZCoordinate_x1000 * 0.001
LIN Coordinate_From_PLC
Thank you very much! What type of transmission data is needed in i/o mapping?
-
Thank you very much! What type of transmission data is needed in i/o mapping?
Not sure what you mean by that.. Since signals are integers, one simple way to handle decimals is by using different scale, For practical reasons myltiplication by 1000 before sending and then dividing by 1000 when receiving is common. if you want to transfer actual REAL number, then you need to cast the coordinates to REAL.
Derp. Saw "transmit," thought "from robot."
Needs the PLC to multiply by 1000 before sending.
-
Not sure what you mean by that.. Since signals are integers, one simple way to handle decimals is by using different scale, For practical reasons myltiplication by 1000 before sending and then dividing by 1000 when receiving is common. if you want to transfer actual REAL number, then you need to cast the coordinates to REAL.
I meant this connection
-
grouping here just makes list more compact.
even you have group as a byte or word etc. signals are connected bit-by bit.
for example $IN[41]#G still connects inputs 41,42,43,44,45,46,47,48 to eight bits on the right side (not shown since screenshot is cropped).
but nobody sees this and this has nothing to do with data format that program uses.
you can still declare signal as
SIGNAL WHATEVER $IN[37] TO $IN[68] ; this is 32-bit
and as you can see it is still 32-bit value.
when signal is single bit, it is BOOL type, otherwise it is and integer (word) of 2-32 bits depending on size of the range you choose.
so when inputs 37 and 39 are true and everything else is false you get value
'B00000000000000000000000000000101' which is 5 or 0x0005 and not REAL with value 5.877475E-39
so in most cases, mapping IO simply means selecting range on left side and same size range of the right side, then clicking on Map to create 1:1 relationship, size of group does not matter.
-
grouping here just makes list more compact.
even you have group as a byte or word etc. signals are connected bit-by bit.
for example $IN[41]#G still connects inputs 41,42,43,44,45,46,47,48 to eight bits on the right side (not shown since screenshot is cropped).
but nobody sees this and this has nothing to do with data format that program uses.
you can still declare signal as
SIGNAL WHATEVER $IN[37] TO $IN[68] ; this is 32-bit
and as you can see it is still 32-bit value.
when signal is single bit, it is BOOL type, otherwise it is and integer (word) of 2-32 bits depending on size of the range you choose.
so when inputs 37 and 39 are true and everything else is false you get value
'B00000000000000000000000000000101' which is 5 or 0x0005 and not REAL with value 5.877475E-39
so in most cases, mapping IO simply means selecting range on left side and same size range of the right side, then clicking on Map to create 1:1 relationship, size of group does not matter.
Understood, thank you! Here it does not define so. How can I fix it?
-
please try making screenshots that cover a bit more. at least line numbers would be helpful. normally one should take image of entire window (see READ FIRST).
my guess is that picture shows a DAT file. in DAT file one can only declare and initialize variable.
if variable is initialized in DAT file, value must be a literal (hardcoded). it cannot come from another variable and most definitely one cannot use other data manipulation such as multiplication. that line need to be in the SRC file.
-
please try making screenshots that cover a bit more. at least line numbers would be helpful. normally one should take image of entire window (see READ FIRST).
my guess is that picture shows a DAT file. in DAT file one can only declare and initialize variable.
if variable is initialized in DAT file, value must be a literal (hardcoded). it cannot come from another variable and most definitely one cannot use other data manipulation such as multiplication. that line need to be in the SRC file.
Спасибо большое! Я перенес строчку в файл src и ошибок нет. Сейчас попробуй загрузить в робота и проверю.
-
ya nje ponemayu chto eto. ne govoryu po ruskiy...
-
ya nje ponemayu chto eto. ne govoryu po ruskiy...
Thank you very much! I moved the line to the src file and there are no errors. Now try to load it into the robot and I'll check. Accidentally wrote in Russian.