Vijeo Citect Momentary Pushbutton

dmned64

Member
Join Date
Jun 2013
Location
Florida
Posts
99
I have created a Vijeo Citect 2015 project with code to mimic a momentary pushbutton. The code sets a Start bit with the mouse button is clicked (down). When the mouse button is released (up) the code waits a few seconds the sets the Start bit to zero. Here is the code:

Down command
Start = 1

Up comamnd
Sleep(5);
Start = 0

There are several uses of this code in my project, each one setting a resetting a different Start bit.

Sometimes the the Start bit does not reset. It gets "stuck" at '1'. My initial code had the up command wait two seconds before resetting the bit and with the shorter delay a few of these Start bits would get "stuck". The only remedy was to reset the bit via the PLC programming software.

I thought perhaps the PLC scan was not seeing the command to reset the bit so I increased the delay to five seconds as shown above. I am not sure the actual scan time of PLC but increasing the delay would not impact the process so I gave it a try. Almost all the Start bits now seem to be resetting but one bit still gets "stuck".

I have verified that there is no difference in the construct (code, etc.) of this one object that is still getting "stuck".

Thoughts, suggestions?
 
Citect isn't my strongest, but:

[Action] Up
Select this option if you want a command to be executed (and a unique message to be logged) when the operator positions the mouse pointer over the object/group, and clicks and releases the left mouse button.
As with standard Windows buttons, if the operator moves the cursor away from the object/group before releasing the mouse button, the command isn't executed (unless you also select the Down option).

[Action] Down
Select this option if you want a command to be executed (and a unique message to be logged) when the operator positions the mouse pointer over the object/group, and clicks the left mouse button. The command will execute as soon as the mouse button is clicked.


So maybe changing cicode:


Down command
Start = 1
Sleep(5);
Start = 0


Maybe better would call Cicode function (Which you have maded), then call this cicode function and pass variable name inside to cicode code called.
On cidode function set/reset bit and pass status back with write command to variable name.
 
I found an old tech note (see below) that follows the same reasoning you suggest about the mouse movement away from the object before releasing the button. The note acknowledges this issue. I will pursue this route.


Applies To:
CitectSCADA 3.30 4.10 5.xx

Summary:
In version 3 Citect you can configure a button to respond to both down and up button states. However, when in the down state if you drag the mouse off the button the button returns to its up state and the up command will not be executed when the mouse button is released. This is the correct Windows operation as this way you can cancel pressing a button. This can cause problems for users who assume that the up command will execute in pairs with each and every down command. This is typically a problem if you turn on a bit with the button down and turn it off on the button up (eg to bump a drive). If you press the button down and then drag off the button the bit (and motor) will be left on.

Solution:
This problem has been acknowledged and is addressed in versions 3.3 and 4.10 of Citect. In these versions a new INI parameter, [ANIMATOR] ButtonCancelMode, has been added which specifies the behaviour of push button command cancellation. This parameter has three possible values: 0, 1, 2; 1 is default. When set to 0 Citect behaves as with previous releases. That is, on button down the button down command is executed and the button up command is only executed if the mouse button is released whilst the mouse cursor is on top of the button. When set to 1 the behaviour of command cancellation is determined by the configuration of the button. If you have configured a down command then the up command cannot be cancelled. If you have not configured a down command the up command can be cancelled. When set to 2 command cancellation is disabled. That is irrespective of how the button was configured the up command can never be cancelled.
The ButtonCancelMode parameter doesn't apply to CitectSCADA v5 button objects. In Citect v5 and later, the up command always executes if you have a down command defined as well. If you only have an up command defined it is possible to cancel it by dragging the mouse off the button before releasing. You can remove the possibility of cancelling the up command if you define a down command with the statement: Sleep(0);

Citect v3/4 button objects used in v5 projects will still work according to the ButtonCancelMode parameter setting.
 
Last edited:

Similar Topics

My system are taking data from RHT sensors, around 45 points. Now I want to make a function in which, if the data is #BAD or 0 in values for all...
Replies
0
Views
477
I have DI module ICPCon M7024UD connect to my pc using COM3 MODBUS RTU and also RHT sensors are using MODBUS TCPIP.. The problem is, it cannot...
Replies
9
Views
1,667
I need help with vijeo citect 7.4 as I use Modbus TCPIP to get the data, it turns out the address is having error.. For example, when I write...
Replies
2
Views
885
Hi everybody, I have a simple question for anyone who knows.We cant try because system is working and we dont have a permission about it. We have...
Replies
2
Views
732
I am trying to import a genie from an old project to new project, but I cannot do it and didnt find any answers yet on Google. Can anyone help me...
Replies
0
Views
745
Back
Top Bottom