All,
Just want to know how you guys pass the negative data from PLC to Fanuc Robot. What I did is send the ABS value from PLC to GI and then there will be a bit to estimate the vaule is +or -. But seemed sometime it doesn't work. Anybody has any suggestions?
Negative Data Pass
-
Chris -
June 6, 2016 at 3:43 AM -
Thread is Resolved
-
-
I do the same thing. I process the GI and set that value to a register. I have a bit if the value is negative and then multiply the register by negative one.
-
But seemed sometimes it doesn't work well. sometimes I still get the + value. which I have *(-1) in the Robot program.
-
Post the program
-
For 16-bit signed integer sent to GI, do the following in the robot:
If GI<=32767, it is non-negative, and may be directly written to the destination register.
If GI>32767, it is negative. Subtract 65536 and write the result to the destination register. -
I agreed with Racermike123 (easiest way)
To make it bullet proof. Use two different inputs for the + and -, don't just go for the on and off of one outputs -
R1=GI6
if DI16=off JUMPLBL2
R1=R1*-1
LBL2 -
Post the program
Seemed I did the same way as you did. But sometimes It doesn't work. I don't know if the EIP communication affect that. I have change the RPI from 30ms to 4ms, The issue doesn't happen again. Just concerned about that. -
Just attached another program.
-
Fabian has a good idea. I think your negative input is not coming on,or is coming on and off very quickly.
Add another input, one that is on when the value is positive. -
I do the same thing. I process the GI and set that value to a register. I have a bit if the value is negative and then multiply the register by negative one.
If doing so, you must send the absolute value from the PLC, no matter the sign.
This requires conversion of negative values to unsigned format in the PLC before transferring, or this will never work correctly. -
I agreed with Racermike123 (easiest way)
To make it bullet proof. Use two different inputs for the + and -, don't just go for the on and off of one outputs
Hello Fabian, I just post a program . Did you mean like that? or can you post a program for reference? -
Something like that is ok.
It is redundant but at least you are sure that R200 is offR200=OFF and R201=OFF means "no proper sign"
R200=OFF and R201=ON means "+ sign"
R200=ON and R201=OFF means "- sign"
R200=ON and R201=ON means "no proper sign"Now, at least you are double checking your comm
-
Do not complicate things, guys!
Send signed integer to GI, and get the signed result in a robot register by a single instruction line:
R[1]=(GI[1]-GI[1] DIV 32768*65536)
The example is for 16-bit GI.
For other n-bit length, modify the constants, which are 2^(n-1) and 2^n. -
Thanks a lot all you guys. Learn a lot!
-
For 16-bit signed integer sent to GI, do the following in the robot:
If GI<=32767, it is non-negative, and may be directly written to the destination register.
If GI>32767, it is negative. Subtract 65536 and write the result to the destination register.Hi Sergei Troizky,
i am using also same concept.i am talking hier fron negetive value only.
If GI>32767, it is negative. Subtract 65536 and write the result to the destination register.as per above concept we can Subtract the value if the If GI>32767. but for negetive value PLC must also do some calculation from their side. see below example.
-50,25 = (65536-50 = 65486) (65536-2500 = 63036)
(get from PLC) 65486 -> first 2 Byte for befor comma -> -50
(get from PLC) 63036 -> second 2 Byte for after comma -> -2500
-50000-2500 = -502500 / 10000 -> -50,25
what i understand is that if we use this concepet; PLC must also do some calculation for negetive value. Am i right? -
I agreed with Racermike123 (easiest way)
To make it bullet proof. Use two different inputs for the + and -, don't just go for the on and off of one outputsThis concept is also good. but if you have more then one GI then it will be more complex.
-
.. what i understand is that if we use this concepet; PLC must also do some calculation for negetive value. Am i right?
Yes and no.
PLC does this implicitly if you use a 16bit Integer on PLC. No extra code necessary on PLC side.
-
Yes and no.
PLC does this implicitly if you use a 16bit Integer on PLC. No extra code necessary on PLC side.
Yes From PLC side it is 16 bit integer (i am using SmallInt DATA TYPE from PLC Side).
Thank you for your help.