Announcement

Collapse
No announcement yet.

P2-HSI Not understanding pulse counting with it completely.

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


  • P2-HSI Not understanding pulse counting with it completely.

    I have a quadrature shaft encoder with only A and B channels and a P2-HSI module. I'm using CH1 to try and capture the encoder pulses so I can suss out the feet of paper going by.

    I have the encoder hooked up and can watch the 1A 1B LEDs flashing on the HSI display and in correct A/B order with direction.

    I'm using the Registration instruction to start the process. I used the 2-second contact to ENABLE the Registration instruction. I'm using input GPIn3 to Trigger the Registration.
    While I turn the encoder I can only see a non-zero count if I Trigger Registration right after one of the 2 second enables.

    I see the count and it increases as expected as brief flashes of an almost continuous zero count. Why does the Store Position Count constantly return to zero. Shouldn't it sit there with a growing count? How can I use these flashes of non-zero readings? What am I missing?

    A second question is: This encoder has only A and B how can I trigger Registration since the HSI only offers the Z or one of the two GPInx inputs? I have no hardware events to cause this. I just want to take the encoder value -whatever value it is- and run offsets from it. Is there no software way to get counting going?


    Thanks for any help.


  • #2
    Can you post a screenshot of your hardware config for the HSI module and the REG instruction opened for edit?

    Sounds like you are zeroing the count somehow.

    There are videos here


    https://youtu.be/wyiFURrhEzQ

    Comment



    • #3
      Are you confusing "set position" for "store position"? I dont recall there being any such store position instruction or tag. You would save/store your position data simply by copying the position out to another address. If you are using set position, then any time that is active it will be constantly resetting the count to whatever you set in the instruction. There is also a config area in the HSI where you tell it a tag to look at that will also reset the position count.


      The registration instruction requires a hardware input because this input runs outside of the ladder scan time. You cant have ladder tag be the input because that defeats the whole purpose of the hardware based registration. So if you dont have a hardware event to send a signal, then you should use another instruction instead.


      Could you please post screenshots of the HSI configuration and your ladder code?

      Comment



      • #4
        Hi PSeries and Mike. Thanks for helping.

        PS: I agree it does sound like I'm zeroing it constantly but I don't think I am.
        M: I'm just using the "capture and store position" I think.. And, thanks for pointing out that this thing runs asynchronously.

        As I mentioned I really just need to work with differences in the encoder values. If there's a way to have the counts constantly piling up somewhere I can grab them without ever using the Registration command I'd be up for it.

        Here's the setup:
        Click image for larger version

Name:	Registration Setup.png
Views:	97
Size:	31.1 KB
ID:	123161

        Here's the inline:

        Click image for larger version

Name:	Inline Registration.png
Views:	68
Size:	4.2 KB
ID:	123162

        As I toggle "E-Cable" by hand, a switch I'm using for expediency and see the (Registration Input) GPIn3 shift to "1" the (Store Position) 0 jumps to a number like 234 as I'm slowly turning my encoder. But, ONLY immediately after the ENABLE went high (via the two second timer). If I keep turning the encoder the next might be 268, then 295. But the (Store Position) retuns to zero within a second. The next two or three times I might toggle the (Registration Input) while the enable is '0' and nothing happens.

        The (Event Count) never seems to increment even though I think it should every time a registration occurs. Maybe I'm wrong about that too. :/

        I'd like to leave the enable always high and have the (Store Position) simply increment with the encoder count every single scan. That way i can have the ladder logic continuously running the paper and making realtime control adjustments.






        Comment



        • #5
          You probably do not need the reg instruction for what you are saying

          Again ......Can you post a screenshot of your hardware config for the HSI module??

          And are you using a SPOS instruction anywhere in your logic?

          You should be able to only enter the one tag in the hardware config for the current position and choose Quadrature x4 and leave everything else at default. Then with NO logic you should be able to see your encoder pulse count a the tag you put in the current position field.

          Click image for larger version

Name:	hsi.PNG
Views:	91
Size:	63.5 KB
ID:	123169
          Also have you used the HS module testing utility? See help topic P246
          Last edited by techme; 06-04-2019, 07:35 PM.

          Comment



          • #6
            Hi techme. I'm not using a SPOS instruction. Only the REG instruction.

            AHHH I wasn't getting the "Setup" request. Thinking you folks meant the REG instruction setup.

            Click image for larger version

Name:	Module Setup Inputs.png
Views:	74
Size:	41.3 KB
ID:	123165

            Click image for larger version

Name:	Module Setup Output Pts.png
Views:	69
Size:	39.1 KB
ID:	123166

            Click image for larger version

Name:	Module Setup Regs.png
Views:	69
Size:	43.8 KB
ID:	123167

            Click image for larger version

Name:	Channel 1 Setup.png
Views:	68
Size:	55.5 KB
ID:	123168

            I'm seeing that the Input Mode Config is not looking right with Pulse/Direction....

            Comment



            • #7
              You do not have a tag for current position and you have to select whether you have a quad x4 or quad x1 encoder.

              Comment



              • #8
                My logical assumption was that one should see the accumulated total of the counts generated by, whatever, be it a switch of some sort or an encoder in the Registration rung view was incorrect.

                It is indeed only available via the SETUP tag of "current position"(see last pic above). If I put up the DataView panel with that tag the counts do indeed show up there as expected. You do NOT even need a Registration for that to happen. You do need to somehow keep the count within the allowed 32bits available. SETUP provides for a tag to Jam in a new count including zero for this. Once the SETUP for the encoder channel is completed any and all encoder pulses are detected and summed always. Nothing else is needed.

                Thanks all for the help.

                Comment

                Working...
                X