Modifying Preset Value of High Speed Counter

I appreciate everyone's help...but i'm struggling

Here's what i need to accomplish in layman's terms:

When DCNT reaches 746 pulses, Y0 output triggered.
After Y0 is triggered, i need to change DCNT Preset Value to 32 pulses.
When DCNT reaches 32 pulses, Y0 triggered again.
After Y0 is triggered, i need to change DCNT Preset Value to 64
When DNCT reaches 64 pulses, Y0 triggered again.
After Y0 is triggered, i need to change DCNT Preset Value to 32 pulses.
When DCNT reaches 32 pulses, Y0 triggered again.


I'm trying to accomplish this with MOV (or DMOV) but i can't seem to get my logic right.

I don't know how to prevent the MOV of 64 to 32 until the Y0 has been fired at 32 pulses.
 
I appreciate everyone's help...but i'm struggling

Here's what i need to accomplish in layman's terms:

When DCNT reaches 746 pulses, Y0 output triggered.
After Y0 is triggered, i need to change DCNT Preset Value to 32 pulses.
When DCNT reaches 32 pulses, Y0 triggered again.
After Y0 is triggered, i need to change DCNT Preset Value to 64
When DNCT reaches 64 pulses, Y0 triggered again.
After Y0 is triggered, i need to change DCNT Preset Value to 32 pulses.
When DCNT reaches 32 pulses, Y0 triggered again.

I'm trying to accomplish this with MOV (or DMOV) but i can't seem to get my logic right.

I don't know how to prevent the MOV of 64 to 32 until the Y0 has been fired at 32 pulses.
I said before that it will be easier (to me) by accumulating pulses.(advantage here is that you keep track of all pulses)
When 700 pulses, Y0 is on
When 700 + 32 pulses= 732 pulses , second action.
When 700 + 32 + xx = xxx pulses, third action.
You only have to reset the accumulator once and you choose when.
 
I said before that it will be easier (to me) by accumulating pulses.(advantage here is that you keep track of all pulses)
When 700 pulses, Y0 is on
When 700 + 32 pulses= 732 pulses , second action.
When 700 + 32 + xx = xxx pulses, third action.
You only have to reset the accumulator once and you choose when.

I really like the idea, but i don't know how to implement it. i was under the impression i could only use the DCNT C235 "value" command once in each program.

Can i do something like:
DCNT C235 700 pulses. trigger Y0. then
DCNT C235 732 pulses. trigger Y0. then
DCNT C235 796 pulses. trigger Y0. then
etc.

i just don't know what the code would look like for accumulating pulses.
 
I really like the idea, but i don't know how to implement it. i was under the impression i could only use the DCNT C235 "value" command once in each program.

Can i do something like:
DCNT C235 700 pulses. trigger Y0. then
DCNT C235 732 pulses. trigger Y0. then
DCNT C235 796 pulses. trigger Y0. then
etc.

i just don't know what the code would look like for accumulating pulses.
You can definetely do what you described

When HSC acc=700 trigger Y0
When HSC acc=732 trigger Y1
When HSC acc=750 trigger Y2
and on.

Use "Comparators" I'm sure your PLC has a set of instructions for you
Something similar to (=, equal) (>= Greater or equal) (<=, Les or equal) and such.
 
I really like the idea, but i don't know how to implement it. i was under the impression i could only use the DCNT C235 "value" command once in each program.

I could be wrong but it looks like you can use c235,c236,c237,c241,c242,c244 as separate counters but the problem is that some of the inputs are set and reset inputs. The bottom line is that only four high speed software interrupt counters can be used in your application, and you need five. See high speed counter matrix below

countermatrix.jpg

Wait I just noticed that you only have three lengths. You should be able to double up on the 2" and the 4" settings. Then you would still have one extra high speed counter if one of the lengths should change.

There might also be another option. It looks like there is a pointer set option for the hardware high speed counters. I did not spend too much time researching this.


You can definetely do what you described

When HSC acc=700 trigger Y0
When HSC acc=732 trigger Y1
When HSC acc=750 trigger Y2
and on.

Use "Comparators" I'm sure your PLC has a set of instructions for you
Something similar to (=, equal) (>= Greater or equal) (<=, Les or equal) and such.

bkottaras,

It looks like his PLC does not have access to the high speed counter accumulator. See chart below

acc.jpg
 
