News:

  • December 05, 2024, 04:55:55 AM

Login with username, password and session length

Author Topic: h2-ctrio  (Read 13183 times)

johnny rotten

  • Jr. Member
  • **
  • Posts: 16
h2-ctrio
« on: April 24, 2013, 10:08:57 AM »
Using the above to count from an encoder, 1000ppr, maybe maximum of 3000pps in the process.  I'm taking the signal from an encoder that is going to another counter.  All works well, and the ctrio matches the other counter perfectly, which is a must.  The problem is matching the batch length and resetting the count.  If I send a reset command from the ladder logic at the end of the batch length, I am counting pulses past the batch length depending on where the cpu scan is.  If I don't reset the count and just use a calculator and watch the count, it is perfect, if I use the reset command from ladder logic, it is not accurate, but close. 

How do I reset the count at the end of a batch length without depending on cpu scan time?  Using a dl260 cpu.  Thank you.

John

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6052
  • Yes Pinky, Do-more will control the world!
Re: h2-ctrio
« Reply #1 on: April 24, 2013, 01:26:15 PM »
There are two possible ways to reset the count without involving the PLC. You can configure the counter channel's 'C' input as a reset, or you can use a preset table with a reset entry. Another possibility would be to not reset at the batch end, but instead capture the count using the channel's 'D' input and let the accumulator run.
"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 #2 on: April 24, 2013, 01:49:25 PM »
Thank you for that information.  Really all I want to do is have the operator enter a batch length from the touch screen and have the count reset at that value without cpu scan times effecting the accuracy.  I will investigate those ideas.  Thanks again.
John

johnny rotten

  • Jr. Member
  • **
  • Posts: 16
Re: h2-ctrio
« Reply #3 on: April 24, 2013, 02:31:13 PM »
I like the idea of the preset table with reset entry, going to try and make that work and may ask for some help. 

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6052
  • Yes Pinky, Do-more will control the world!
Re: h2-ctrio
« Reply #4 on: April 24, 2013, 02:59:11 PM »
I like the idea of the preset table with reset entry, going to try and make that work and may ask for some help. 

There may still be issues with that, although they should be far better than with the PLC. The preset table reset behavior in the CTRIO is still bound by the scan time of the CTRIO...it is a software function. While significantly faster than the PLC (especially if you use a CTRIO2) it is still not exact. Please report back, and if it isn't working like you hope we can brainstorm some more.
"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 #5 on: April 24, 2013, 03:03:08 PM »
So I've tried using the output preset table with a simple 'reset count' and it doesn't reset the counter.  The encoder is only one channel  so I have the input set as a counter on input A.

johnny rotten

  • Jr. Member
  • **
  • Posts: 16
Re: h2-ctrio
« Reply #6 on: April 24, 2013, 03:19:29 PM »
Hey Bob, what if I take my compare and reset rung in my program, and copy it so that it is every other rung in the program lol.  Going to sleep on this one, maybe some help tomorrow would be great. Thank you so much.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6052
  • Yes Pinky, Do-more will control the world!
Re: h2-ctrio
« Reply #7 on: April 24, 2013, 05:57:14 PM »
So I've tried using the output preset table with a simple 'reset count' and it doesn't reset the counter.  The encoder is only one channel  so I have the input set as a counter on input A.

How are you loading the table? Setting it as default or doing a table load command? Are you resetting the counter after the table is loaded?

Finally...if you plan on doing very much CTRIO/2 work, I would strongly recommend a Do-more CPU. It reduces the complexity by a bunch. Huge even.
"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 #8 on: April 25, 2013, 08:57:06 AM »
I'm actually not loading a table at all, simply taking the scaled count in my program and using sp relays (equal and greater than) the entered batch length, and fire the reset bit.  I do find some of that confusing, but if you steer me in the proper direction, I will give it a try.  What I want to do is take the v memory location that the operator enters, and I suppose load that into the ctrio so that it resets to zero.  I still need to use the scaled count within the program to do a bunch of other stuff, but if I can make the batch count accurate, one happy boy.

johnny rotten

  • Jr. Member
  • **
  • Posts: 16
