Sign in to follow this  
Followers 0
Xavier2x

CODESYS

7 posts in this topic

Hi, I want to know how to work with IL (Instruction List) but even with a simple PLC code I get errors and I don't know how to fix them. GVL: Start_IL AT %IX0.4: BOOL; Stop_IL AT %IX0.5: BOOL; Light_IL AT %Q0.2: BOOL; ACT: LD Start_IL OR Light_IL ANDN Stop_IL S Light_IL I get the 3 following errors: - C0007: Expression expected instead of 'OR' (OR) - C0007: Expression expected instead of 'AND' (AND) - Accu must be loaded properly before this statement (S) Someone has an idea what I'm doing wrong? Edited by Xavier2x

Share this post


Link to post
Share on other sites
I think I know what's causing the problem. I made a Function Block (StartStop_IL) in IL and wrote the following code: LD Start_IL OR Light_IL ANDN Stop_IL S Light_IL Then I tried to call this FB in my PLC_PRG with the following code: PROGRAM PLC_PRG VAR INSTANCE: StartStop_IL(); (* Making an instance of the StartStop_IL) END_VAR INSTANCE(); (* Calling the instance of the StartStop_IL) Now this is what causing the problem, by deleting this code the problems are gone. But I still want to call my Function Block...So the problem isn't solved. Does anyone know how to call properly a FB (IL) in your PLC_PRG? Edited by Xavier2x

Share this post


Link to post
Share on other sites
See if this helps... (If not I may be able to take a look on Monday) http://forums.mrplc.com/index.php?showtopic=23909 This is ST so may not help. Edited by Veganic

Share this post


Link to post
Share on other sites
Thank you for replying. But that solution only worked for me for FBD, ST and LD. Not for IL. So to be clear: PROGRAM PLC_PRG VAR INSTANCE_FBD: StartStop_FBD(); INSTANCE_LD: StartStop_LD(); INSTANCE_ST: StartStop_ST(); INSTANCE_IL: StartStop_IL(); END_VAR INSTANCE_FBD(); INSTANCE_LD(); INSTANCE_ST(); INSTANCE_IL(); (*This one does not work correctly and I get the following errors, seen below) I get the 3 following errors: - C0007: Expression expected instead of 'OR' (OR) - C0007: Expression expected instead of 'AND' (AND) - Accu must be loaded properly before this statement (S) These errors do count for the code written in the IL function block, here: LD Start_IL OR Light_IL ANDN Stop_IL S Light_IL But the code in the PLC_PRG is causing these errors. Can someone help please? Edited by Xavier2x

Share this post


Link to post
Share on other sites
IL_FB_CALL_FROM_IL.bmp IL_FB_CALL.bmp It seems to work for me. INSTANCE(); or just INSTANCE; from ST. CAL INSTANCE from IL. What version of CoDeSys are you using? Is the main PLC_PRG in IL? Edited by Veganic

Share this post


Link to post
Share on other sites
CoDeSys V3.5 and my main PLC_PRG is in ST. I tried to do the same as you did. Even with the IL in the main program. My codes are exactly the same written but I still got those errors. I don't understand.. :( Edited by Xavier2x

Share this post


Link to post
Share on other sites
Try the attached program. Created in V2.3 Changed the extention from .txt to .pro ILTEST1.txt

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0