Syntax in Weintek mTV Macro

daba

Lifetime Supporting Member
Join Date
Jul 2004
Location
uk
Posts
5,401
Struggling with the syntax used in Weintek macros (EasyBuilderPro - Version 4.10.05).

All I want to do initially is use a screen button to set a bit in the PLC, and set the Local HMI, LB9042 to Acknowledge All Alarms. I assume I have to have the button run a macro to perform the second function....

So the screen button is a "Set Bit" object, and the write address is the PLCs Alarm Acknowledge tag, and that works fine.

I can't get the syntax correct for the macro to turn on LB9042 in the HMI... Can anyone help ?
 
Thanks mendonsy, i've used the Ack declaration, and the first SetData line, and the macro compiles OK, but it doesn't seem to acknowledge all alarms... they acknowledge individually on the alasrm list, but that ack-all doesn't do anything.

any ideas ?

thought i'd found it, not set the data to a 1, but that doesn't work either...

here is what i've got...


macro_command main()
bool AckAll
AckAll == 1
SetData(AckAll, "Local HMI", LB, 9042, 1)
end macro_command
 
Last edited:
The only thing that comes to mind is the possibility that some of the alarms trigger multiple times. I would suggest creating an alarm history display (event display set to history) so that you can see all the alarm states (occurred, acknowledged, and cleared) and put a momentary button on that page so you can force LB9042 on.
 
All the alarms are statically ON in the PLC until Reset.

Clicking on each individual alarm acknowledges it (it changes colour, anyway), but the macro doesn't acknowledge them.

A "momentary button" setting LB9042 does work though...

Does the macro have to set LB9042, then clear it ? edit : tried that, still no joy
 
Last edited:
You're right!! I should have caught that!!
Actually the easiest way would be to replace those two lines with:
bool AckAll = 1
I'm surprised that didn't generate a compile error.

That's perfect !! Exactly does what I wanted....


macro_command main()
bool AckAll = 1
SetData(AckAll, "Local HMI", LB, 9042, 1)
end macro_command

Now where did I see the == operator ? Must have been example code in EBPro "help". And yes the compiler accepted it without error.

If anyone can explain when it is right to use == instead of =

I'm familiar with the := assignment (becomes equal to) from BASIC days, and I've also seen code with the == (can't remember where, might have been FORTRAN, or even another flavour of BASIC, but it is valid in some languages).

It would have been so much simpler without the local variable AckAll, which does nothing except pass a value into the SetData function.... for example...

SetData(1, "Local HMI", LB, 9042, 1)
 
Here's an example:
macro_command main()
bool AckAll = 1
if AckAll == 1 then
SetData(AckAll, "Local HMI", LB, 9042, 1)
end if
end macro_command
 
in user manual chapter 25

= for Assignment operator


== Comparison operators

User Manual ? Really ? Where can I get this from ?

The = versus == makes complete sense now.

Do you know if there is a macro command to close a window ?
 
Do you know if there is a macro command to close a window ?
If you are talking about a pop-up window the answer is no there is not. I have complained about that to tech support!!
You can close a direct window or change the displayed base window from a macro.
 

Similar Topics

Hi all. I'm building my first Grafcet using Logix, but I started from another project. From what we usually do with other PLC's, I was expecting...
Replies
3
Views
154
Hi. I'm struggling over some basic stuff here. 41001 I is a 16 bits integer that I'm able to read with InTouch. What I need to do is to read...
Replies
1
Views
94
Hello, Im new to Studio 5000 View Designer and i try to make a popup reusable screen. So i create a user-defined screen with 2...
Replies
2
Views
246
When using the Siemens S7-1200 Symbolic Addressing driver, there is no Offset Tag or Index Option I wish to be able to read an array tag for...
Replies
0
Views
693
Hello, Which syntax I need to use for write on value on a “local tag” that have “Machine” as scope? Thanks
Replies
0
Views
441
Back
Top Bottom