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

stilesbss

  • Newbie
  • *
  • Posts: 13
    • View Profile
direct logic 05 and ModbusRTU com driver
« on: August 19, 2014, 09:55:59 PM »
Hi there.  I am really new to the world of PLCs but I must say that the communities are amazing.  Everywhere I have gone with questions the people are just awesome.

I have a few questions about connecting a DL05 using the modbus RTU driver.

When setting an address for the the objects there are 4 plcaddress lines,  each with a different ending.  Do they do different things?  Are they used for different objects?  Should each object use one spot, or should all 4 be filled?

Also, which method should be used for adjusting the plc addresses to modbus addresses when directing an object.

That should be it for now.  I have a lot more questions, but many of them depend on what I have already asked. 

Thank you everyone for your help.

« Last Edit: January 01, 2019, 07:57:37 PM by Archie »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: direct logic 05 with the modbus RTU comm driver questions.
« Reply #1 on: August 19, 2014, 10:01:02 PM »
When setting an address for the the objects there are 4 plcaddress lines,  each with a different ending.  Do they do different things?  Are they used for different objects?  Should each object use one spot, or should all 4 be filled?
As a general rule, the name after PLCAddress is the property that gets changed based on the value returned from the PLC. For example, if you put a valid address in PLCAddressValue, it will read the value from the PLC and place it in the Value property of the HMI object. In design mode, you can see the effect this has by manually putting a value into the corresponding properties.

stilesbss

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: direct logic 05 with the modbus RTU comm driver questions.
« Reply #2 on: August 20, 2014, 01:20:42 PM »
Thank You.  That was very helpful.

Now i am trying to get the buttons working.  I am not even sure what questions i should be asking so i'm just going to discribe what i am doing.

Using my fan control as an example it.

It is controlled by the C11 control relay.  using the directlogic to modbus address conversion i should be using 3082 as the address.  Advanced HMI won't take 4 digit addresses so i am assuming that i add a 0 to the front making it 03082 and put that in the plcaddressclick cell.  Then i set the output type to toggle and that should be it, but it doesn't seem to be working.

I can only guess that i am not using the correct address, or i have to add something in the ladder logic to let it be used by the hmi.  Any advice is appreciated.

Thank you again for the help.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: direct logic 05 with the modbus RTU comm driver questions.
« Reply #3 on: August 20, 2014, 01:58:59 PM »
Use 30082

stilesbss

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: direct logic 05 with the modbus RTU comm driver questions.
« Reply #4 on: August 20, 2014, 02:23:04 PM »
Nope that didn't work either.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: direct logic 05 with the modbus RTU comm driver questions.
« Reply #5 on: August 20, 2014, 02:28:59 PM »
Does it say which function code and element number to use?

stilesbss

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: direct logic 05 with the modbus RTU comm driver questions.
« Reply #6 on: August 20, 2014, 02:50:24 PM »
Thats kind of what i'm trying to find out.  There is a few different ways to calculate the address.

What i have been doing is the following:  584/984 Mode Address
CR take the octal adddress c11 convert it to decimal 9.
Add start of modbus address range, which for control relays is 3072
then add 1 for the mode address.

There is another section that talks about modbus function code.  I think for this it would be function code 05.  set/reset a single coil.

but the none of the address calculations use the function code.  one is what i have done above, and the second converts octal to decimal, then adds a range, then you put a data type in front of it, so C11 would be Coil 3081.

Thank you again for helping.
« Last Edit: August 20, 2014, 02:56:56 PM by stilesbss »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: direct logic 05 with the modbus RTU comm driver questions.
« Reply #7 on: August 20, 2014, 02:54:06 PM »
I think for function code 1 your address would be 10038

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: direct logic 05 with the modbus RTU comm driver questions.
« Reply #8 on: August 20, 2014, 03:09:56 PM »
The AdvancedHMI driver uses the first digit of the address to determine a function code, however it is not a 1:1 relationship. This is how it translates the address to function code:

                    Select Case CInt(AddressFirstDigit)
                        Case 0 : m_ReadFunctionCode = 1
                            WriteSingleFunctionCode = 5
                            WriteMultiFunctionCode = 15
                            m_BitsPerElement = 1
                        Case 1 : m_ReadFunctionCode = 2
                            WriteMultiFunctionCode = 0 '* Invalid
                            m_BitsPerElement = 1
                        Case 3 : m_ReadFunctionCode = 4
                            WriteMultiFunctionCode = 0
                            m_Element = CInt(Address.Substring(1)) - 1
                            m_BitsPerElement = 16
                        Case 4 : m_ReadFunctionCode = 3
                            WriteSingleFunctionCode = 6
                            WriteMultiFunctionCode = 16
                            m_Element = CInt(Address.Substring(1)) - 1
                            m_BitsPerElement = 16

stilesbss

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: direct logic 05 with the modbus RTU comm driver questions.
« Reply #9 on: August 20, 2014, 03:15:22 PM »
Ahh ok.  thats helpful.  Thank you.  I will take another crack at it and let you know how I fair.

