Siemens S7/TIA v18: Only allow input of alphanumeric values......

This comes from other programming languages (which have inspired ST/SCL) where functions always have a value. The idea is that you can place a function inside a formula, and the formula uses the functions value for the calculating the result.

If you don't need to use that, you can change the type from BOOL to Void.
If you want to use it, you write a line like
#Parse_String := TRUE ;

edit: Yes, parky is right.
edit again: If the function has just 1 output, then use the return value. If the function has several outputs, configure output values and possible set the return value to void.
 
Last edited:
If I Remember correctly you do not need the output Var fc1_Parse_String as the function it'self is the return.

You've done it!

It now compiles ...now to see if it actually does what it's meant to - that's another question!

Edit: @LD has already tested it out, so unless I've screwed up, it should work.

fc4 compiled.png
 
Last edited:
This comes from other programming languages (which have inspired ST/SCL) where functions always have a value. The idea is that you can place a function inside a formula, and the formula uses the functions value for the calculating the result.

If you don't need to use that, you can change the type from BOOL to Void.
If you want to use it, you write a line like
#Parse_String := TRUE ;

edit: Yes, parky is right.
edit again: If the function has just 1 output, then use the return value. If the function has several outputs, configure output values and possible set the return value to void.

Ah, worth remembering, cheers for this.
 
No, it is no longer a function if it has outputs. Change the data type of the return value to a structure to encapsulate the data you wish to return.
 
No, it is no longer a function if it has outputs. Change the data type of the return value to a structure to encapsulate the data you wish to return.

Thanks, it is working fine now.
I tweaked the code a bit so that the string length must be exactly 7 alphanumeric characters. Anything less returns FALSE.
It's not possible to enter more than 7 characters because this is limited on the HMI settings.
Cheers
 

Similar Topics

Context: PLC= S7-1212C, HMI=KTP1200 Basic. Hi again, When the "REPORT" button is pressed (on a different screen), it takes the operator to the...
Replies
7
Views
667
Context: PLC= S7-1212C, HMI=KTP1200 Basic. Hi, The operator has reported that, from time-to-time, when he presses the "Generate Report" button...
Replies
5
Views
465
General Question: The PLC and HMI that I've been working on (a laser measurement system) is soon to be transported to the site where it will be...
Replies
2
Views
701
Hi, I'm not sure how to do this... Basically, I want to restrict the user input values for this tag to be in the range 20.001 to 25.0. I...
Replies
17
Views
1,636
Can someone help me with this? I'm no good at SCL - virtually everything I've done so far has been ladder logic. The return value from the...
Replies
13
Views
1,109
Back
Top Bottom