Modifying Preset Value of High Speed Counter

wakeet

Member
Join Date
Apr 2009
Location
ohio
Posts
20
Hello All,

i'm a total newb to PLC programming so any help is appreciated.

I have an encoder mounted to a motor shaft. the encoder is used to measure the distance traveled of an arm that is being pulled by the motor.

the arm has to move 24", then 2", then 4", then 2", then 4", then repeat...

the original programmer wrote the program using software counters of the Delta SS PLC. it became apparent that the software counters weren't accurate enough for our application. i rewrote the 24" sequence of the program to utilize the built in high speed counter of the PLC. this solved the problem.

So here's my question...

I need to rewrite the program to utilize the high speed counter for each sequence. any suggestions on how i can accomplish this?

i assumed i could write some sort of logic that would change the preset value of the HSC after each successful sequence but i'm not quite sure how to do that.

i'm open to ideas! Thank you!
 
wakeet,

I do not know how much help I will be. But I have some questions.
on your high speed counter. Are you using an A B two phase counter? Or other? Are you using the Z pulse? In the other thread you mentioned that the original programmer was "out of town" or something like that. You were able to configure the counter to a high speed one from a conventional counter. What did the original programmer have in place to change the presets?
 
this looks very much like Mitsubishi FX series PLC.

you should be able to use data register for preset, for example instead of:

out C235 k50

use register pair like D10/D11

out C235 D10

then you can simply put value into D10/D11 (or whatever).
 
Are you using an A B two phase counter? Or other? Are you using the Z pulse?

I'm actually using the 1 phase, 1 input counter. Encoder is on input X0 using C235.

In the other thread you mentioned that the original programmer was "out of town" or something like that. You were able to configure the counter to a high speed one from a conventional counter. What did the original programmer have in place to change the presets?

The original programmer had 5 sequences stacked on each other. each sequence used a different software counter. each counter was getting the preset value from a data register. these values are being input from a HMI. i only modified the first sequence to use the high speed counter.

Sequence 1
24" C235 D408
Sequence 2
2" C112 D409
Sequence 3
4" C113 D411
Sequence 4
2" C114 D412
Sequence 5
4" C115 D413

(the entire sequence would then repeat until the machine hit the end of line limit.)

If i understand correctly, C235 is the only counter linked to input X0. I only have 1 encoder. i can't create other HSC (i.e. C236, C237, etc) so, i was thinking i could change the preset value after the HSC reaches the count (24"), triggers the next action, then resets the HSC and counts to the next count (2")
 
this looks very much like Mitsubishi FX series PLC.

you should be able to use data register for preset, for example instead of:

out C235 k50

use register pair like D10/D11

out C235 D10

then you can simply put value into D10/D11 (or whatever).
The current program is configured to use a single data register. though, after each count is reached, i need to change the count to a different data register (or change the value of the current data register)

first time through the program, C235 needs to use D10 = 24". second time through the program C235 needs to use D11 = 2".

is their a way to swap values between data registers?
 
The current program is configured to use a single data register. though, after each count is reached, i need to change the count to a different data register (or change the value of the current data register)

first time through the program, C235 needs to use D10 = 24". second time through the program C235 needs to use D11 = 2".

is their a way to swap values between data registers?
Why don't you scale your encoder pulses to a known disstance.
Use only one data register that accumulates pulses/distance.
Use compares and when it reaches the first set point do action.
Continue on to the second set point and do action and on and on.
When the sequence is done, return to home and then reset your encoder counter, reset the sequence and start from the top again.
 
I'm actually using the 1 phase, 1 input counter. Encoder is on input X0 using C235.

I'm certainly no expert with high speed counters. But if there is a possibility of the encoder "rolling" backwards then the 2 phase counter would keep better position.

counternumb.jpg


The original programmer had 5 sequences stacked on each other. each sequence used a different software counter. each counter was getting the preset value from a data register. these values are being input from a HMI.

Well that won't work as you already know!

Sequence 1
24" C235 D408
Sequence 2
2" C112 D409
Sequence 3
4" C113 D411
Sequence 4
2" C114 D412
Sequence 5
4" C115 D413

(the entire sequence would then repeat until the machine hit the end of line limit.)

deltasscounter.jpg

If I'm understanding Panic correctly, you would use a double register to load your preset.

changeregval.jpg
 
I'm certainly no expert with high speed counters. But if there is a possibility of the encoder "rolling" backwards then the 2 phase counter would keep better position.

Absolutely!!
A pulse is a pulse when counting single pulses so a pulse will increment the HSC if it is set up for up count and the other way around for down count.
2 channels are much better since they work in an up/down manner and don't mess up your count.
 
Thanks everyone! The DMOV looks like it will accomplish exactly what i'm looking for.

Although i have one question? what exactly is a double register and why would i need it?

as it stands with my current configuration, the user inputs a pulse count into the HMI. (i.e. 740 pulses = 24") how will a double register change this?
 
I was looking through your manual and the
Sequential Function Chart
function on page 171 of the manual
may help you for going from one step to the other

 
D registers are 16-bit. high speed counters C235 and higher are 32-bit (at least on FX, didn't check Delta, but should be the same).
in order to get 32-bit with D, one has to use pair of registers. this is normally specified by instruction where mnemonic is prefixed with "D" to indicate "double".
for example 16 bit instructions are MOV, ADD, SUB, INC etc.
their 32-bit equivalent are DMOV, DADD, DSUB, DINC etc.
 
D registers are 16-bit. high speed counters C235 and higher are 32-bit (at least on FX, didn't check Delta, but should be the same).
in order to get 32-bit with D, one has to use pair of registers. this is normally specified by instruction where mnemonic is prefixed with "D" to indicate "double".
for example 16 bit instructions are MOV, ADD, SUB, INC etc.
their 32-bit equivalent are DMOV, DADD, DSUB, DINC etc.

I've been using a standard 16 bit register for my value. if my value is less than 32,767 i was under the impression that the 16 bit register would be fine, even for a 32 bit C235 counter. (the highest value i store is currently 746 so i have plenty of room to go up)

Am i doing it incorrectly?

From the Manual
data register is for storing a 16-bit datum of values between -32,768 to +32,767. The highest bit is “+” or “-"
sign. Two 16-bit registers can be combined into a 32-bit register (D + 1; D of smaller No. is for lower 16 bits). The
highest b it is “+” or “-” sign and it can store a 32-bit datum of values between -2,147,483,648 to +2,147,483,647.
 
Am i doing it incorrectly?

It all depends. What if the machine runs so good you never have to make any changes. As a result you forget everything you did to get it to work. And then..... Something like an encoder change and or product change requires you to use a double register? Now you can't figure out what to do. By the way, good documentation and rung comments can minimize this.

Or.... You are on vacation and they have a problem with the machine. Your boss calls in an outside programmer (who is looking for new accounts). He points out that some numskull of a programmer didn't use a double register to load the double counter. Never mind that the problem was a bad prox switch.
 

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,291
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
682
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
764
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,917
I am new to Siemens world and need some help. There is existing program and I need to modify Function Block, add some inputs. I am offline. I...
Replies
6
Views
1,945
Back
Top Bottom