AdvancedHMI Software
General Category => Open Discussion => Topic started by: joko markono on November 10, 2019, 10:28:45 PM
-
Hi Guys,
May I know how can I change to correct axis for positive and negative value of the y-axis?
as can be seen in the attachment, I key in -50 but the cursor pointed on the positive region.
x-axis is working fine.
-
Keep ImageTranslateXValue as it is and negate the ImageTranslateYValue.
See the attached picture.
-
Sorry i don't get it. do You mean negate in PLC program?
-
That's probably the best choice.
Otherwise, you could try not to put any address in the PlcAddressImageTranslateYValue and then manually subscribe to the desired address similar to this:
Private Sub MainForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.ModbusTCPCom1.Subscribe("40002", 1, 250, AddressOf ModbusTCPCom1_SubscribedDataReceived)
End Sub
Private Sub ModbusTCPCom1_SubscribedDataReceived(sender As Object, e As Drivers.Common.PlcComEventArgs)
If e.ErrorId = 0 Then
If e.PlcAddress = "40002" Then
If e.Values.Count > 0 Then
Me.AnimatingPictureBox1.ImageTranslateYValue = -e.Values(0)
End If
End If
End If
End Sub
-
I prefer the second option so that I don't have to mess up with the PLC program.
unfortunately, it doesn't work. I can see the pointer jump to the +ve y region occasionally but it is mainly on the -ve region all the time (note that my analog value is +ve).
here is my modified code from your advice:
Private Sub IOPanel_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.OmronSerialHostLinkCom1.Subscribe("2001", 1, 250, AddressOf OmronSerialHostLinkCom1_SubscribedDataReceived)
End Sub
Private Sub OmronSerialHostLinkCom1_SubscribedDataReceived(sender As Object, e As Drivers.Common.PlcComEventArgs)
If e.ErrorId = 0 Then
If e.PlcAddress = "2001" Then
If e.Values.Count > 0 Then
Me.AnimatingPictureBox1.ImageTranslateYValue = -e.Values(0)
End If
End If
End If
End Sub
-
Did you put any address in the PlcAddressImageTranslateYValue?
-
Yes. Owh, i should remove it. now it works fine. thanks a lot.