stilesbss

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: direct logic 05 with the modbus RTU comm driver questions.
« Reply #10 on: August 21, 2014, 02:59:17 PM »
Ok.  Well there has to be something i am missing when it comes to adjusting addresses, and i can't figure it out.

i have not gotten any of my buttons to work.  So i took a step back and am going to try to attack it from a different perspective, i set up a pilot light and connected it to the X0 input of my plc.  Looking at my manual X0s modbus address should be 12049, and it is.  Using that address i am getting the pilot light to show when X0 is on and off, and if follows X0, so if i manually disconnect X0 the pilot light goes out.

X1 is being used in the same fashion as X0,  using the same adjustments for the address the modbus address of X1 should be 12050, but when i put that into a second pilot light it does not work and returns an A1/E1 error message about an invalid value returned.

Is there something i'm missing?  Do i need to make timing adjustments so its not trying to read everything at once.

Its just weird that i can get some stuff to work using the modbus address calculations in my manual and others dont.

Once again thank you for any help you can provide.  I really appreciate it.  That is a fantastic program and i'm really new at this so Thank YOU.

fohdeesha

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: direct logic 05 with the modbus RTU comm driver questions.
« Reply #11 on: August 22, 2014, 09:38:26 AM »
Ok.  Well there has to be something i am missing when it comes to adjusting addresses, and i can't figure it out.

The modbus RTU driver is currently bugged so it won't work properly even if you do exactly as you're supposed to. Archie pushed a new build out about an hour ago, this fixes the reading of bits, however writing to bits (as you're trying to do to control your fan) is still not working for some reason. You should follow our thread here, some good info - http://advancedhmi.com/forum/index.php?topic=410.msg1433#msg1433 - pretty much everything in there is relevent to what you're trying to do as I also have a Koyo PLC and was driving myself crazy : )

Koyo uses weird addresses for holding/output bits, like 3082. The function code needed for these bits is 01 read/05 write. As you can see from the code Archie posted above, to get advancedhmi to use those function codes, it has to see a zero at the very beginning of the address. So you were absolutely correct to put a zero in front of the address to end up with 03082. With the latest build you should now be able to read that bit without any problems (and any other bits, as long as you're sure it begins with a zero if the PLC wants to see a read function code of 01).

The Koyo inputs (eg 12049) only support a read function code of 02, and as you can see from the code archie posted above, to get advancedhmi to use that read function code, it wants to see a 1 at the beginning of the address you enter. So that works itself out, and you don't need to add anything to the input addresses. An easy way to remember where to put stuff in advanced hmi is the plcaddressvalue box is where you enter the plc bit you want advancedhmi to display the status of, eg whatever controls the light on the button component. the plcaddressclick is what plc address actually gets controlled by a click of the button in the software.

For what it's worth you don't need ot do any special address conversion. Just find the normal modbus address of the bits in the PLC software. I don't know how much different the software for the DL line is, but in the software for my Click, in the address picker you can click "display modbus addresses" and itll show the addresses and function codes needed. just use those addresses adding a zero at the beginning if needed. I made a picture to try and help:








Hope that helps! Doing the above with the latest build (3.65) will work to read any bits but still can't write them yet. hopefully soon!
« Last Edit: August 22, 2014, 09:44:52 AM by fohdeesha »

stilesbss

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: direct logic 05 with the modbus RTU comm driver questions.
« Reply #12 on: August 22, 2014, 02:57:04 PM »
Awesome!.  That helped a bunch and made me feel a lot better.

I got the new revision and took a crack at it this morning.  Initially i was having the same problems that i have been having.  The biggest example of this is my indicator light for inputs x0 (12049 modbus) and x1 (12050 modbus).

When i started only x0 was working correctly and x1 was giving my an error message.  I finally had a eureka moment though.  I had set my COM value TreatDataAsHex to true, because otherwise the meters i have set up to watch various timers and counters don't show the correct value, but that had been messing with my indicators.

I changed the COM setting for TreatDataAsHex to false and bam, xo and x1 are reading properly, buttons for my various internal relays are at least illuminating properly when the relay is on...and actually will turn the relay off, though not back on, but that was expected.

So, i am back on track to get this working pending a fix for the COM driver and i can figure out how to get some of my objects to have the data treated as hex and others not, but i am pretty sure i can work that out in the code.

Thanks you fohdeesha,  and Thank You Archie, you are Awesome.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: direct logic 05 with the modbus RTU comm driver questions.
« Reply #13 on: August 22, 2014, 06:25:46 PM »
Version 3.66 has been posted that has a fix for writing to output bits (function code 5)

fohdeesha

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: direct logic 05 with the modbus RTU comm driver questions.
« Reply #14 on: August 23, 2014, 05:12:11 AM »
Version 3.66 has been posted that has a fix for writing to output bits (function code 5)

Awesome! However the download seems bugged? Whenever I go to download it on sourceforge, it just times out trying to connect to the download server. I tried all the sourceforge mirrors too, nothing seems to work : (

edit: SF just started working again. will test and report back
« Last Edit: August 23, 2014, 06:09:38 AM by fohdeesha »