English Support - Software > easySoft

User function block (UF) - in/out analog value

(1/2) > >>

darek:
Hello.
I use ST language.
In main program when i write code like this:

--- Zitat --- //MW1 - some counter;
 if I1 then
 MW1:= MW1 + 1;
 end_if;

--- Ende Zitat ---
The value of MW1 can be overwriten from Modbus TCP, or integrated display.

But how to do the same within UF?
If the UF code is:

--- Code: ---if I1 then
QA1 := QA1 + 1;
end_if;

--- Ende Code ---
and call UF like this:

--- Code: ---UF01 (
  NAME := "qt",
  VERSION := "V1.00",
  I1 := I1,
  QA1 => MW1
 );

--- Ende Code ---
I can't overwrite value of MW1 from Modbus, or Display.

Is there any way to make variable input and output at the same time? When I change UF to:

--- Code: ---if I1 then
QA1 := IA1 + 1;
end_if;

--- Ende Code ---
and call as:

--- Code: ---UF01 (
  NAME := "qt",
  VERSION := "V1.00",
  I1 := I1,
        IA1 => MW1,
  QA1 => MW1
 );

--- Ende Code ---
I still can't change value of MW1...

BTW. Why there isn't something like symbols definition in ST. For example:

--- Code: ---#define I01 as pulse:

IF pulse THEN
...
END_IF;

--- Ende Code ---
That would be a huge help.

radar17892:
Hi darek,
all variables are predefined at easysoft. You can write comments to any variable.


--- Zitat ---UF01 (
    NAME := "qt",
    VERSION := "V1.00",
    I1 := I1,
        IA1 => MW1,
    QA1 => MW1
 );
--- Ende Zitat ---
This is not logic!
It should look like this:
UF01 (
    NAME := "qt",
    VERSION := "V1.00",
    I1 := I1,
        IA1 := MW1,
    QA1 => MW1 );
Change IA1 to an UF-Input
The code into UF can be:
if I1 then
   QA1 := IA1 + 1;
end_if;

By the way, you should use MW from the high range in the main program. It's better to use the lower area only for bits.

Thomas

darek:

--- Zitat ---all variables are predefined at easysoft. You can write comments to any variable.
--- Ende Zitat ---
It's not enough because you cannot use comments variable in ST (or I don't know how to use it?). When you program is biger you have to think what the marker means. Of course you can comment all the lines of code, but when you change something you heave to change all the comments. That's terreble. Is it really big deal to introduce symbols?


--- Zitat ---This is not logic!
--- Ende Zitat ---
What is not logic?
you wrote exactly the same code as me. Try in simulation change the MW1 value.


--- Zitat ---By the way, you should use MW from the high range in the main program. It's better to use the lower area only for bits.
--- Ende Zitat ---
I know, it's only an example.


radar17892:
your UF:
I1 := I1,
IA1 => MW1,
QA1 => MW1);

I wrote:
I1 := I1,
IA1 := MW1,
QA1 => MW1 );
Change IA1 to an UF-Input.

Do you see the difference?

CiesleRa:
Hi darek,


--- Zitat ---It's not enough because you cannot use comments variable in ST (or I don't know how to use it?). When you program is biger you have to think what the marker means. Of course you can comment all the lines of code, but when you change something you heave to change all the comments. That's terreble.
--- Ende Zitat ---

Sorry that I have to say this, but what you want is an PLC at the price of a VW with the comfort and functions of a Mercedes.
If you want to program with symbols, there are also Eaton controllers that can do this, e.g. XC-100, XC-200 or XC-300, with Codesys as programming software.
But you have to pay a little more for this.
By the way, the easyE4 with easySoft is, as far as I know, the only small controller that even offers ST as a programming language. 
Neither Siemens LOGO!, Schneider Zelio or Crouzet Millenium offer this.

BR
Ralf

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln