News:

  • September 29, 2023, 04:17:54 PM

Login with username, password and session length

Author Topic: h2-ctrio  (Read 11503 times)

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 5922
  • Yes Pinky, Do-more will control the world!
Re: h2-ctrio
« Reply #15 on: April 26, 2013, 01:23:28 PM »
Probably be best to work directly with Greg. We'll get you going.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

johnny rotten

  • Jr. Member
  • **
  • Posts: 16
Re: h2-ctrio
« Reply #16 on: April 26, 2013, 02:37:15 PM »
I will send some pics, I'm actually getting somewhere, no errors, so I'm going to go through some examples and see what I can figure out. 

Greg

  • HostTech
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 668
  • Why for you bury me in the cold, cold ground?
    • Host Engineering, Inc.
Re: h2-ctrio
« Reply #17 on: April 26, 2013, 03:06:24 PM »
johnny rotten,

Sorry about that typo. I should've told you it was CTRLDPR and not CTRLDPT. I'm going to walk you through an example.

Overall, you have to configure the CTRIO properly to do what you want, and then you have to write the ladder logic to properly interface with the CTRIO.

Configuring the CTRIO I/O:
1. Start CTRIO Workbench
2. Press <Config IO> button.
3. I assume at this point you have Channel 1 Input A configured as a Counter. If not, that's what you want.
     a. Here you can choose Up or Down counter.
     b. Which edges to count.
     c. Scaling (the little ruler icon in the top of the Function 1 box)
     d. Configure a default Preset (a Single Preset, or a Load Table Table Number).
          i. At this point, leave this at None because I want to walk you through an example.
4. In the Output tab, choose Output 0 as "Discrete on Ch1/Fn1".
5. Press <OK>

Now the CTRIO's Input A should be wired to your encoder. Your CTRIO's Output 0 doesn't have to be connected in your situation because you are not really using it in your process. But now we need a Discrete Table (other names for this is Preset Table, File, Profile). So...

Configuring Preset Table:
1. In CTRIO Workbench main screen, press the <Discrete Tables> button.
2. Press the <Add Preset Table> button.
3. By default it will be File #1. You can enter a Name if you want (optional).
4. Press the <Add Preset> button.
5. Choose "Reset Count".
6. Enter the value you want your count to reset at in Preset field.
7. Press <OK>.
8. Press <OK>.
9. Press <Exit>.

