Author Topic: Problem with script code  (Read 4023 times)

Luis_IngSL

  • Newbie
  • *
  • Posts: 5
Problem with script code
« on: March 26, 2010, 07:22:54 PM »
I 've maked a Block script procedure and I wanted to pass some parameters.
I'm calling this block from the Phase 1 of Level 1 in a Ladder segment, but always I receive a compilation error and I don't know how to solve it.
I attach the plc program.
Can you help me?.

Thanks.

[attachment deleted by admin]

EasyPLC_Master

  • Developer
  • Administrator
  • *****
  • Posts: 849
  • Nirtec
    • The EasyPLC Project
Re: Problem with script code
« Reply #1 on: March 26, 2010, 09:32:48 PM »
The Block script procedures can't use parameters if are called from the Ladder language, however can use parameters if are called in the same script code.
Example:

Sub Test()

Dim n

n= Add(1,2)

End Sub

Function Add(n1,n2)

Add = n1 + n2

End Sub

But for your case you must use the Configurable Blocks, this components are script functions that can be used from the Ladder language passing parameters and returning values is are needed. I attach your code programmed with this component.

I hope this help you. Regards.

[attachment deleted by admin]

Luis_IngSL

  • Newbie
  • *
  • Posts: 5
Re: Problem with script code
« Reply #2 on: March 27, 2010, 09:36:14 AM »
Thank you very much, now I understand the configurable blocks concept!.
Congratulations for this fantastic software!.