Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - betilly

Pages: 1 [2] 3 4
16
Open Discussion / Re: Latest version AHMI InterpretValueAsBCD
« on: March 26, 2020, 03:39:25 AM »
Latest AHMI, when i set OmronEthernetFINSCom1 TreatDataAsHex = True
and  basicLabel1 InterpretValueAsBCD = true
                         PLCAddressValue = E001
                         PLCAddressKeypad = E001
it writes 64 instead of 100, but read right.

If i set OmronEthernetFINSCom1 TreatDataAsHex = True
and  basicLabel1 InterpretValueAsBCD = true
                         PLCAddressValue = E001@B
                         PLCAddressKeypad = E001@B
it writes 61 instead of 1,looks like byteswap and wrong, but read right.

Soo i think with E001@B at the end is more trouble.

17
Open Discussion / Re: Latest version AHMI InterpretValueAsBCD
« on: March 26, 2020, 02:48:19 AM »
Try that but still writes 64 instead of 100 to plc register.

18
Open Discussion / Re: Latest version AHMI InterpretValueAsBCD
« on: March 25, 2020, 08:05:13 PM »
Code: [Select]
If address.BitsPerElement = 16 Then
                Dim x(1) As Byte
                For i As Integer = 0 To dataToWrite.Length - 1
                    If m_TreatDataAsHex Then
                        Dim data As Integer
                        Try
                            data = Convert.ToUInt16(dataToWrite(i), 16)
                        Catch ex As Exception
                            Throw New MfgControl.AdvancedHMI.Drivers.Common.PLCDriverException("Invalid hexadecimal value " & dataToWrite(i))
                        End Try
                        x(0) = CByte(data And 255)
                        x(1) = CByte(data >> 8)

that code....

19
Open Discussion / Re: Latest version AHMI InterpretValueAsBCD
« on: March 25, 2020, 05:30:41 PM »
I was checked that lines of code but its the same as you paste, nothing to do about converting etc.... But i check some FINSBaseCom.vb on latest AHMI and find some differences start at line 551 and below. Thats the code in my older version of AHMI
Code: [Select]
'* Memory Area Read (FINS 1,2)
        '* Reference : Section 5-3-3
        Public Overrides Function BeginWrite(ByVal address As MfgControl.AdvancedHMI.Drivers.Omron.OmronPlcAddress, ByVal dataToWrite() As String) As Integer
            If address Is Nothing Then Throw New ArgumentNullException("WriteData Address parameter cannot be null.")


            '* No data was sent, so exit
            If dataToWrite.Length <= 0 Then Return 0

            Dim CurrentTNS As Byte
            '* Save this
            CurrentTNS = CByte(GetNextTransactionID(255))

            Dim Header As New MfgControl.AdvancedHMI.Drivers.Omron.FINSHeaderFrame(MfgControl.AdvancedHMI.Drivers.Omron.GatewayCountOption.Three, TargetAddress, SourceAddress, CByte(CurrentTNS))

            '* Save this TNS to check if data received was requested by this instance
            'ActiveTNSs.Add(CurrentTNS)

            '* Mark as a write and Save
            address.IsWrite = True
            Requests(CurrentTNS) = address

            '* Attach the instruction data
            Dim dataPacket As New List(Of Byte)
            dataPacket.Add(address.MemoryAreaCode)
            dataPacket.Add(CByte((address.ElementNumber >> 8) And 255))
            dataPacket.Add(CByte((address.ElementNumber) And 255))

            '* 24-SEP-15 A 0xff was going in the bit position if no bit specified. This is so returned data doesn't think a bit was requested
            Dim BitNumberByte As Integer = Requests(CurrentTNS).BitNumber
            If Requests(CurrentTNS).BitNumber < 0 Or Requests(CurrentTNS).BitNumber > 64 Then
                BitNumberByte = 0
            End If
            dataPacket.Add(CByte(BitNumberByte))

            dataPacket.Add(CByte((address.NumberOfElements >> 8) And 255))
            dataPacket.Add(CByte((address.NumberOfElements) And 255))

            If address.BitsPerElement = 16 Then
                Dim x(1) As Byte
                For i As Integer = 0 To dataToWrite.Length - 1
                    If m_TreatDataAsHex Then
                        Dim data As Integer
                        Try
                            data = Convert.ToUInt16(dataToWrite(i), 16)
                        Catch ex As Exception
                            Throw New MfgControl.AdvancedHMI.Drivers.Common.PLCDriverException("Invalid hexadecimal value " & dataToWrite(i))
                        End Try
                        x(0) = CByte(data And 255)
                        x(1) = CByte(data >> 8)
                    Else
                        x = BitConverter.GetBytes(CUShort(dataToWrite(i)))
                        If address.IsBCD Then
                            '* Convert to BCD
                            x(1) = CByte(CUShort(Math.Floor(CDbl(dataToWrite(i)) / 100)))
                            x(0) = MfgControl.AdvancedHMI.Drivers.Common.CalculationsAndConversions.HexToByte(Convert.ToString(CUShort(dataToWrite(i)) - (x(1) * 100)))
                            x(1) = MfgControl.AdvancedHMI.Drivers.Common.CalculationsAndConversions.HexToByte(Convert.ToString(x(1)))
                        End If
                    End If
                    '* Bitconverter uses LittleEndian
                    '* Omron uses BigEndian, so reverse
                    dataPacket.Add(x(1))
                    dataPacket.Add(x(0))
                Next
            Else
                '* Bit level
                For i As Integer = 0 To dataToWrite.Length - 1
                    If Convert.ToInt32(dataToWrite(i)) > 0 Then
                        dataPacket.Add(1)
                    Else
                        dataPacket.Add(0)
                    End If
                Next
            End If[code]


