Announcement

Collapse
No announcement yet.

Reading/writing discretes from 2 registers

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts


  • Reading/writing discretes from 2 registers

    I'm using a proprietary PLC that stores 32 discrete inputs on modbus registers 30003-30004 (and outputs on 40003-40004). When I try to extract a discrete value in C-more from either of these registers, I get a CRC error. The panel is easily able to extract 32 bit and 16 bit integers from the registers however. How can I get discrete functionality from these registers?
    Last edited by eosalex; 05-21-2019, 12:32 PM.


  • #2
    'proprietary' meaning NOT an ADC product?
    maybe a bit more info is needed.
    Does the 'plc' support FCs 1,2,5 or 15?

    Comment



    • #3
      Originally posted by kewakl View Post
      'proprietary' meaning NOT an ADC product?
      maybe a bit more info is needed.
      Does the 'plc' support FCs 1,2,5 or 15?
      Yes, it is not an ADC PLC, but we are trying to integrate C-more panels into our SCADA panels for future customers. The PLCs are built in-house and already had modbus functionality, but was mainly used just for storing data in external databases on some systems.
      Normally we use fc4 for discrete and analog inputs, and fc3 for all outputs. All writes are done with fc16. We wouldn't use FCs 1,2,5, or 15 because we don't store discretes in the coils, rather in analog registers 30003-30004 and 40005-40006 as single bits.

      EDIT: I think I've found a solution. If I have some numeric display read off the contents of the discrete input/output registers as a 32 bit UINT (the numeric display can even be hidden) whenever I need to read/adjust discretes, then the indicators/pushbuttons/etc work just fine and there are no CRC errors.
      Last edited by eosalex; 05-22-2019, 09:19 AM.

      Comment



      • #4
        I was just wondering what PLC. Didnt really care that it was not an ADC. Just clarifying..
        Ahh. I see the reason for the FC4.
        What Cmore? Since you mention CRC, can I assume Modbus RTU driver?
        If so, is it 232 or 485?


        In the driver config, do you have a 'Bit' field in your PLC Address setup?
        Is Byte Order and Word Order the same for bitfield registers and analog registers in the 'plc?'
        If it is RTU, 485, maybe you could add another driver instance and configure a different byte/word order for the bitfiled registers to test.
        Last edited by kewakl; 05-22-2019, 09:16 AM.

        Comment



        • #5
          Originally posted by kewakl View Post
          I was just wondering what PLC. Didnt really care that it was not an ADC. Just clarifying..
          Ahh. I see the reason for the FC4.
          What Cmore? Since you mention CRC, can I assume Modbus RTU driver?
          If so, is it 232 or 485?


          In the driver config, do you have a 'Bit' field in your PLC Address setup?
          Is Byte Order and Word Order the same for bitfield registers and analog registers in the 'plc?'
          If it is RTU, 485, maybe you could add another driver instance and configure a different byte/word order for the bitfiled registers to test.
          I managed to get it working. Not sure how it exactly helped, but see my edit in the post above.

          And since you asked, it's an EOS Research ProControl. They use Modbus RTU, 485. Discretes are stored in big endian form. I'm using an EA1-S6MLW that we pulled from a site.

          Comment



          • #6
            Glad that you got if functional!
            Thank you for updating what you found!

            Comment



            • #7
              Originally posted by kewakl View Post
              Glad that you got if functional!
              Thank you for updating what you found!
              And of course right after I write that I'm having trouble WRITING discretes now.

              Comment



              • #8
                Do you pack the discretes and write as numeric also?

                Comment



                • #9
                  Originally posted by kewakl View Post
                  Do you pack the discretes and write as numeric also?
                  Yes I did.
                  It works if I have a recipe that sends a hex code to turn all of them off/on, but that's dangerous of course. I can also use the numeric entry to set the bits by entering a decimal, but that's just plain silly.

                  The raw write code should be something like this:

                  (slave address in hex) 10 0004 0002 04 UUUU LLLL (CRC code in hex)

                  Where UUUU LLLL are the hex bits of each discrete output. This has to be exactly what it was before, but with one bit changed in order to change only one output.

                  Really wish I had a serial sniffer so I could know exactly what the HMI is trying to send to the PLC but they're a few hundred dollars...

                  Comment



                  • #10
                    I bought a saleae logic analyzer years ago-when they were about $150. Used it too many times to count.

                    Comment

                    Working...
                    X