MicYeti

MX Component - EntryDeviceStatus

4 posts in this topic

New to programming MX Component so this might be a dumb question.  I'm looking for a way to monitor a device and raise an event when the status changes from 0.  I see the call  EntryDeviceStatus which raises an event when a device is set to a particular status.  I believe you can add a list of statuses to watch for up to 20?  (I have more then that, and it will change from device to device).  For now I created a timer that checks the status of the device I'm monitoring when it fires but I would prefer an event firing.  

Thanks in Advance! 

Share this post


Link to post
Share on other sites
Private Sub Input_monitor_Tick(sender As Object, e As EventArgs) Handles Input_monitor.Tick
        Dim lData(15) As Long 'Monitor device value storage
        Dim lRet As Long 'Return value


        lRet = AxActUtlType1.GetDevice("X0", lData(0))
        lRet = AxActUtlType1.GetDevice("X1", lData(1))
        lRet = AxActUtlType1.GetDevice("X2", lData(2))
        lRet = AxActUtlType1.GetDevice("X3", lData(3))
        lRet = AxActUtlType1.GetDevice("X4", lData(4))
        lRet = AxActUtlType1.GetDevice("X5", lData(5))
        lRet = AxActUtlType1.GetDevice("X6", lData(6))
        lRet = AxActUtlType1.GetDevice("X7", lData(7))
        lRet = AxActUtlType1.GetDevice("X10", lData(8))
        lRet = AxActUtlType1.GetDevice("X11", lData(9))
        lRet = AxActUtlType1.GetDevice("X12", lData(10))
        lRet = AxActUtlType1.GetDevice("X13", lData(11))
        lRet = AxActUtlType1.GetDevice("X14", lData(12))
        lRet = AxActUtlType1.GetDevice("X15", lData(13))
        lRet = AxActUtlType1.GetDevice("X16", lData(14))
        lRet = AxActUtlType1.GetDevice("X17", lData(15))


        If lData(0) = 1 Then
            lbl_X0_On.Visible = True 'Display  when turning ON
            lbl_X0_Off.Visible = False

        Else
            lbl_X0_Off.Visible = True
            lbl_X0_On.Visible = False
        End If

        If lData(1) = 1 Then
            lbl_X1_On.Visible = True 'Display  when turning ON
            lbl_X1_Off.Visible = False
        Else
            lbl_X1_Off.Visible = True
            lbl_X1_On.Visible = False
        End If

        If lData(2) = 1 Then
            lbl_X2_On.Visible = True 'Display  when turning ON
            lbl_X2_Off.Visible = False
        Else
            lbl_X2_Off.Visible = True
            lbl_X2_On.Visible = False
        End If

Here what my code look for monitoring Input of the PLC.

I put this code in a timer tick event, it's not a "entrydevicestatus"  but I can monitor all input and output this way!!

1 person likes this

Share this post


Link to post
Share on other sites

Thanks, this looks similar to my solution so we must of both come to the same conclusion.  

Share this post


Link to post
Share on other sites
Just now, MicYeti said:

Thanks, this looks similar to my solution so we must of both come to the same conclusion.  

This way work, probably not the nicest way, but that's work!!

2 people like this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now