Thanks for the Training Video YTTS. Highly appreciated and recommended for Motion Works IEC. In relation to using arrays, just wondering if its possible to do bit level indirect addressing. i 've got it working it for Byte/INT level. But soon as i try to indirect to bit level i get a syntax error. can still do direct addressing at bit level and it works.
Sonny Singh If you could give an example of indirect vs direct addressing, and the syntax error that is generated, this would help better answer your question. The array element can be a variable with INT datatype inside the square brackets. It may not be an INT element of a structure or an INT element of another array. For example, MyArray[n], n must exist in the variable list as a variable with INT datatype. You may manipulate the bits of another variable and convert it to the INT datatype. Hope that helps, if not please give the example. Matt Pelletier.
Yaskawa America Heyyy Matt...Glad to talk to you. so lets talk business.... the first bit of code i am attaching is the working copy. i did a bit of indirection and it works sweet. I am addressing the bits in the Byte with dot notation and it works well. here is copy- Driver_Byte := Driver_Byte + BYTE#1 ; Bit_Indirect := Bit_Indirect + BYTE#1 ; IF Driver_Byte >= BYTE#8 THEN Driver_Byte := BYTE#0; END_IF; IF Bit_Indirect >= BYTE#8 THEN Bit_Indirect := BYTE#0; END_IF; IF ( Q_OUT[0] or Q_OUT[1] or Q_OUT[2] or Q_OUT[3] or Q_OUT[4] or Q_OUT[5] or Q_OUT[6] or Q_OUT[7] ) BYTE#255 THEN Q_OUT[Driver_Byte] := Byte#255; ELSE Q_OUT[Driver_Byte].X0 := FALSE; Q_OUT[Driver_Byte].X1 := FALSE; Q_OUT[Driver_Byte].X2 := FALSE; Q_OUT[Driver_Byte].X3 := FALSE; Q_OUT[Driver_Byte].X4 := FALSE; Q_OUT[Driver_Byte].X5 := FALSE; Q_OUT[Driver_Byte].X6 := FALSE; Q_OUT[Driver_Byte].X7 := FALSE; END_IF; But in the same code if i try to access the bit in the byte via indirect address i get error. i.e.- Q_OUT[Driver_Byte].[Bit_Indirect] := FALSE; Or Q_OUT[Driver_Byte].[Driver_Byte] := FALSE; i believe its same as Q_OUT[4].X[4] or Q_OUT4.4 error i get is " illegal Variable Location Or Multi-element variable Q_OUT[Driver_Byte].'!
Thanks for watching our video titled: 4.1 Arrays (IEC 61131-3 Basics with MotionWorks IEC). We recommend contacting our Technical Support with your application information at www.yaskawa.com/support-training/support, or you can also reach out to your local Yaskawa Service Provider - www.yaskawa-global.com/company/profile/global.
Thanks for the Training Video YTTS. Highly appreciated and recommended for Motion Works IEC. In relation to using arrays, just wondering if its possible to do bit level indirect addressing. i 've got it working it for Byte/INT level. But soon as i try to indirect to bit level i get a syntax error. can still do direct addressing at bit level and it works.
Sonny Singh If you could give an example of indirect vs direct addressing, and the syntax error that is generated, this would help better answer your question. The array element can be a variable with INT datatype inside the square brackets. It may not be an INT element of a structure or an INT element of another array. For example, MyArray[n], n must exist in the variable list as a variable with INT datatype. You may manipulate the bits of another variable and convert it to the INT datatype. Hope that helps, if not please give the example. Matt Pelletier.
Yaskawa America Heyyy Matt...Glad to talk to you. so lets talk business.... the first bit of code i am attaching is the working copy. i did a bit of indirection and it works sweet. I am addressing the bits in the Byte with dot notation and it works well. here is copy-
Driver_Byte := Driver_Byte + BYTE#1 ;
Bit_Indirect := Bit_Indirect + BYTE#1 ;
IF Driver_Byte >= BYTE#8
THEN Driver_Byte := BYTE#0;
END_IF;
IF Bit_Indirect >= BYTE#8
THEN Bit_Indirect := BYTE#0;
END_IF;
IF ( Q_OUT[0] or Q_OUT[1] or Q_OUT[2] or Q_OUT[3] or Q_OUT[4] or Q_OUT[5] or Q_OUT[6] or Q_OUT[7] ) BYTE#255
THEN Q_OUT[Driver_Byte] := Byte#255;
ELSE Q_OUT[Driver_Byte].X0 := FALSE;
Q_OUT[Driver_Byte].X1 := FALSE;
Q_OUT[Driver_Byte].X2 := FALSE;
Q_OUT[Driver_Byte].X3 := FALSE;
Q_OUT[Driver_Byte].X4 := FALSE;
Q_OUT[Driver_Byte].X5 := FALSE;
Q_OUT[Driver_Byte].X6 := FALSE;
Q_OUT[Driver_Byte].X7 := FALSE;
END_IF;
But in the same code if i try to access the bit in the byte via indirect address i get error. i.e.-
Q_OUT[Driver_Byte].[Bit_Indirect] := FALSE; Or
Q_OUT[Driver_Byte].[Driver_Byte] := FALSE;
i believe its same as Q_OUT[4].X[4] or Q_OUT4.4
error i get is " illegal Variable Location Or Multi-element variable Q_OUT[Driver_Byte].'!
Thanks a lot!
Any way to code as MyArray[i+1] ?
Thanks for watching our video titled: 4.1 Arrays (IEC 61131-3 Basics with MotionWorks IEC). We recommend contacting our Technical Support with your application information at www.yaskawa.com/support-training/support, or you can also reach out to your local Yaskawa Service Provider - www.yaskawa-global.com/company/profile/global.
Looks a lot like PC worx from Phoenix Contact
Not everyone likes arrays! hehe