Part size tracking!

leperking1

Member
Join Date
Jan 2004
Location
mich.
Posts
25
I currently have a job were I have to keep track of measured parts during a eight hour shift. We are currently using a A/B 5/04 and using a floating point instruction to determine whether the parts are good or bad.

My question is how would I keep track of each part size in the PLC during a eight hour shift that produces 1000 plus parts per shift . I thought of using FFL and FFU instructions but I Believe they only accept interger instructions. The numbers I get range from 58.08084 to 56.04578 and if I would choose to use a interger file and multiply 58.08084 by 10,000 I would get 5808084 and thats beyond the the intergers file setpoints.(-32768 to 32767)

Thank you for reading!!
 
Last edited:
You can always create your own FIFO using the floats. It will be slightly complicated as you will need more than 1 data file (each float file can only hold 256 numbers).

Indirect addressing does not let you cross file boundaries. In the instruction manual, it says you can span files with indexed addressing but I don't know if you can span multiple files.

If you want to tackle this there are many fifo threads here. Just search on FIFO
 
To what precision in measurement to you actually need to record?

I'm not sure I'm getting your goal correctly, but lets say you need 1000 differences in measurements to be recorded, if your lowest expected value is 56.xxxxx, then do something like:

SUB <SampleIn_as_Float> - 56, store in TEMP_FLOAT

MUL <TEMP_FLOAT> by 1000.0, Store in INDEX_INT

then just use INDEX_INT to add one to a register in a datafile...

IF INDEX_INT < 256 the ADD 1 #N10:[INDEX_INT] store to #N10:[INDEX_INT]

IF LIMIT_TEST INDEX_INT >255 and <512 then ADD 1 #N11:[INDEX_INT] store to #N11:[INDEX_INT]

bla bla.
 
If I understand correctly, you need to store ~1000 values. I believe FPs occupy two 16-bit words so, you'd need 2000 words of memory to store your file as floats.

As ndzied1 mentions, indexed addressing would be the ticket for this (IMHO). By selecting the 'cross file boundaries' option you can create a 'virtual' file larger than the SLC 255 word max. Let's use an integer file as an example to keep it simpler.

Since you need 1,000 values, allocate four consecutively numbered integer files, say N20 through N23. This will give us actually 1024 words to play with. If it were me, and the memory were available, I'd just go ahead and reserve five files to allow for future expansion.

Now, if the values don't need be in any particular order, you don't need a FIFO, all you need is a shift register to move all existing values up one slot to make room for the new one at the start of the file. Using the index register this is trivial.

POINT THE INDEX REGISTER TO THE LAST
WORD (word 999) MINUS ONE

This will be around N23:235


+-MOV---+
-| 998 |
| S:24 |
+-------+

COPY WORD N TO WORD N+1 USING THE INDEX REGISTER
AS A POINTER (# indicates indexed addressing)
THE LAST WORD IN THE FILE IS OVERWRITTEN

1 +-MOV-----+
--|LBL|----| #N20:0 |
| #N20:1 |
+---------+

DECREMENT THE INDEX REGISTER TO POINT
TO THE NEXT PAIR OF WORDS

+-SUB---+
-----------| S:24 |
| 1 |
| S:24 |
+-------+

AS LONG AS THE INDEX REGISTER IS POSITIVE,
GO BACK AND MOV MORE WORDS

SIGN FLAG
S:0/3 1
-----|/|----------(JMP)--

MOVE THE NEW VALUE INTO THE FILE
+-MOV----+
------| N7:0 |
| N20:0 |
+--------+


Note that the index register holds a signed value. Therefore, you can't have a virtual file larger than 32,767 without some complications.

Moving 999 floats will chew up some time. If this is a problem you'll need to work up a mechanism to spread the MOVs out over multiple scans.
 
I follow you guys but has anybody everdone this or am I alone here. Maybe if you descibed a method using floating point I wont be so lost.

Do you guys know if there is there a way to print this info, to cut dowm the shift of 1000 moves. I only need to do this for two weeks, testing new parts.
 
Last edited:
Maybe I'm missing something, but is there a reason you can't have your 4 or 5 float files with 256 values each, start your index "pointing" at element 0 in the first file, increment the index after each measurement, and when it gets to 256, reset it to 0 and start loading measurements into the next float file? No need to do all those moves which, as Doug pointed out, would start to get timely.

Again, maybe I missed something. I'll admit I don't work with floats too often. We're usually able to limit our applications to bits and integers.
 
I have created my own logger on SLC504 that was
storing/retrieving 1000 most recent records.
All records were stored on server but the requirement
was to keep 1000 last records on the machine and display
any of them on the PV900.
Since each record was combination of bits and
values, I had to pack them into couple of words
(four words if I remember correctly). As result one
record was stripped over few files.
I simply used indexed addressing. Crossing file
boundaries is easily done using compare or DCD function.
I used one index for writing and one for reading record
so that browsing records doesn't interfere with machine
operation. Does this help?
 
Use a ring buffer.
Commonly uses in serial communications.
Have two offsets- Call them HEAD and TAIL
HEAD is where you are going to store your next incoming value
TAIL is the last value you want to save
(In your case TAIL will be 1000 values behind HEAD)
You have to do several tests
1) Then TAIL reaches the end of available storage space, set it to the begining of the buffer
2) When HEAD reaches the end the storage space set it to the beginning of the buffer (0 offset)
3) Check that head does not overrun tail.
4) If you need to display values then start at HEAD and increment until you reach the end of the buffer, then start over at 0 and increment until you reach tail.

