Archie,
Ive got another VBA chart display where there are 4 analog channels being read from an omega temperature device. All four channels update correctly in your Digitalpanelmeter component on the same form as the chart component, and update temperatures every 5 seconds. The panel meters work fine, so I know the Modbus ethernet addresses are correct.
But putting those same addresses in the Timer code below, the chart does not update. Any ideas? How can I check the variables valueZ1 to Z3 to see what is actually getting read from the omega?
Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
Dim valueZ1, valueZ2, valueZ3, valueZ4 As Single
'* Z1-Z4 = the temperatures from the omega device
Try
valueZ1 = ModbusTCPCom1.Read("400005", 1)(0)
valueZ2 = ModbusTCPCom1.Read("400006", 1)(0)
valueZ3 = ModbusTCPCom1.Read("400261", 1)(0)
valueZ4 = ModbusTCPCom1.Read("400262", 1)(0)
Catch ex As Exception
Exit Sub
End Try
'* Add the next point to the chart
Chart1.Series(0).Points.Add(valueZ1)
Chart1.Series(1).Points.Add(valueZ2)
Chart1.Series(2).Points.Add(valueZ3)
Chart1.Series(3).Points.Add(valueZ4)
'* Do not let more than 500 point be on the chart
If Chart1.Series(0).Points.Count > 500 Then
Chart1.Series(0).Points.RemoveAt(0)
Chart1.Series(1).Points.RemoveAt(0)
Chart1.Series(2).Points.RemoveAt(0)
Chart1.Series(3).Points.RemoveAt(0)
End If
End Sub