Announcement

Collapse
No announcement yet.

P3000 - How do I read a single bit and a few other questions.

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

  • P3000 - How do I read a single bit and a few other questions.

    We are needing to integrate some values from an ECblue ECM motor.
    From the manual the point is listed as MB Input Register 11, Address: i10 (Input 10) and has 16 bits.
    Min Value is 0 and Max value is 65535

    How do we read the specific bit 8 from that address?

    Do we need to "enable" our reads with a contact or is this optional? We're assuming it's optional but all the examples show a contact before the read or write block
    We'll have a total of 9 fans and read 3 registers from each.

    Thanks


  • #2
    Are you asking about 'reading' the values or 'accessing' a bit of the already-read value?
    IF accessing a bit of word - and your sw version supports and has it enabled, use the BitOfWord operator
    in the format
    Word:BitofWord

    Comment


    • #3
      I couldn't find Word:BitofWord but I did find "UnPack Bits". This looks like what I might be looking for. However, I'm not sure if I need to create a tag for every bit or if I can only Tag the one I need.

      Thanks.

      Comment


      • #4
        If you enable bit of word in your project file settings you can simply write a tag out in the format of:

        tagname_here:Bit_in_the_tag_data

        This lets you select a single bit of data from the tag. Or if using an array, you can write your tag like this:

        tagname_here(#)

        Where the # is the number for the specific column of data you want to access with that tag.







        Click image for larger version

Name:	BitofWord.png
Views:	48
Size:	17.3 KB
ID:	127654

        Comment


        • #5
          Since OP is using a P3, I mentioned that the PAC needs to support BitofWord - introduced in 1.6.0.19.
          Mike shows how to enable it. The BitofWord operator is a colon (:) between the parent word and the child bit.

          Unpack Bits can do as you need, just takes more tags. - BitofWord does not require the bitstatus to be broken out (to a tag) of the parent word

          usage
          Code:
          .
          .
          .   MyTag:3                      BitLamp  
          .------] [-------------------------(O)
          .
          .
          If the third bit of MyTag is true, the BitLamp will be on.

          Oh, the bits start at 1, not 0 as some desire. - so keep this in mind as you translate ModBus bits to PAC bits.

          Comment


          • #6
            OK, I do see that it's enabled. So basically it would be something like "Fan_Enabled:8" ?
            Would it be the same for my writes as well?

            Using my Fan_Enabled as an example, I see that it doesn't give me a Boolean tag. Will the integer I read still read as 0 & 1 or would I need to convert it to a Boolean? Is there anything I'll need to do on the C-More side?

            Thanks

            Comment


            • #7
              You should NOT need to use it as a separate tag.
              Just use the WORD:BIT name as the tag for the instruction

              Code:
              .
              .       Fan_Enabled:8
              .-----------] [----------
              .
              should work.

              No iterating through BitsofWord. Also, I don't think you can modify the value in dataview.
              The 'Bit' part is considered a constant value, so cannot be tagged.


              Oh, I didn't know about the HMI.
              I don't know if your HMI supports BitOfWord. What HMI?
              The EA9 supports bit of word.

              Click image for larger version

Name:	EA9_BoW.png
Views:	55
Size:	17.5 KB
ID:	127659
              Last edited by kewakl; 01-13-2020, 01:56 PM.

              Comment


              • #8
                Originally posted by JackW View Post
                OK, I do see that it's enabled. So basically it would be something like "Fan_Enabled:8" ?
                Would it be the same for my writes as well?

                Using my Fan_Enabled as an example, I see that it doesn't give me a Boolean tag. Will the integer I read still read as 0 & 1 or would I need to convert it to a Boolean? Is there anything I'll need to do on the C-More side?

                Thanks
                Yes, your fan enabled example is correct. I honestly dont use these bit of word's much so I dont remember how they all work in CMore and stuff like that from years ago. But I believe CMore allows you to make a tag that knows bit of word things. I think you have to set the data type to be discrete, like a "C" bit. But then you choose your integer type I think and it lets you select the bit. I think. lol

                edit: looks like Kewakl beat me to it, and with a nice screenshot to boot.

                Comment


                • #9
                  Thanks guys. We are using a EA9. Apparently I am not understanding or am missing something . My project properties are set as kewakl showed, but I get an error when I create the tag click
                  OK and configure the integer type. I tried all the integer types, function codes 2, 3 & 4 and tried a few writes as well.

                  If I create a new contact like you show and just create a tag on the fly it looks like it works but I'm not understanding how this is a modbus read from a 3rd party device.

                  Reading back through this thread, am I to understand that I just set up and read all my desired Modbus registers. If I need a specific bit in my logic I just use the bit of word format?
                  So I might read address 10 as a 16 Bit integer and tag it "Fan_Enable. It has 16 bits but I'm only interested in bit 8 so if I need the Fan enable to turn on a light I would use the tag:bit as you guys have shown?

                  I've been trying to create the bit of word as a tag within the Modbus Read block.

                  Click image for larger version

Name:	2020-01-13_153203-75%.jpg
Views:	39
Size:	55.6 KB
ID:	127664
                  Attached Files

                  Comment


                  • #10
                    I probably should have mentioned that these points are for monitoring only. I just need to show these points on the C-more panel.
                    I have one write that I'll need to perform and that will also be a bit that will need to be written. If I'm finally understanding what I need to do then I would tag my out coil the same way and perform my write on the next rung?

                    Thanks

                    Comment


                    • #11
                      Pac does not need to do anything for the hmi to work. Hmi is master. All comms initiates in hmi.
                      in my screenshot, the hmi tag is DISCRETE

                      Comment


                      • #12
                        You cannot create a bitofword tag. It is 'massaged' as needed from the parent-word by the instruction where the bit-operator is used.

                        Comment


                        • #13

                          MB read input register is FC4.
                          you may need to read one address lower that published
                          then you can (in PAC) use the BitsofWord operator in any instruction that accepts BitsofWord.
                          In your previous example, try testing the read of word 10 -- as you have it - but make it a word tag and remove the bit of word stuff
                          Then in a dataview put your word tag then :8 . if all goes well, the fan_enabled status should appear

                          Comment


                          • #14
                            Is the bit within the Integer tag some data that is on the P3k, or is it data on another PLC that you are trying to pull into the P3k before it gets displayed in an HMI?

                            Comment


                            • #15
                              I 'think' it is in a word in the motor. Seems like a motor with some comms smarts.

                              Comment

                              Working...
                              X