PART COUNTER

1. ## PART COUNTER

I have a Okuma LB 12 with OSP 500-LG controls, I running the loop program with this,

N11 V01=1
N112 V01=V01+1

( PROGRAM )

/ IF [ V1 LE ? ] N112
M2

( ? number of parts )

But for the life of me I cant figure out where the part counter is, and if I interupt the loop by reseting the count starts over.
Does any one know how to bring up the counter, and keep the count the same even after reseting.

2. Originally Posted by machinebob1
I have a Okuma LB 12 with OSP 500-LG controls, I running the loop program with this,

N11 V01=1
N112 V01=V01+1

( PROGRAM )

/ IF [ V1 LE ? ] N112
M2

( ? number of parts )

But for the life of me I cant figure out where the part counter is, and if I interupt the loop by reseting the count starts over.
Does any one know how to bring up the counter, and keep the count the same even after reseting.
Why don't you use parts count page in the parameter section?

3. ## Re: PART COUNTER

hello bob i will begin with the code that you shared

it is messy ... i have written a few tips below + some explanations

Code:
```

( original )

N11 V01=1
N112 V01=V01+1

( PROGRAM )

/ IF [ V1 LE ? ] N112
M2

( ? number of parts )

( . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . )

( removing not needed addresses )
( initalizing counter with ZERO instead of ONE )
( replacing V1 with V01; because god of simetry )
( removing bottom comment; way too obvious )
(using leading zeros from time to time, means that the mind loses focus when is writing codes )
( is a simple task, so try to make it always the same )
( also, using leading zeros from time to time, affects code simetry; it can not be read fluidly )

V01 = 0
N000 V01 = V01+1

( PROGRAM )

/ IF [ V01 LE ? ] N000

M02 ( . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . )

( replacing ? with variable )
( spaces arround + )

V02 = 30
V01 = 0
N000 V01 = V01 + 1

( PROGRAM )

/ IF [ V01 LE V02 ] N000

M02 ( . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . )

( kitty default : 4 blanks for indentation )
( blank lines insert + '(*)' between V02 and the rest of the code )
( this is intended to separate editable variables from the rest of the code )

V02 = 30

( * )

V01 = 0
N000  V01 = V01 + 1

( PROGRAM )

/ IF [ V01 LE V02 ] N000

M02 ( . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . )

( using / only to toogle counter behaviour may affect other places where / would be required )
( i recomand avoiding / for looping )
( initialize V02 with 0 or 1 )

V02 = 0 or 1

( * )

V01 = 0
N000  V01 = V01 + 1

( PROGRAM )

IF [ V01 LE V02 ] N000

M02 ( . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . )

( is not ok to have the counting line near the begining of the program )
( move it near the end, so to count "executed parts", and not to count "begining of executing" )

V02 = 0 or 1

( * )

V01 = 0
N000 // program
V01 = V01 + 1
IF [ V01 LE V02 ] N000

M02 ( . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . )

( check also this equivalent sample, that does not use explicit conditional and counting codes )
( you achieve same result, with less code )
( you may also use *.sdf files )

CALL OSUB Q30

M02

OSUB

RTS ( . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . )

( if you wish to use /, so to toogle counting behaviour from cnc panel buttons, thus )
(without editing the code, pls consider that there are some methods )
( they work on newer osps, but maybe also on elder osps can be found some alternatives )
( however, toogling counting behaviour without editing the code seem a bit low-life )
( thus it seems to be an inappropriate solution, for a problem with unknown causes )```

4. ## Re: PART COUNTER

ok, i am done :
... in that new thread, you have general directions about counting parts
... in previous reply, you have samples about updating your code; pls check especially the one written with blue

But for the life of me I cant figure out where the part counter is
well, accordingly to your code, the counter is always increased before begining to cut

you can check it's value inside the parameter page; if it shows 17, it means that you have 16parts completed, and the 17th is being cut

if you don't have buff-prohibit codes, then is really hard to follow ... so be sure that the counting sequence is buffer-prohibited, thus the counter is not going way in front of the real situation

another way to deal with this, is to simply count the real parts; if this can not be done ( for example there are many parts being cut during a small period of time ), then you definetly need to buff-prohibit the counter

if I interupt the loop by reseting the count starts over
1) stop initalizing the counting inside your main program; do it in a different program ( solution 3 in here : https://www.cnczone.com/forums/okuma...ml#post2232934 ), or manually reset it inside the paramter page

2) tune your program ( solution 2 in here : https://www.cnczone.com/forums/okuma...ml#post2232934 )

3) some cnc's have a default counter; if it is there, try to use it; i never use it, because it will lead to downtime for me; i invest time in codes, so to make life easier on the long-run

Does any one know how to bring up the counter, and keep the count the same even after reseting
buff-prohibit proof counting; i also recomand you to move V1=V1+1 near the end of the program, so to count finished parts / kindly

ps : always listen to kurmay

5. ## Re: PART COUNTER

Thank you, very much

6. ## Re: PART COUNTER

okey, i hope you find something usefull

if you have questions, pls feel free to ask

when i replied to you, my mind was pretty clear ( i guess ), and in such moments i share many details

i use counters in many situations, for example, on some setups :
... only by zeroing the face, thus based on program zero value, it is decided to how many parts can be cut without opening the chuck
... based on counter value, when at least 2 parts are machined without opening the chuck, some operations may be skipped, for example like runing the puller code only when last part was cut
... if the face of the material is tilted too much, the operator may choose to execute 1, or 2, or more extra face cuts, only with a single keystroke, and a counter inside the program is initialized in this manner, so to execute a number of cuts accordingly to operator's choice( it is a fast way to deal with a common aspect, that involves extra-clearances, so to limit the number of face cuts, in order to avoid hitting the chuck when machining the main part )
... etc etc / kindly

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•