Jump to content

How to catch event with Shared Variable in DSC modbus?


Recommended Posts

Hi,

I have a DSC Modbus server which includes some Shared Variables. I tried to use the event register to catch the event which if one shared variable is changed value. What I did is in the picture. But if one shared variable in one type of register is changed value (for example 10004), all of the remain shared variable in the same type of register generate the event even their values are not changed at all? I don't know how to separate the one which really change the value form the event. I don't want to use the method of comparing the new value with the value stored in shift register based on some reasons.

Please tell me how to solve this issue.

Thank you,

Thang Nguyen

post-7703-1216251313.jpg?width=400

Link to comment

QUOTE (neB @ Jul 17 2008, 01:37 PM)

Isn't there a "previous value" property to which you can make your compare?

Ben

There is not this property.

I tried to use the front panel data binding, but these shared variable control didn't generate the event when they are changed value through the modbus. I stuck T_T

Link to comment

QUOTE (Thang Nguyen @ Jul 17 2008, 06:11 PM)

There is not this property.

I tried to use the front panel data binding, but these shared variable control didn't generate the event when they are changed value through the modbus. I stuck T_T

Yup! you are correct.

Then query this shared variable history based on the shared variable value returned by the event. Can anyone think of a better approach?

Ben

Link to comment

QUOTE (neB @ Jul 17 2008, 06:00 PM)

Yup! you are correct.

Then query this shared variable history based on the shared variable value returned by the event. Can anyone think of a better approach?

Ben

I think about storing the values in a shift register and compare with new value to find out which one is a change value one.

Link to comment
  • 4 weeks later...

If you're just concerned about getting an event on the one Modbus register you can use the 'DataSocket Read' VI in blocking mode. This function will return a value only when the Modbus register changes or upon a timeout.

To get the desired behavior you would create a separate while loop that uses DataSocket Read to monitor the tag then generate a user event for your main loop if the data changes. You can get at the Modbus register using a 'psp://...' URL.

-Nick

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.