AdvancedHMI Software
General Category => Support Questions => Topic started by: joko markono on October 24, 2019, 04:22:42 AM
-
Hi All,
I've read this thread:
https://www.advancedhmi.com/forum/index.php?topic=136.msg268#msg268 (https://www.advancedhmi.com/forum/index.php?topic=136.msg268#msg268)
Seems that there is no solution to input the negative value (if i don't miss anything there).
I'm setting up a page where i can always change the minimum and maximum value from the HMI.
The problem is i cannot enter negative numbers. I will get this warning: Failed to write value-Arithmetic operation resulted in an overflow.
Is there any way i can solve this problem?
-
Are you using version 3.99x or 3.99y ?
-
It's 3.99y
-
What negative number are you trying?
-
Any none decimal negative value. For example -6237
-
I will have to setup an Omron PLC and test this. The only reason I can see that you would get that error is if you exceeded the limits of a 16 bit integer. For example -32800
-
i appreciate that. my number will not reach -XXXXX.
FYI, I got the error even before i connect to PLC.
-
Does this also happen if you use a BasicLabel and set the PLCAddressKeypad ?
Do you have anything in the ScaleFactor property?
-
Yes, same thing. The scale value for the basic label is 1.
-
I'm just following up if there is any update on this?
-
Can you explain what driver you are using, what are those controls in the first picture you posted (more details)?
What does this mean:
I got the error even before i connect to PLC.
-
I'm using Omron serial hostlink protocol.
that statement means, before I connect the serial port to my PLC, there's already an error warning when I enter -ve value.
-
The problem comes from this code:
'**************************************
'* Convert an integer value to Hexadecimal
'**************************************
Public Shared Function IntToHex(ByVal data As Integer) As String
If data < 16 Then
Return "000" & String.Format("{0:X}", data)
ElseIf data < 256 Then
Return "00" & String.Format("{0:X}", data)
ElseIf data < 4096 Then
Return "0" & String.Format("{0:X}", data)
Else
Return String.Format("{0:X}", data)
End If
End Function
It is supposed to return 4 characters representing the hex value, but a negative value doesn't work.
I'll try to look for a fix later, but if anyone can suggest a fix in the mean time, I'll give it a go.
-
Maybe this:
'**************************************
'* Convert an integer value to Hexadecimal
'**************************************
Public Shared Function IntToHex(ByVal data As Integer) As String
If data < 0 Then
Return Hex(data).Substring(4) 'or Hex(data).TrimStart("F").PadLeft(4, "F"c)
Else
Return Hex(data).PadLeft(4, "0"c)
End If
End Function
-
I'm getting an error about the function Hex
Do you know where that is coming from?
-
It's a member of Microsoft.VisualBasic.Conversion.
-
I removed all of the references to Microsoft.VisualBasic, so I'll try this:
Public Shared Function IntToHex(ByVal data As Integer) As String
If data < 0 Then
Return data.ToString("X").Substring(4)
Else
Return data.ToString("X").PadLeft(4, "0"c)
End If
End Function
-
That seems to work properly as well.
-
I'm sorry where should i access to modify the code please
-
That seems to be inside the dll file so you will have to wait for Archie to do it.
-
i just want to keep this link here for reference:
https://www.advancedhmi.com/forum/index.php?topic=764.msg3648#msg3648
-
this problem is solved with v399y Beta35