counter ....how to program it?

panthripu

Member
Join Date
Mar 2004
Posts
228
Hi friends
I am planning to count the number of total steps of a machine moving between different location.For actual positon of the machine , i am getting BCD in my plc.Let us assume if the machine is at position #1 and i give command to go to position #4 , It goes there in steps i.e. goes to positon#2 and stops and moves and stops at position#3 and stops and then to position#4.So it moves 3 steps. Similarly if i give command now to location#2 , It moves to location#3 and stops and then moves and stops at location#2. So this time 2 steps.So totally till now 3+2 steps.
I can do it by taking feedback of forward or backward movement and count it directly but unfortulatily I need to lay cable for it.
I want to do it with positon feed back. Something as below
Read presnet position
Read new positon
Subtract new positon value from old
Stroe result at a memory location say MW100
similarly in next operation
and save result to previouly saved result at MW100
but this time we have to take care as when i move from lower location to higher location , after subtraction i get answer in negative whereas i need it in positive so i need to make it positive.
I am trying it in diffent ways but suggestion from you guys are highly appriciated.
 
It seems like the positive/neagative part is what is messing things up.

I would compare the present and new positions first.

So if present position is smaller then new position you calculate (new - present).
If present position is larger then new position you calculate (present - new).
 

Similar Topics

Hello all, new on here, and relatively new to plc programming. I am trying to write a program which counts as it receives a cycle end input, and...
Replies
4
Views
1,887
Using a sensor and one counter (preset of 6) I want count 6 bottles then energize a output. The counter then resets to 0 When the second count of...
Replies
9
Views
2,612
HI i newbies. i want make a simple program in cx- programming.. i have 4 sensor(detect the box). how to count the boxes that have presents..if...
Replies
9
Views
2,472
Hi I need a sample program to use 1769-HSC High speed counter module to measure the pulses of an encoder (connected with HSC) over a specified...
Replies
6
Views
11,942
Good day to all, Right now, i try make improvement to add one external length counter to my machine. I want when the machine running in Manual...
Replies
1
Views
2,052
Back
Top Bottom