I could be wrong but it looks like you can use c235,c236,c237,c241,c242,c244 as separate counters but the problem is that some of the inputs are set and reset inputs. The bottom line is that only four high speed software interrupt counters can be used in your application, and you need five. See high speed counter matrix below

Vaughn, correct. what i don't understand is if i have 1 encoder on my machine that is going to input X0 would i need additional encoders for each counter?

It looks like his PLC does not have access to the high speed counter accumulator. See chart below

i'm glad you found this because i was driving myself crazy trying to figure out how to use an accumulator.

i'm struggling coming up with the logic using the MOV function that will only move it after each sequence has been triggered.
 
I think i found the solution...it uses the accumulating pulses idea

The DHSCS instruction evaluates the DCNT instruction every time it receives a pulse. when the DCNT value is reached a command is triggered. here's an example:

sequence 1
-----DCNT C235 D408
sequence 2
-----DHSCS D410 C235 M1
sequence 3
-----DHSCS D412 C235 M2
sequence 4
-----DHSCS D414 C235 M3
etc...

In sequence 2, when C235 equals the number of pulses in D10 M1 is triggered.

In sequence 3, when C235 equals the number of pulses in D12 M2 is triggered.

my initial results are promising! i'll keep you posted.
 
Vaughn, correct. what i don't understand is if i have 1 encoder on my machine that is going to input X0 would i need additional encoders for each counter?

I think you can tie X0,X1,X2,X3 together to your encoder output. Thats how I'm interpreting the chart I posted above

So X0 is the input for C235
X1 is the input for C236 etcetera, etcetera.

If you look at the chart you will also see the "R" and "S" under C241, C242, and C244 those are resets and sets for those counters. Thats why you cannot use them.


i'm struggling coming up with the logic using the MOV function that will only move it after each sequence has been triggered.

Well! we better solve that because your process demands
something like this to function.

Earlier you had listed the sequences I think this is it:

When DCNT reaches 746 pulses, Y0 output triggered.
After Y0 is triggered, i need to change DCNT Preset Value to 32 pulses.
When DCNT reaches 32 pulses, Y0 triggered again.
After Y0 is triggered, i need to change DCNT Preset Value to 64
When DNCT reaches 64 pulses, Y0 triggered again.
After Y0 is triggered, i need to change DCNT Preset Value to 32 pulses.
When DCNT reaches 32 pulses, Y0 triggered again.

This is where I have a problem. I'm thinking that your machine needs to do something when the arm is stopped. Otherwise to the casual observer the arm would slow down then accelerate. There would not be a stop that was visible to the naked eye. Reply back with what you need and I'm sure someone will help you. The key word is help, we won't do it for you.

Now for some warnings:

I'm concerned about The PLC hardware that you have. The best motion scheme is the one that bkottaras mentioned. Plus he also agreed with me on the A B 2phase encoder thing. Sometimes we call this quadrature counting. What this does is use two pulses that are out of phase and overlapping with each other. See chart below

quad.jpg


When the PLC counts in this manner, it can tell which direction the arm is moving or even if it's moving at all. One problem with using just one of the channels from the encoder is when the arm is stopped sometimes vibration from the machine can make the encoder rock back and forth . When the encoder sees the pulses it counts them as movement (which ever way your counter is counting). Quadrature counting does not have this problem. I'm not suggesting that you change, but if you see errors this would be one place to look.

One of the reasons bkottaras's method is better is the counter is always engaged and you do not pile errors on top of each other. Without having access to the accumulator you have to reset the counter each time and the stopping and coasting of the arm errors just accumulate one on top of each other.



At this point I think you should try to get it to function without any changes. If that doesn't work try (Quadrature).

End of opinion.

Don't forget to reply back on your sequencing.
 
I can't stress enough how much help everyone has been. I greatly appreciate it.

So far, the DHSCS is working. at this point my error isn't great enough that it is worth changing to the quadrature counting. but i will definitely keep it in mind if things change.

i've only been exposed to PLC programming for about 1 week now so everything is very new to me. so any advice i get is appreciated!

This is where I have a problem. I'm thinking that your machine needs to do something when the arm is stopped. Otherwise to the casual observer the arm would slow down then accelerate. There would not be a stop that was visible to the naked eye. Reply back with what you need and I'm sure someone will help you. The key word is help, we won't do it for you.
there is actually a whole sequence of events that happens when the arm stops. this "action" in between arm movements takes approx. 2 seconds to complete. that all works perfectly.

