Ok, so you're really doing a message by bit. There may be one trick that can get you more alarms. If you use the address L40001, it will give you a 32 bit read that spans over 40001 and 40002
So let's say you use 40002.0, then the alarm number would be 256
Sorry Archie, I am unable to understand what you mean.
I tried to change the address to L40001, then when i change 40002 into 1 (meaning 40002.0 becomes TRUE).
It generates unknown alarm. In fact according to my alarm list, value 256 should generate Alarm 8.
Please correct me if i'm wrong.
So I was trying to do different method.
Mapping all my list of alarms into 1 modbus address using DataSubscriber.
Putting all the bits condition into array-of-boolean, if certain bit is TRUE or even FALSE, it will generate ALARM or ALARM NORMAL message.
Private Sub DataSubscriber1_DataChanged(ByVal sender As System.Object, ByVal e As MfgControl.AdvancedHMI.Drivers.Common.PlcComEventArgs) Handles DataSubscriber1.DataChanged
Dim arrBool(15) As Boolean
Dim temp As Integer
Dim iCtr As Integer
If e.PlcAddress = "413388" Then
temp = e.Values(0)
For iCtr = 15 To 0 Step -1
arrBool(iCtr) = 0
If temp > (2 ^ iCtr) - 1 Then
arrBool(iCtr) = 1
temp = temp - (2 ^ iCtr)
End If
If arrBool(iCtr) = 1 Then
ModbusTCPCom1.Write(465535, iCtr * 2 + 1)
ElseIf arrBool(iCtr) = 0 Then
ModbusTCPCom1.Write(465535, iCtr * 2 + 2)
End If
Next iCtr
End If
End Sub
Sadly, this is not working.
Basically I successfully map all bits of my alarm into array.
But because the MessageListByValue only gets the last number from the specified address (465535), finally it only generates 1 message.
I was thinking about allocating the message numbers into queue in for loop, then using timer to generate in sequence.
But before i go too far, i would try to get advise from you.
Maybe more efficient solution than my brute force.
Thank you.
Best regards,
Andrew