EB Pro - what am I doing wrong here?

EngNate

Member
Join Date
Jan 2023
Location
Bella Bella, BC
Posts
20
In Easy Builder Pro:
Unexpected results...
I've got a toggle switch set to trigger a macro to write a specified integer or a 0 depending on the state each time it is operated. Sometimes it works (updates correctly) and sometimes it doesn't, it seems random to me.

I've got:

TS_0(LB_0)
LD_0(LW_0)

and

macro_command main()
bool bA=0
short a=0
GetData(bA, "Local HMI",LB,0,1)
if bA==true then
a=0
else
a=1
end if
SetData(a,"Local HMI",LW,0,1)

end macro_command

Please pardon my ignorance, I'm an old dog learning a new trick...
TIA
 
Not done any TIA but why do the if....
Surely
macro_command main()
bool bA=0 // Why do you need this as it will be set by the get data
GetData(bA, "Local HMI",LB,0,1)
SetData(bA,"Local HMI",LW,0,1)// just set it to what bA is (assuming same type)
 
I set bA=0 just to eliminate the compile warning that the variable is not initialized. I guess that doesn't matter.

I only illustrated the #1 switch for the example. The value will be 2 for the #2 switch, then 4, 8, and so on. The data type will only match for the #1, the others are short integer so I'm treating them all the same.

The sum of these values will be sent to the smart relay where a word to bit converter turns it into discrete outputs. It seems to me this would be the most basic how-to but hours of video and 1000+ pages of manual I haven't found an example for this basic task. Maybe I'm approaching it the wrong way?

Any help over this hump would be much appreciated!!
 
Why don't you try to explain what you actually want done.

You have explained how you are trying to solve your problem (which may not be the best solution to the real problem).

As of yet I don't know exactly what you are trying to do.

I have wrote 100's of macro's for EBPro.
 
Sure. I didn't want to get too long winded to start. I've got an installation with two HMI's controlling two Zelio smart relays (SR3B261BD + SR3NET01) for lighting circuits. The two HMI's have failed, and there is no configuration backup, and anyhow the Schneider 4" units aren't available for who knows how long right now. So I'm going to use the Weintek product and work my way through it. I'm an electrical/electronics guy and not had to deal with PLCs before, or much with networking either.

So.. We have two mirroring displays with switches (16 or fewer) operating their respective relays on the two SR modules.

I'll post the FBD's from the two relays as soon as I resolve the software/firmware mismatch. The assumption I've gone on with my EB project is the Zelio end is a word to bit converter and I'm sending it a number which it decodes to discrete outputs. Thus, switches assigned 1,2,4,8... and send the sum. Also have to synch switch states on the other display.

Thanks!
 
Let's look at your current "Macro". (I can't figure out what triggers the Macro to run?)

So the TS_0(Toggle Switch) writes to address (LB_0) either a (0) or (1).
And the Macro will write a (0) or (1) to address(LW_0)


macro_command main()

bool bA=0 // I would just "DECLARE" my variables, I would not initalize them. Unless you need to start with a SET VALUE.
short a=0

GetData(bA, "Local HMI",LB,0,1)// This reads the TS_0(LB_0) address

if bA==true then//This condition only runs if bA equals (1) What happens if bA equals (0)?
a=0
else
a=1

end if

SetData(a,"Local HMI",LW,0,1)//This line runs everytime the Macro runs. Does any value need to be reset?

end macro_command
 
In Easy Builder Pro:
Unexpected results...
I've got a toggle switch set to trigger a macro to write a specified integer or a 0 depending on the state each time it is operated. Sometimes it works (updates correctly) and sometimes it doesn't, it seems random to me.

I've got:

TS_0(LB_0)
LD_0(LW_0)

and

macro_command main()
bool bA=0
short a=0
GetData(bA, "Local HMI",LB,0,1)
if bA==true then
a=0
else
a=1
end if
SetData(a,"Local HMI",LW,0,1)

end macro_command

Please pardon my ignorance, I'm an old dog learning a new trick...
TIA

OK, here was the problem: The macro was sometimes executing before the address write operation completed. Here is the solution:

....
DELAY(50)
GetData .....

The 50ms is probably more than enough.

The macro trigger is in the switch attributes settings.

Arrgg, I was stumped for so long - the macro is triggered instantly, it doesn't wait for the switch's native operation to finish.
 
Can't figure out why it is not working!

I have the same problem and tried the DELAY method, but it does not work for me. I'm trying to hide the System bar at start up of the main windows.


macro_command main()

bool lb = false
bool zero = false

DELAY(150)

GetData(lb, "Local HMI", LB, 0, 1)
if lb == true then
SetData(zero, "Local HMI", LB, 0, 1)
end if

end macro_command
 

Similar Topics

hello, I'm a student and for my final grade I have to repare a sepro robot. the only problem I have for now is that i have an error code 3...
Replies
0
Views
37
Sorry for my lack of knowledge, beginner here. Yesterday, we had a Pro-Face SP5000 HMI fail on us. The technician said that the HMI had the blue...
Replies
2
Views
122
Hi everyone, I hope you're all doing well. I'm currently working on updating an HMI project for the GP2500, and I've encountered a bit of a...
Replies
1
Views
98
SELECTED NEW FILE SELECTED PROCESSOR TYPE SELECTED I/O CONFIGURATIONS IM UNABLE TO CONFIGURE MY I/O’S. I HAVE A PAPER COPY OF A PROGRAM AND I...
Replies
0
Views
81
I have EB Pro installed on windows 11, I can open an existing project and edit but when I got to parameters tab and open page I get the hourglass...
Replies
0
Views
58
Back
Top Bottom