Jump to content


Defining Fields For Function Blocks In Iec 61131-3 Variant


  • You cannot reply to this topic
No replies to this topic

#1 marke

    Posting Freak

  • Moderator
  • PipPipPipPipPipPip
  • 2,487 posts
  • Gender:Male
  • Location:Christchurch, New Zealand

Posted 05 January 2012 - 01:20 AM

I have just solved a problem that had me stumped for quite a while.

I am writing some software using scripted text in CScape 9.20 SP2

I have a number of modules and am beginning to add the real detail of the control systems.
On trying to add a write to removeable media, I kept on getting errors on test for errors.
I had defined all the arguments used in this function block and could not see why the error was occuring.
The error was :
MainSFC
MainSFC: GS401-P0(1): Argument has a wrong type
MainSFC: GS401-P0(1): ,: “END_ACTION” expected after action block
MainSFC: GS401-P0(1): ,: Invalid statement in SFC action
MainSFC: GS401-P0(1): END_ACTION: Invalid statement in SFC action

which strongly implied that one of the arguments was not correctly defined.

The arguments must be defined as variables in the appropriate section, or in the global section including, the function block itself.
(I tried using Ladder with the same result)

My line of code that was creating problems is :
WR(True,CF_CREATE,CF_UINT,'\setting.csv',W_Src,INT#40,INT#10,CF_CSV,False);

The issue was that the source of the data is defined as W_Src and I defined that is an integer because the data is all integers.
I have a Tag address which determines where the data starts. The trap however, is that this is a block of data so you need to also define the dimensions in the "DIM" field of the program variables table.

WR(EN,#MODE,#TYPE,FILENAME,SRC[],NUM,COL/ROW,#FILETYPE,#ENDOFROW);

In the Help file, the the variable is SRC[]. You NEED to define DIM ensions in the variable definition for this to work!!

This also applies to other function blocks such as PID controllers etc.

Best regards,
Mark.





3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users