Author Topic: direct logic 05 and ModbusRTU com driver  (Read 27333 times)

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: direct logic 05 with the modbus RTU comm driver questions.
« Reply #45 on: September 25, 2014, 10:51:20 PM »
Your data is coming back in BCD format which uses 4 bits to represent each digit. Hexadecimal does essentially the same thing, but instead of 0-9 it uses the full 0-F and that is why TreatDataAsHex worked. I removed that feature because it was complicating the debug process.

You can make the DigitalPanelMeter use BCD by making this minor change to DigitalPanelMeter.vb at line 326:

Code: [Select]
    Private Sub PolledDataReturnedValue(ByVal sender As Object, ByVal e As MfgControl.AdvancedHMI.Drivers.Common.PlcComEventArgs)
        Try
            MyBase.Value = String.Format("{0:X}", e.Values(0))
        Catch ex As Exception
            DisplayError("INVALID VALUE RETURNED!" & e.Values(0))
        End Try
    End Sub

stilesbss

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: direct logic 05 with the modbus RTU comm driver questions.
« Reply #46 on: September 26, 2014, 10:25:17 AM »
Awesome.  Thanks Archie. 

I will give that a try and let you know how it works out.

stilesbss

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: direct logic 05 with the modbus RTU comm driver questions.
« Reply #47 on: September 26, 2014, 12:15:49 PM »
Hey Archie.

I modified the code, but am still getting the same readings.

I have tried to swap the values to look like  (e.Values(0), "{0:X}").  I've tried replacing the {0:X} with just X.  i've tried replacing the X in all variation with D.

Most iterations have no effect on the value displayed in the meter, the rest cause the program to not run.

I am going to keep looking up solutions, but any other ideas you have would be most appreciated.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: direct logic 05 with the modbus RTU comm driver questions.
« Reply #48 on: September 26, 2014, 01:20:48 PM »
There are 2 meters, DigitalPanelMeter and DigitalPanelMeterA. Make sure the one you modified is also the one you are using v

stilesbss

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: direct logic 05 with the modbus RTU comm driver questions.
« Reply #49 on: September 26, 2014, 01:26:43 PM »
I got it to work.

I replaced

MyBase.Value = String.Format("{0:X}", e.Values(0))

with

MyBase.Value = Hex(e.Values(0))

My initial test worked.  now i'm going to let it run for a while and see if it will keep count properly.

stilesbss

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: direct logic 05 with the modbus RTU comm driver questions.
« Reply #50 on: September 29, 2014, 11:25:10 AM »
Just a quick update.  I let the program run for 5 hours yesterday and everything worked beautifully.  Thanks Archie.