Use STRING datatype with IEC61131 F_SEL block [message #1733888] |
Wed, 01 June 2016 20:36 |
|
Hi,
I'd like to switch between two string constants, depending on a BOOL value. That's why the F_SEL block was my first guess. Both inputs are of datatype ANY so i thought i can connect a STRING there. When I try to enter the string constants directly in the F_SEL properties, the IDE tells me, that this is not allowed. Also connecting other FB with STRING outputs to the F_SEL does not work.
Is there any easy way to achieve this, without having to create my own F_SEL_STRING block and compile it into FORTE?
Thanks
Herwig
|
|
|
Re: Use STRING datatype with IEC61131 F_SEL block [message #1733893 is a reply to message #1733888] |
Wed, 01 June 2016 21:36 |
|
HI,
could you be more specific on the error message. You should be able to put string constants on F_SEL. However as it is an ANY input you have to add the type information to your constants following the IEC 61131-3 literal conventions. For strings this means that you have to add STRING# upfront (e.g, STRING#MYSTRingconstant).
Also connecting strings should work. Could you say more on what is not working there?
Alois
|
|
|
Re: Use STRING datatype with IEC61131 F_SEL block [message #1733912 is a reply to message #1733893] |
Thu, 02 June 2016 07:55 |
|
Hi Alois,
thanks for your feedback. I did not use the STRING#, so this explains why i was not able to set the string constant in the F_SEL directly. I will try this on the weekend. When trying to connect the output of a CONCAT block with the F_SEL input I see a small prohibition sign and the wire is not connected and disappears when i release the mouse button.
greetings
Herwig
|
|
|
Re: Use STRING datatype with IEC61131 F_SEL block [message #1733936 is a reply to message #1733912] |
Thu, 02 June 2016 10:39 |
|
Hi Herwig,
thanks for the clarification. The problem with the CONCAT block is that it has as in and outputs ANY_STRINGS which have to be typed as well. Unfortunately we are currently not very good in propagating the type through a network. So for now you would need to insert a STRING2STRING FB between CONCAT and F_SEL. I know this is ugly and I really want to have this gone.
The CONCAT function is maybe better used in algorithms there I think it will also be more efficient as the compiler can optimize away some overhead.
Alois
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02188 seconds