Set bits and Toggle switches

Greg7683

Member
Join Date
Jun 2018
Location
Plainfield IN
Posts
355
I wrote a program for our Weintek HMI to connect to our Mitsubishi PLC I used two toggle switches for the start buttons but couldn't get the HMI to connect all parameters were set the same. So I switched them to set bits with the same addresses and it connected why wouldn't the toggles connect.




And with macros I don't get it I think I may need to write some macros for a couple of screens but I never wrote a macro before.
 
I suspect that the problem is probably in the device driver that EZwarePlus loads for your PLC. There have occasionally been similar problems with the Omron drivers.
 
And with macros I don't get it I think I may need to write some macros for a couple of screens but I never wrote a macro before.


Why do you think you need to use macros? What do you need to do?


Macros are just scripts that you can run a variety of ways.


Here is an example of one of mine. This is for reading data from an energy meter using Modbus, and then manipulating the data using some functions I wrote. It then puts the resulting data into registers on the HMI to be displayed on screen. I did it this way so the data is calculated in the background and not done when the relevant screen is loaded which slowed down the display of data.


Code:
[COLOR=Red]// Read all data from meter
// Some requires conversion
// Some is used for calcs

macro_command main()

int v, a, em111_s, mcb
float curr, volt, hz, temp_a, temp_v, temp_f
short check, f, status
bool em111_ok, em111_vonly

mcb = 32

// Get Data to do compare for lamp status

GetData(v, "GavazziMeters", "UPSO1L-N", 1)
GetData(a, "GavazziMeters", "UPSO1LC", 1)
GetData(f, "GavazziMeters", "UPSO1FREQ", 1)
GetData(check, "GavazziMeters", 3x, 4#8192, 1)

// Make integer values into floats

temp_v = v
temp_a = a
temp_f = f

// Do comparison for lamp status with function call

em111_s = em111_stat(v,a,mcb)
status = em111_s
em111_ok = em111_on(check)

// Divide data with function call to get
// real value

volt = l_volt(temp_v)
curr = ph_curr(temp_a)
hz = freq(temp_f)

// If voltage but no current make indicator flash

if status == 4 then

    em111_vonly = true
    
else

    em111_vonly = false
    
end if

// Set Data in Word for Word lamp

SetData(status,"Local HMI", LW, 303, 1)
SetData(em111_ok, "Local HMI", LB, 103, 1)
SetData(volt,"Local HMI",LW,60,1)
SetData(curr,"Local HMI",LW,62,1)
SetData(hz,"Local HMI", LW, 64, 1)
SetData(em111_vonly,"Local HMI", LB, 203, 1)

end macro_command[/COLOR]
 
I dont know thats why I am asking on one of our screens in a fuji hmi it has an M on it that looks like the M on the macro button but when I click on it it don't show any thing like that just some $u in the options
 
I wrote a program for our Weintek HMI to connect to our Mitsubishi PLC I used two toggle switches for the start buttons but couldn't get the HMI to connect all parameters were set the same. So I switched them to set bits with the same addresses and it connected why wouldn't the toggles connect.

Maybe it errors from Weintek Easybuilder Software version please check that software version is lastest.
 

Similar Topics

I have a graphic that has 2 buttons for Automatic and Manual, each with pushbutton animations associated with them to toggle a bit in the PLC, one...
Replies
8
Views
2,452
Hi, I have this code: LAR1 P##structy L 0 T LW [AR1,P#0.0] which resets all the bits in this struct called structy...
Replies
1
Views
634
In a Rx3i what would be the most efficient way to count the number of bits set in a word variable? The naive approach is to simply shift the bits...
Replies
2
Views
1,159
I was always taught to make my software easy to understand and fault find on by anyone reading it. Good practice right? Now I know set and reset...
Replies
18
Views
4,636
Using GE RX3i PLC with Machine Edition SW... I have a decimal %R number (value is "1150") that I want to write to a set of 16 %I bits to set 1 and...
Replies
18
Views
4,339
Back
Top Bottom