News:

  • September 29, 2023, 04:11:28 PM

Login with username, password and session length

Author Topic: CTRIO count preload.  (Read 4814 times)

jackeroo31

  • Newbie
  • *
  • Posts: 2
CTRIO count preload.
« on: October 28, 2013, 08:13:35 PM »
I have a problem that is driving me crazy and I cannot find the solution. I have searched the forums and did not locate an answer.

I have using a CTRIO in slot 4 of a DL06. I am using as an encoder input for axis control.

I have found and understand how to make the counter retentive on power recycle, but I need to preload this counter with a value.

This value will be determined by the operator. What I want to do is press a command button on the HMI will send this this given quota to the CTRIO. I can activate the reset command B3054.1 and it works, but the value resets to '0'. I need to preload this value, then reset the counter to this adjusted value.

I can do this through the CTRIO workbench, but I need to do this at runtime.

I have the CTRIO inputs addressed to V3000 and outputs to V3030.

Any help would be appreciated.

rlp122

  • Sr. Member
  • ****
  • Posts: 58
Re: CTRIO count preload.
« Reply #1 on: October 29, 2013, 08:16:22 AM »

jackeroo31

  • Newbie
  • *
  • Posts: 2
Re: CTRIO count preload.
« Reply #2 on: October 29, 2013, 11:53:18 AM »
That is exactly what I want to do. I found this for Do-more. Ds5 does not have this. Why? I don't know, but it does not.


b_carlton

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 606
    • thePLCguy
Re: CTRIO count preload.
« Reply #3 on: October 29, 2013, 12:14:19 PM »
Here is a page from the older manual. Maybe it will help.
An output is a PLC's way of getting its inputs to change.

rlp122

  • Sr. Member
  • ****
  • Posts: 58
Re: CTRIO count preload.
« Reply #4 on: October 30, 2013, 08:30:43 AM »
Sorry, I linked to the wrong chapter.  Here is the correct one.

Greg

  • HostTech
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 668
  • Why for you bury me in the cold, cold ground?
    • Host Engineering, Inc.
Re: CTRIO count preload.
« Reply #5 on: October 30, 2013, 04:14:52 PM »
Jackeroo31, you must use the WT instruction to write 8 bytes total to the CTRIO's Shared RAM starting at address 80 (hex).

The 8 bytes:
- 1st 2 bytes: 0004 (hex) "Write One Register"
- Next 2 bytes: [RegisterCode]:
     0000 = Ch1/Fn1
     0001 = Ch1/Fn2
     0002 = Ch2/Fn1
     0003 = Ch2/Fn2
     0004 = Output0
     0005 = Output1
     0006 = Output2
     0007 = Output3
     0008 = Ch1/Fn1 Reset
     0009 = Ch1/Fn2 Reset
     000A = Ch2/Fn1 Reset
     000B = Ch2/Fn2 Reset
- Next 4 bytes: [Data], i.e. the count value

So this amounts to something like:
LD K0104 (I think this is correct for Slot4 in DL06)
LD K8
LD K80
WT V4000 (or wherever you store the above 8 bytes)

Then you will Set the Process System Command bit and wait for the System Command Complete bit (for success) or the System Command Error bit (for failure).

There are two types of people in the world; those that can extrapolate from incomplete data sets.