easy-forum

English Support - Software => easySoft => Thema gestartet von: darek am März 17, 2024, 21:17:08 Nachmittag

Titel: User function block (UF) - in/out analog value
Beitrag von: darek am März 17, 2024, 21:17:08 Nachmittag
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;
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:
if I1 then
QA1 := QA1 + 1;
end_if;
and call UF like this:
UF01 (
  NAME := "qt",
  VERSION := "V1.00",
  I1 := I1,
  QA1 => MW1
 );
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:
if I1 then
QA1 := IA1 + 1;
end_if;
and call as:
UF01 (
  NAME := "qt",
  VERSION := "V1.00",
  I1 := I1,
        IA1 => MW1,
  QA1 => MW1
 );
I still can't change value of MW1...

BTW. Why there isn't something like symbols definition in ST. For example:
#define I01 as pulse:

IF pulse THEN
...
END_IF;
That would be a huge help.
Titel: Antw:User function block (UF) - in/out analog value
Beitrag von: radar17892 am März 18, 2024, 12:37:11 Nachmittag
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
 );
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
Titel: Antw:User function block (UF) - in/out analog value
Beitrag von: darek am März 18, 2024, 17:51:29 Nachmittag
Zitat
all variables are predefined at easysoft. You can write comments to any variable.
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!
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.
I know, it's only an example.


Titel: Antw:User function block (UF) - in/out analog value
Beitrag von: radar17892 am März 19, 2024, 10:23:25 Vormittag
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?
Titel: Antw:User function block (UF) - in/out analog value
Beitrag von: CiesleRa am März 19, 2024, 19:37:44 Nachmittag
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.

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
Titel: Antw:User function block (UF) - in/out analog value
Beitrag von: 190B am März 19, 2024, 19:43:04 Nachmittag
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.

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

Thumbs up