Re: h2-ctrio
« Reply #9 on: April 25, 2013, 09:26:15 AM »
I'm going to go through the manual again today, if there are some good program examples you could send me, that would be great.

mironjp@yahoo.com

johnny rotten

  • Jr. Member
  • **
  • Posts: 16
Re: h2-ctrio
« Reply #10 on: April 25, 2013, 12:57:01 PM »
Ok, hope you don't mind all my posts here, but this is important. 

So within the workbench, I've set Output 0 to 'Discrete on Ch1/fn1'. and in the Preset table, added 'Reset Count at xxx'.

It works, and I imagine it is much more accurate than the dl260 cpu doing the reset.  Why this works, I don't really know lol. Now is there a simple Ibox or other way to have the v memory location from the program change this 'Reset Count at xxx' value?

John

johnny rotten

  • Jr. Member
  • **
  • Posts: 16
Re: h2-ctrio
« Reply #11 on: April 25, 2013, 03:22:51 PM »
Last one of the day. Didn't have much time today, so will attempt changing the preset table from ladder logic tomorrow. Find the manual very confusing, any help would be great.  Thanks again.

Greg

  • HostTech
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 692
  • Hmmm...
    • Host Engineering, Inc.
Re: h2-ctrio
« Reply #12 on: April 25, 2013, 04:09:40 PM »
johnny rotten, you can use the CTRLDPT "CTRIO Load Preset Table" IBox to load the Preset Table for the particular CTRIO Output. You can use the CTREDRL "CTRIO Edit Preset Table Entry and Reload" IBox to modify your Reset Count entry to whatever value you want and then reload that table so that it is ready to use with its new value.

If that is not enough to get you up and going, please feel free to let me know (support@hosteng.com).
« Last Edit: April 25, 2013, 04:28:08 PM by Greg »
There are two types of people in the world; those that can extrapolate from incomplete data sets.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6052
  • Yes Pinky, Do-more will control the world!
Re: h2-ctrio
« Reply #13 on: April 25, 2013, 04:30:24 PM »
Sorry Johnny. We are running downhill trying to finish up Rev 1.1 for Do-more and the forum has taken backseat to an extent.

Preset tables are generally for on-module outputs to be fired based on encoder position. We added the reset entry too, which although it isn't an output function, folks needed to reset counters after 0 to n output operations. Since preset tables are actually output functions...that happen to affect input functions...you still have to load the table to make it work, even if it doesn't use output presets. You apparently configured a default table, which is automatically loaded by the module...thus bypassing the need to actually load it.

You can use the Initialize Table function (0x12) to erase the table currently in memory and initialize it with a single entry. There should be an I-Box to do that. You can also edit the table in memory via Edit Table Entry (function 0x14) to change the reset value.

The manual for the CTRIO is far from our best effort...and I am very sorry for that. All I can offer is that it has gotten much, much easier with Do-more, but that may not be an option for you. To put it in perspective, however, I wrote the CTRIO's firmware, CtrioWb, and large parts of DirectSoft...I am as close to an expert as you will find...and given the choice, I would gladly rewrite my DL application for Do-more to get the improvements. FWIW...
"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 #14 on: April 26, 2013, 01:17:12 PM »
Thank you Bob and Greg. 

I have Ctrio Workbench 2, Version 2.1.11.1.
May have to upgrade that.

Soo on this Friday, I do not have the ibox 'CTRLDPT' - it is simply not there.  So I thought I would try the ibox 'CTREDRL', and see what it would do.  It gives me an error with the CTRIO # which is set at K0 as default, have tired numbers up to K5, and even K51 as the id of the card from the Plc is 51, and have no idea what value it should be.  So I can't even begin to guess what I should be puting in for output #, table #, entry #(0-based), entry type, pulse time, preset count, workspace, success, and error.

I actually have this system working on the plant floor now.  The workbench software says the ctrio card is in slot 2. 

I think once I understand this, I can basically use this card to do everything I want, use the 'set' and 'reset' and actually use the discrete output on the card rather than all the math in my program, so I'm eager to learn.  As far as the 'think and do', I've never played with that at all, perhaps in the future.