Industry Online Support
Technical Forum
3/6/2013 6:07 PM | |
Posts: 28 Rating: (5) |
Hi everyone, i am just started study about Siemens S7-300 And the program is work WELL
function code: FUNCTION Square:INT VAR_INPUT Nbr:INT; END_VAR VAR_TEMP Result:REAL; END_VAR BEGIN IF ABS(Nbr) <=181 THEN Result:=Nbr*Nbr; ELSE Result:=-1; END_IF END_FUNCTION ORGANIZATION_BLOCK OB1 VAR_TEMP info : ARRAY[0..19] OF BYTE; END_VAR BEGIN Output:=Square(Input); END_ORGANIZATION_BLOCK Now I am trying to make function (FC) with 2 input variable (variable1 + variable2), since SCL using PASCAL i am using thistutorial(section Function) , so according to tutorial i write this code function code: FUNCTION Add(Nbr,Nbr2):INT VAR_INPUT Nbr:INT; Nbr2:INT; END_VAR VAR_TEMP Result:REAL; END_VAR BEGIN IF ABS(Nbr) <=181 THEN Result:=Nbr+Nbr2; ELSE Result:=-1; END_IF END_FUNCTION ORGANIZATION_BLOCK OB1 VAR_TEMP info : ARRAY[0..19] OF BYTE; END_VAR BEGIN Output:=Square(Input1,Input2); END_ORGANIZATION_BLOCK i am also modify the symbol table (for adding Input2 and modify the function name) and it results ERROR (showed in attached picture), i also tried other variation like -FUNCTION Add:INT -FUNCTION Add(Nbr,Nbr2):INT -FUNCTION Add(Nbr,Nbr2:INT):INT -FUNCTION Add(Nbr:INT,Nbr2:INT):INT -FUNCTION Add(Nbr:INT;Nbr2:INT):INT Anyone experience with this case ? or know what's wrong with the code ? Thank you, |
Last edited by: Shaumi at: 3/6/2013 6:14 PM |
|
3/6/2013 7:14 PM | |
Joined: 1/28/2009 Last visit: 9/10/2024 Posts: 6849 Rating: (1365)
|
Hello , If you are a newcomer in SCL,Please check our package for starters: SCL Starting Point Also in STEP7's sample projects, search for "ZEN05_01_S7SCL__Measv06" as a already made project.You can upload your project to see what is really wrong in it. Best regards Hamid Hosseini |
Last edited by: hdhosseini at: 3/6/2013 7:15 PM// typo |
|
3/7/2013 3:03 AM | |
Posts: 28 Rating: (5) |
Thank you Hamid Hosseini, now my problem was solved best regards Shaumi Arif Al Faizin
|
This contribution was helpful to1 thankful Users |
Follow us on