You now have a Preset Table (File #1) that has an entry in it that, when in use (or "loaded" as we like to say), will reset the count when it reaches a certain value. This table resides in the CTRIO's memory and can be loaded for a particular output to drive an output if desired. However, in your case, you are not doing that; instead, you are only using it to reset your count.

Now, since you have some of this working, I assume you know how to use the <I/O Map> button and map your CTRIO parameters to V-memory. So, write this configuration to your CTRIO. You are now read to use the IBoxes in ladder logic to control this configuration.

Writing Ladder Logic Control:

Before you use the CTRIO IBoxes (all these begin with "CTR" in their names), it is necessary to put a configuration IBox for your module in ladder.

1. At the very first rung of your ladder logic, put a CTRIO IBox (IB-1000). Do not put any logic on the input leg. You should have a CTRIO IBox (IB-1000) for each hardware CTRIO you have in your system. In your case you only have one.
     a. CTRIO #: Enter any K value you want. This is just a way for all the other CTRIO IBoxes to point to this module. So, you might call it K0.
     b. Slot: Enter the slot number... in your case, that sounds like it should be K2.
     c. Workspace: Enter any free V-memory register (must be unique).
     d. CTRIO Location: Choose "Local Base" of course.
     e. Input: Enter the V-memory starting address of your CTRIO input map (you get this from the <I/O Map> button in CTRIO Workbench).
     f. Output Enter the V-memory starting address of your CTRIO output map (ditto).
2. Somewhere in your program use the CTRLDPR IBox (IB-1001). This IBox needs input logic (whatever you want to use to trigger this event).
     a. CTRIO #: This IBox is basically asking you which CTRIO to use in your system (because you could have more than one in different slots). Since in Step 1 above we entered this to be K0, then enter K0 here to point to that module.
     b. Output #: Since in CTRIO Workbench we chose Output 0 for "Discrete on Ch1/Fn1", enter K0 to point to this CTRIO output (even though you are not physically using this).
     c. File #: This IBox wants to know which file in the CTRIO you want to load and use. We configured File #1 as a Preset Table in CTRIO Workbench, so enter K1.
     d. Workspace: Again, enter any free V-memory register (unique).
     e. Success: Enter any C-bit that is free. Basically when you turn the logic ON on this IBox and it executes successfully, this bit will get SET ON.
     f. Error: Enter any C-bit that is free. This will turn ON if the CTRLDPR was unsuccessful.

The Preset Table that has the entry of RESET COUNT AT x (whatever count you entered), is now loaded and ready to use.

When you want to change the RESET COUNT AT x value, then somewhere in your ladder logic, you would use the CTREDRL IBox (IB-1002):
1. Enter CTREDRL IBox
     a. CTRIO #: K0 (again, pointing to your CTRIO IBox #)
     b. Output #: We're using the Preset Table you have previously loaded above for Output 0... so, K0.
     c. Table #: We are editing File #1, remember? So, K1.
     d. Entry # (0-based): If you will recall your Preset Table only has one entry (RESET COUNT AT x), since this value is 0-based, then the first (an only entry) is K0.
     e. Entry Type #: When you configured your Preset Table in CTRIO Workbench, you could pick Set, Reset, Pulse On, Pulse Off, Toggle, or Reset Count. We chose RESET COUNT. Each of these types has a number associated with it: 0=Set, 1=Reset, 2-Pulse ON, 3-Pulse OFF, 4-Toggle and 5-Reset Count. You are changing a Reset Count... So this value should be K5.
     f. Pulse Time: Some of the Entry Types need a Pulse Time (e.g. Pulse ON and Pulse OFF). Reset Count does not need a Pulse Time. So enter K0 (since in your case it is ignored anyways).
     g. Preset Count: THIS is your new preset value that you are changing. This should, I believe, come from your HMI if I understand your application correctly. You should make this a variable (V-memory), and store the new value in this V-memory location before every time you execute this CTREDRL IBox.
     h. Workspace: Free V-memory
     i. Success: C-bit that will turn ON if successful.
     j. Error: C-bit that will turn ON if error.

This should get you started at understanding what is going on with the CTRIO and its IBox interface. Hope this helps!
« Last Edit: April 26, 2013, 03:17:47 PM by Greg »
There are two types of people in the world; those that can extrapolate from incomplete data sets.

johnny rotten

  • Jr. Member
  • **
  • Posts: 16
Re: h2-ctrio
« Reply #18 on: April 26, 2013, 03:36:48 PM »
Totally understand.  Thank you so much Greg.  Have an awesome weekend.  Will do this on Monday!

johnny rotten

  • Jr. Member
  • **
  • Posts: 16
Re: h2-ctrio
« Reply #19 on: April 30, 2013, 02:34:40 PM »
Well finally had a go at it today.  Got frustrated and added the 'CTRWFTR' Ibox in.  Changed some of my logic and finally got it working.  I imagine I don't want to be constantly writing to the ROM of the CTRIO.  Also the 'Preset Value' to reset the count is rarely going to change, so I really want to keep the reading and writing to the CTRIO to a minimum and perhaps only when the operator value changes after the first scan.  I suppose I can handle all of that. 

So just some thoughts, I'm not certain if I actually need the 'CTRWFTR' Ibox.  I think I will have to reload the Ibox's each time the operator enters a new value (v-memory).  Even though the reset count resides in the CTRIO memory, the hope is that it is much faster than using the cpu to fire the reset bit.  We are not using this piece of equipment for a week or so, so I hope to try this upgrade and see how much better it works.  The solenoid being fired is 120V so I can't use the discrete outputs, and don't want an interfacing relay. 

Open to ideas of course, and thank you so much.

John

'One time at PLC camp, I put my outputs into my inputs' - just made that up lol.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 5922
  • Yes Pinky, Do-more will control the world!
Re: h2-ctrio
« Reply #20 on: April 30, 2013, 02:59:53 PM »
Yeah...don't do the ROM write thingy. You don't need it, and depending on how often you write, it will wear out the memory.

I offered the best idea I had...use Do-more...but if that isn't possible, you should just need to load the table and edit the entry. Shouldn't be too bad, even with IBoxes. If that isn't working for you, I really would encourage you to get Mr. Greg on the phone and let him help you through it.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

johnny rotten

  • Jr. Member
  • **
  • Posts: 16
Re: h2-ctrio
« Reply #21 on: April 30, 2013, 03:24:53 PM »
Ok, I will take that instruction out.  I think I will be ok with the Ibox's.  The batch length would only be changed once a week.  Whatever is most accurate.  Even with the reset command coming from the cpu, it is not bad, and as mentioned, I put registration adjust buttons in the touch screen, just trying to make it as perfect as possible. 

johnny rotten

  • Jr. Member
  • **
  • Posts: 16
Re: h2-ctrio
« Reply #22 on: August 13, 2013, 02:34:27 PM »
Hey Bob and Greg, just wanted to thank you for all of your help.  We now have an extremely accurate automated marking system working on the plant floor. We do the marking on press rather than by hand.  Tried the new program a little over a week ago, and after several shifts it keeps perfect count, even with the reset.  Production has more than doubled, and that includes half a day dialing it in.  Thanks!!!!

John
« Last Edit: August 13, 2013, 02:37:01 PM by johnny rotten »

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 5922
  • Yes Pinky, Do-more will control the world!
Re: h2-ctrio
« Reply #23 on: August 14, 2013, 12:00:19 AM »
That's great news! We always love to hear about user successes. Thanks for letting us know.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Greg

  • HostTech
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 668
  • Why for you bury me in the cold, cold ground?
    • Host Engineering, Inc.
Re: h2-ctrio
« Reply #24 on: August 14, 2013, 09:02:50 AM »
Awesome, John. Glad we could contribute.  ;D
There are two types of people in the world; those that can extrapolate from incomplete data sets.