ifix 2.5 write bit to PLC with onclick()

sparkie

Lifetime Supporting Member
Join Date
Nov 2014
Location
KS
Posts
1,148
Hey guys, so I have never worked on ifix before and got handed one of those "has to be done today" kind of projects.

I have everything set up, and all I want to do is write a 1 to a bit in the PLC when a button is clicked. I guess i would need a script to do this, but I'm unsure as I have never really worked on ifix before. Can anyone give me a hand with this?
 
When you say you have everything setup, what do you mean exactly? You have to consider the graphic, perhaps a script, a tag in the tagdatabase, and then the driver address alloications for which PLC your are communicating too. I would say find another tag that is doing something similar to what you want to do, and see from PLC to HMI the communication path to understand how it works. And when you do setup your new tag, make sure in the tagdatabase it is set to on scan. That one always bites you. ;)
 
Do you have the com driver all set up?

If your question is only in regard to scripts then read on. Not sure if wizard is available for 2.5 or not but if you right-click on an object - select animation then it should take you there. If wizard is not available, try right-click and select Script. iFix script is using Visual Basic for Application (VBA). For any object you can select the <event> for that object. the event is "On click" or something like that, you then write a script that does "writevalue ...."


I don't have 2.5 so I'm just guessing the above should work for you. You can always consult the eBooks that installs with iFix, which I admit, got way too much disorganized information.
 
Okay, thanks guys. I have an animation set up, though incorrectly. I will give a bit more detail, as the time I posted that I was about 14 hours into the day and too tired to think. Now I know exactly what kind of scripting I'm dealing with.

I have the data set up in the PLC, and the tags set up. The basis of my logic is this:

When the process water drops below 179 I use an OTL instruction to initiate the alarm. The PLC has a reset bit that energizes an OTU to disable the alarm. This bit with a couple other conditions starts a 5 second timer that will write a zero back to the alarm reset bit.

So I want to use onclick() to write a zero to that bit and let the PLC handle the rest. I'm not sure exactly what kind of tag I want to use. It seems that a digital output stays the same. The best I have come up with logic-wise is to use a DO instruction and this sequence:

User clicks the object
script writes a 1 to the digital output
delay of 5 seconds
script writes a zero back to the object

I'll have to do some digging on VBA as I have never used any form of VB before.
 
Both DO and DR in iFix can do what you want. Your first instinct is correct; use PLC to handle the rest. DO NOT USE VBA for timing.
 
The thing with DO is it seems that DO constantly sends the output every cycle. I'm worried about it writing over the bit. I can see how to reset the bit in my head, but I'm still unsure of how to implement that into ifix. I have not had a chance to dig in yet, I'm using the maintenance mode/ops mode bypass as a reset right now and it seems to be working okay.
 
I would use a DI with output enabled. That way it will read back from the PLC. Runs in my mind that iFix had issues with DO types back then.
 
Private Sub cmdButton_Click()

writevalue 1, "Your_PLC_DIGITAL_TAG_Name.F_CV"
Pause 5 'Pauses for 5 Seconds
writevalue 0, "Your_PLC_DIGITAL_TAG_Name.F_CV"


End Sub


Public Sub Pause(Delay As Double)
Dim Start As Double
Start = Timer
Do While (Timer < (Start + Delay))
DoEvents 'Lets other stuff run while paused
Loop
End Sub
 

Similar Topics

Hi I want to press a button on the HMI screen and write to a bit within an Integer within a control logix PLC. The iFix version is 5.5 and using...
Replies
3
Views
2,391
Hi there pals, i have a problem, i am working in a project with Ifix, i have to command some valves in a line from Chile to Argentina. The think...
Replies
4
Views
1,928
In the past, we were using old Intellution Fix and we allowed the user to backup historical data by just copying the HTRDATA folder to a disk with...
Replies
0
Views
2,353
I have an existing Ifix PIC that is reading a SQL table when an down time timer times out. The operator clicks on the popup, choose a button with...
Replies
1
Views
3,343
Dear all, I am beginer in ifix hmi programming. I have 2 ifix 6.0 pc with license FiX and client.. Can some one tell me how to configure sample...
Replies
0
Views
144
Back
Top Bottom