Beckhoff CX9000

dak2483

Member
Join Date
Jul 2008
Location
Rochester
Posts
2
Hey I am programming on a beckhoff cx9000 using TwinCAT. I am trying to make a program to simulate traffic lights. well in the sequence function chart(SFC)for the action part of a step I am getting an error sayin "CAL requires a function block instance as operand".
Could someone please help me out on that.

thank you.
 
CAL is a function block call. Apparently you used this operator but didn't provide a function block instance to go with it. Keep in mind that you can't directly use the function block name with CAL. You need to create an instance of that function block in a declaration somewhere (either global or local) using the fucntion block name as the instance type.

For example, you may have a function clock named Color. Somewhere you need to create an instance of this, just like you declare variables. So you would have:


VAR

Green: Color;
Red: Color;

END_VAR;



Then in the program you would have:

CAL Green();

assuming you didn't need to pass any parameters. If you did the parameters would appear in the parentheses.

By the way, this is all in the TwinCat help.

Keith
 
I appreciate your response. But i have an instance for my called block in the declaration part. Still me getting that error . And yes this is the same sample program that I have taken from twincat help. Part of the code looks like this

VAR
SIGNAL1: TRAFFICSIGNAL;
SIGNAL2:TRAFFICSIGNAL;
DELAY:WAIT;

SIGNAL: BOOL;
AMPEL1: BOOL;
AMPEL2: BOOL;
VERZ: BOOL;
COUNTER: INT;
COUNT: BOOL;
END_VAR

And then the follwing is called

CAL AMPEL1(STATUS:=4)
CAL AMPEL2(STATUS:=2)
CAL VERZ(ZEIT:=T#2S)
 
I think you are confusing functions and function blocks. You are listing BOOLs as function blocks in the call. The operand of a CAL must be a function block.


So try this:



VAR
SIGNAL1: TRAFFICSIGNAL;
SIGNAL2:TRAFFICSIGNAL;
DELAY:WAIT;

SIGNAL: BOOL;
AMPEL1: BOOL;
AMPEL2: BOOL;
VERZ: BOOL;
COUNTER: INT;
COUNT: BOOL;
END_VAR

CAL SIGNAL1(STATUS:=4)
CAL SIGNAL2(STATUS:=2)
CAL DELAY(ZEIT:=T#2S)

AMPEL1 := Signal1.{bit in the function block declaration you need}
AMPEL2 := Signal2.{bit in the function block declaration you need}
ZERT := DELAY.{bit in the function block declaration you need}



Or you could recode TRAFFICSIGNAL and WAIT as functions, in which case the code would be:

AMPEL1 := SIGNAL1(STATUS:=4);
AMPEL2 := SIGNAL2(STATUS:=2);
ZERT := DELAY(ZEIT:=T#2S);

assuming that the RETURN in each of those functions is a BOOL.

Keith
 

Similar Topics

Hi, I'm working with Beckhoff CX9001-1001 and CX9000-N031. I want to have 2x RS485 modbus rtu, how N031 must be configured in System Menager...
Replies
2
Views
2,703
Hello, I am trying to open the PLC project directly from the Beckhoff CX9000 (Screenshot 1) to do a backup of the project, because we don't have...
Replies
4
Views
8,046
Heloo, I have problem to communicate with Beckhoff CX9000 PLC and Denon AVR 2313. I want to send commands to Denon receiver from PLC...
Replies
0
Views
3,237
Hi, I have a problem with implementation of Modbus TCP/IP on CX9000. I did install Tc.ModbusSrv.lib in Twincat ( i use Twincat 2.10 v). I'd...
Replies
2
Views
9,836
Hello! I have Beckhoff CX9000 with N031(2 RS-485) module on board and Mitsubishi FRA740 inventor. I need to control inventor with Modbus RTU, but...
Replies
1
Views
4,182
Back
Top Bottom