Help! Line Code Encoder Problem

pschffr

Member
Join Date
Dec 2003
Location
North Carolina
Posts
6
Have an encoder, pulses dedicated to one register, operations are indexed from the front as well as the rear (length of workpiece varies). However I need to make these operations independent but still use the incrementing pulses in the HSC (high speed counter) register. I have to pass the incremented data on, but still keep count of the workpiece position. I don't want to wait for a workpiece 75 mm long to go 13 meters before I can reset the counter???
 
Once again I am confused

A encoder provides pulses that can be used for speed or measurement applications, this I understand.

The encoder input can be analog, HSC, gray, devicenet/can...etc the list goes on.

Its standard to have the encoder input in a register...register meaning a plc word (or double word) type data file.

In this case it seems the encoder is using a HSC which in turn uses a specific register.

This is the point I am lost at! You want to KNOW the position/length of the product? You also want to use the incremental count/position to pass on to a HMI/SCADA/data collection system.

I dont know that I fully understand the problem BUT lets assume some things...lets use your example of a 75 mm product with a capability of measuring 13 meters before the counter resets, that means that you should be able to track 173 items using some form of indexing, even then it may be possible to "turn over" the values to maintain tracking.

Using what Peter said..never reset the counter, then using compare, indexing etc it should be possible to track maintain the incremental values and position for up to 173 items...unless my math is incorrect.
OR
I totally misunderstood what you are attempting to do.

NOTE: I have no idea how at this point this would be done but I know just enough to assume it can be done with effort. Technically I would like to be in a position to do something along those lines.
 
Response to Peter - Rsdoran

Peter.... No problem not resetting the counter.

Rsdoran.... Your assumption is correct.

The workpiece (75 mm, is the minimum length allowed, mechanically restricted, 4300 mm is the maximum length allowed) travels along a belt (PS) proximity switch, 0 mm, is activated, I know at this point I need to begin storing the pulses (which are 1 mm) from the dedicated HSC register (Reg 1).

My problem is that I need help help with the logic, math instructions, in my limited thinking?, I'm having problems thinking of how to pass the data to other registers. I need to be able to send another piece through the machine after function 6, the program as it is now will not allow the functions to accept another piece until the last function is completed.

Operations from the front of the workpiece,
0 mm (Function 2, Output 27 On)
445 mm (Function 1, Output 41 On)
485 mm (Function 1, Output 41 Off)
1325 mm (Function 2, Output 27 Off)
2050 mm (Function 3, Output 29 On)
2150 mm (Function 3, Output 30 On, Output 29 Off)
2450 mm (Function 4, Output 32 On)
2550 mm (Function 4, Output 33 On, Output 32 Off)
3150 mm (Function 5, Output 38 On)

Operations from the rear of the workpiece,
330 mm (Function 6, Output 40 On, Off by Limit Switch)
1150 mm (Function 7, Output 28 On, Off by Limit Switch)
2250 mm (Function 3, Output 30 Off)
2735 mm (Function 4, Output 33 Off)
3700 mm (Function 5, Output 38 Off)

Does this help explain my problem?
 
FIFOs

A simple way to do this is to use FIFOs. I would use two sets of FIFOs, one set of FIFOs for the leading edge and the other for the trailing edge. Lets just talk about the leading edge example.

A widget would be represented by a count that was read when the leading edge was detected. You would need to immediately execute Function 2, Output 27 on and queue the count in the FIFO for function 1, output 41 on.

The widget that is first in line in the FIFO for function 1, output 41 on needs to be checked to see if it has gone 445mm. This is done by subtracting the saved count from the current counter value. If it is greater than 445 then function 1, output 41 on is executed and the widget in now put in the FIFO for function 1, output 41 off.


Each event has a FIFO. Each widget has an initial count that is put in a FIFO ( queue ) where it waits to be first in line. Only the first in line needs to be checked for whether it has gone the distance. When it has, the FIFO action is executed and the widget count is moved to the next FIFO ( queue).

Think of an airport. :(

Things can get trickier if checking the queues must be done faster than scan times. In this case you will need to use interrupts and one will need to calculate which queue will need servicing next and use the distance it must go to set the high speed counter to generate an interrupt when system has moved that distance.

Oh, the trailing edge works like the leading edge and each FIFO must be large enough to save the maximum number parts while waiting for an action.

Have fun.

I would use link lists and the interrupt technique myself. That way I can save memory and more precisely activate the actions.
 
Last edited:
FIFO

I was pretty sure that this was the way it should be done (FIFO). As I have no one in this area with this kind of programming experience, referred to as line code (slang), to get feedback from. (Thanks for these forums and all the profressionals that support them.)

I can now move on to writing the logic. Which is still going to be a challenge, but none the less fun.

Thank you Peter and Rsdoran....

I will keep this thread open, as I think I'll need more help.

Thanks Phil Schaeffer.
 

Similar Topics

Hello everyone, I'm having trouble selecting the right circuit breakers for the "line side" of my VFD. The common advice is to check the...
Replies
21
Views
1,226
Hello everyone. Is the PLC CJ1M CPU13 capable of online editing? Or only downloads that will stop the PLC? Thank you.
Replies
3
Views
327
Hi I have a machine that has 1500 cpu program is v15:1 I have the program from the Oem and the tia portal software v15.1 ? I have set the laptop...
Replies
2
Views
1,854
Hello Everyone, I'm a pretty green PLC tech and I need help logging on to some SLC 5/04 PLCs. I have a 1747-UIC and 1747-CP3 cables and I'm using...
Replies
16
Views
6,922
Currently my company has a MT metal detector model V4 that has been down for the better part of a month. The metal detector is giving a F06-5 IO...
Replies
8
Views
2,983
Back
Top Bottom