user2304458
user2304458

Reputation: 387

how to parameterize a Function Block in CODESYS?

I have a FB (SmartLogic) with two boolean input variables and one output variable, but I want the output to depend of a parameter X too which i want to set during instantiation before the FB is called. Is that possible? And how do I do that?

Upvotes: 1

Views: 1291

Answers (2)

loraul
loraul

Reputation: 16

You can initialize FBs variables with the FB_Init method.

In CoDeSys help there is information about this methods.

https://help.codesys.com/webapp/_cds_method_fb_init_fb_reinit;product=codesys;version=3.5.16.0

Upvotes: 0

Sergey Romanov
Sergey Romanov

Reputation: 3080

  1. If you define X as global it will be accessible in your FB.
  2. You can pass X variable as another input parameter. Simply call FB after you initialize X variable.

Upvotes: 0

Related Questions