here's what has to happen:

Sequence 1 action at 700 pulses (24")
Sequence 2 action at 750 pulses (26")
Sequence 3 action at 850 pulses (30")
Sequence 4 action at 900 pulses (32")
Sequence 5 action at 1000 pulses (36") then repeat seq 2
----------------------------------------
Sequence 2 action at 1050 pulses (38")
Sequence 3 action at 1150 pulses (42")
Sequence 4 action at 1200 pulses (44")
Sequence 5 action at 1300 pulses (48") then repeat seq 2
----------------------------------------
Sequence 2 action at...

so basically, what i need the program to do is add the difference between seq 5 pulses and seq 2 pulses (250 pulses) to each sequence's D register once sequence 5 is completed.

i already have code that only lets sequence 1 perform once and then repeats sequence 2 after sequence 5 is complete. this happens until the arm hits the "end of the line" limit switch.

where i seem to be stuck now is in succesfully changing the D registers to their new values once sequence 5 is complete. i'm using the ADD, MOV, and SUB functions but not getting the results i need. alas i'm back to the forum searching for answers.
 
where i seem to be stuck now is in succesfully changing the D registers to their new values once sequence 5 is complete. i'm using the ADD, MOV, and SUB functions but not getting the results i need. alas i'm back to the forum searching for answers.

Are you saying you cannot get back to the start of sequence 1?
 
Are you saying you cannot get back to the start of sequence 1?

yes, that was the problem that i was running into. but i think it just was my inexperience showing. after a very late night last night i finally got the program working as intended.

at the start of the first seqeunce it it moves the 5 D register values to 5 D register "temp locations". it also subtracts the 5th D register value from the 1st D register value and stores that in another D register. we'll call that the "variance register".

after the first five sequences are complete, the "variance" register gets added to sequence 2-5's D registers. this gives me the same spacing as the first sequence (alternating every 2" & 4"). this process repeats until the arm reaches the "end of the line" limit.

when the arm reaches the end of the line, or the machine is "homed" i move the values in the "temp locations" back to the original D registers so the cycle can repeat.

i'm sure there are easier ways to accomplish what i did but i did my best (with one week of plc programming experience)!

i can't thank everyone hear enough for their help. thank you!
 
wakeet,

You may not have this problem (now), but documentation is very important, be sure to add rung comments and I/O descriptions. I cannot tell you how hard it is to figure out what you have done after you finish and come back later.
 
trust me, i know! i can't remember what i had for breakfast let alone a program i wrote 6 months ago...

that's my goal for today. thanks, again.
 
if you have series of steps that repeat over and over, the simplest solution is to use sequencer. i normally use counter based one because it is dead simple and works on any plc. there is sample plc program for imaginary pick and place machine (check download section on www.mrplc.com). it was something like:
- move to pick pos
- wait for part
- open gripper
- gripper down
- close gripper
- gripper up
- move to place pos
- gripper down
- open gripper
- lift gripper
- cycle complete, reset sequence and start from begin

you can apply same sequencing logic to move arm:
- wait for start command
- action 1 init - reset HSC and set preset to 24"
- action 1 execute - move arm to position
- action 2 init - reset HSC and set preset to 26"
- action 2 execute - move arm to position
- action 3 init - reset HSC and set preset to 30"
- action 3 execute - move arm to position
- action 4 init - reset HSC and set preset to 32"
- action 4 execute - move arm to position
- action 5 init - reset HSC and set preset to 36"
- action 5 execute - move arm to position
- jump to step 3 (action 2 init)
 

Similar Topics

Hi, Our customer has a MLX 1500 at site, there are some timers need to be modify. Around 40 timers preset value. If not mistaken DAT cannot...
Replies
0
Views
2,293
So i've been at this for a long while, i have Citect Scada 2018, i have full access to everything but i can't seem to find any option or...
Replies
0
Views
67
Hi there! I got a HMI terminal Panelview Plus 7 (PN-332439 / CAT 2711P-T12W21D8S) which work on a APP 8.00 i'm trying to modify with my FT View...
Replies
9
Views
711
Hey all, I have been trying to update the transfer lists on a pair of redundant CPE330s that are currently out running in the field. According...
Replies
1
Views
773
Scenario: 1. An employer has a machine that isn't up to code/standards: hydrogen gas torch systems without safety shutoff valves, industrial...
Replies
54
Views
8,965
Back
Top Bottom