Vai al contenuto

Excluding a Portion of Code With IFDEF Statement

GF_ProjectVX code allows you to exclude from the compilation only a specific portion of code and checking if a certain symbol is defined, using the IFDEF feature.First of all, the IFDEF feature needs to be enabled, since it’s not an IEC standard feature.You can do that by selecting Project>options…>Code generation tab and then checking the Enable preprocessor directives checkbox. Excluding a Portion of Code With IFDEF Statement-image_0This feature is available only in ST, LD and FBD languages.This feature will exclude from compilation the selected code only if a specified symbol has not been defined; the symbol to be specified can be any symbol or POU (program, frun- tion, function block, global variable…) but it must be GLOBALLY VISIBLE.