You will be overwriting the oldest value.

Indirect addressing (pointers) make this much easier, but not all PLC's do well with pointers

This is a bit of a trial in Ladder logic, but I have done it for boards in a long conveyor to keep track of the size at a given location and to determine when to kick the board into the correct bin.

If you can use fixed integer math, you will save cycle time.
I have to lay this out on paper to get all the conditions checked correctly.
 
Com options..........

What ports do you have available on the 5/04?
Do you have the 9 pin port available?
If you do you could configure it as rs232 and do a simple write of the info to the port....Use windows hyperterminal or some other com package like procomm on a pc to log the output...Nice because you can print it! If its a temporary install for debugging thats about all the stress I would donate to it.....
:)

Dave
 
What ports do you have available on the 5/04?
Do you have the 9 pin port available?
If you do you could configure it as rs232 and do a simple write of the info to the port....Use windows hyperterminal or some other com package like procomm on a pc to log the output...Nice because you can print it! If its a temporary install for debugging thats about all the stress I would donate to it.....

;)
Dave


I like this idea! yes we are currently using a A/B 5/04 that is using its RS 232 port going to a panel view 1000 which in turn gives me a spare RS 232 printer port to use. But im not familar with windows hyperterminal or procom, is this software free or do I have to buy it. Note, if the software is to expensive im back to were I started, due to money issues.

I also liked Doug-p idea but when I used the info he gave me I kept losing my my measurements at the end of the file. Maybe im missing somthing, but I was hoping to see somthing like BSl or Fifo which I belive moves one word at a time in sequence.

POINT THE INDEX REGISTER TO THE LAST
WORD (word 999) MINUS ONE
This will be around N23:235

+-MOV---+
-| 998 |
| S:24 |
+-------+

COPY WORD N TO WORD N+1 USING THE INDEX REGISTER
AS A POINTER (# indicates indexed addressing)
THE LAST WORD IN THE FILE IS OVERWRITTEN
1 +-MOV-----+
--|LBL|----| #N20:0 |
| #N20:1 |
+---------+

DECREMENT THE INDEX REGISTER TO POINT
TO THE NEXT PAIR OF WORDS
+-SUB---+
-----------| S:24 |
| 1 |
| S:24 |
+-------+

AS LONG AS THE INDEX REGISTER IS POSITIVE,
GO BACK AND MOV MORE WORDS
SIGN FLAG
S:0/3 1
-----|/|----------(JMP)--

MOVE THE NEW VALUE INTO THE FILE
+-MOV----+
------| N7:0 |
| N20:0 |
+--------+
Thank you all for helping.
 
Last edited:
leperking1 said:

I like this idea! yes we are currently using a A/B 5/04 that is using its RS 232 port going to a panel view 1000 which in turn gives me a spare RS 232 printer port to use. But im not familar with windows hyperterminal or procom, is this software free or do I have to buy it. Note, if the software is to expensive im back to were I started, due to money issues.
Hyperterminal info
leperking1 said:
I also liked Doug-p idea but when I used the info he gave me I kept losing my my measurements at the end of the file. Maybe im missing somthing, but I was hoping to see somthing like BSl or Fifo which I belive moves one word at a time in sequence.
A FIFO would work if you needed fewer than 254 values. Did the data go in at N20:0 and progress one word at a time through the file? If so, the logic is operating correctly. If this is true and data is being lost, then the file needs to be extended. In any case, you still need to get it to the outside world and so would need the RS-232 port solution suggested by Mtn_Bkng_Dave. I would concentrate on getting it out of the port and forget logging it internally.
 
hyperterminal

hyper terminal is available for free on the windows installation cd
under windows setup communication. Procomm you need to pay for.

however both programs uses telnet. as the interface.
 

Similar Topics

Hello, I am still new to PLC programming and I just got this job two year out of school so I don’t remember much. I was given a task were I have...
Replies
1
Views
167
Good morning crew! Ok my logic works but I am missing something. When the start button is pushed it should like the red light for 4sec then shut...
Replies
13
Views
419
Hello: I need to buy one end-cap which was not provided by an ex-Rockwell distributor here. Since I do not know the part number I can't find it...
Replies
24
Views
6,481
For a thermoset molder I am looking for a vision system that can monitor part removal from a mold. The mold temps can range anywhere from 300 to...
Replies
4
Views
1,653
Long story short, I am creating a display to display an array of Strings from PLC [topic]VarStrA_RPHD.Desc[VarStrB] totally 100 strings...
Replies
1
Views
1,403
Back
Top Bottom