20
Open Discussion / Re: Latest version AHMI InterpretValueAsBCD
« on: March 25, 2020, 03:08:35 PM »
This code is working to show correctly 0, when plc register is 0. Now i try to write value 50 to register, but instead of 50 it writes 32 to plc, something with dec/hex goes wrong, but the reading from plc register is correct, if i write directly from PLC Omron software. Is it possible just  to add read/write to E register Omron in driver code because  in old version of AHMI all that works, and already have app working?

21
Open Discussion / Re: Latest version AHMI InterpretValueAsBCD
« on: March 25, 2020, 01:16:33 PM »
If i try that i got error about Else statment is not correctly form.....

22
Open Discussion / Re: Latest version AHMI InterpretValueAsBCD
« on: March 25, 2020, 11:09:15 AM »
Yea, i found that lines of code in BasicLabel.vb before i ask here. When i insert breakpoint and check, it shows
ResultText "" .

I think must be something with the line of code
Code: [Select]
If (b(index) And 240) > 0 Or ResultText.Length > 0 Then
if i change to that

Code: [Select]
If (b(index) And 240) > 0 Or ResultText.Length >= 0 Then
it shows "00000000"

23
Open Discussion / Latest version AHMI InterpretValueAsBCD
« on: March 25, 2020, 05:21:20 AM »
Hi,
i was using old version of AHMI in the past. Now i need to read/write to Omron E area and saw that last version supports that too, thats nice.
But when i use basiclabel and set InterpretValueAsBCD as true, if the value in register of the plc is #0 ,value 0 is not shown on display. In older versions you set Value properties of basic label to for example 0000 and if value in register of the plc was #0, it shows 0000 on display. The problem is that i need to write to register also when value is 0. Soo in newest version i dont know where to click to write to register as value 0 is not shown.

Thank you

24
Support Questions / Re: OmronEthernetFINSCom
« on: December 25, 2018, 12:18:44 PM »
Thank you for explanation Archie.

25
Support Questions / Re: OmronEthernetFINSCom
« on: December 25, 2018, 10:50:17 AM »
I didnt say that something is wrong with driver, just that in older versions just need to set parameter treatdataashex set to true and  got displayed numbers as i want ( in hex). In latest version dont. I compare both fins drivers and omron base, and saw that some code was commented in latest beta version, maybe thats the point....?

26
Support Questions / Re: OmronEthernetFINSCom
« on: December 25, 2018, 05:45:24 AM »
basic label is working ok because you have option in properties InterpretValueAsBCD.

27
Support Questions / Re: OmronEthernetFINSCom
« on: December 24, 2018, 04:31:28 PM »
Anyone try and have same problem?

28
Not my intention, but could simply be done 😁. Ill deny any connection to AHMI if comes that far.

On what principe can be done to write to register with resizing object and lenght of object will be value to write? Any idea?

29
Just need to change from MouseClick to Click, now it works. Tnx
Phrog i know that in most cases when barlevel is used its for displaying value (graphic) of gas tank etc. ,and clicking on a bar has no meaning. But i actually draw a time diagrams for traffic lights at intersections, and if operator wants to change time for green light, if clicked on left he shorten that time, clicked on right he can extand that time. 

30
Support Questions / Re: OmronEthernetFINSCom
« on: December 18, 2018, 07:31:57 AM »
Value in holding register D1 #10 is shown as 16, with 399x version it shows right .

Pages: 1 [2] 3 4