Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

MACRO COUNTER HELP


Recommended Posts

I'm trying to make a macro counter that will count parts using #100 between 06.00 in the morning and 18.00 in the evening and #101 for counting nightshift parts between 18.01pm and 05.59am.

think I have the dayshift sorted but getting hung up on the nightshift counter!!

 

O7999(COUNTER)

(#3012 SYSTEM CLOCK)

N100
IF[[#3012GT060000]AND[#3012LT180000]]THENGOTO3
 
IF[[#3012LT060000]AND[#3012GT180000]]THENGOTO4
N200
 
N1
IF[#3012LT055959]GOTO4
 
N2
IF[#3012LT180000]GOTO3
 
GOTO300
 
N3
#100=#100+1(DAY COUNTER)
 
GOTO300
 
N4
#101=#101+1(NIGHT COUNTER)
 
N300
M99
 

 

can anybody see where I'm going wrong or even point me in the right direction

TIA

Link to comment
Share on other sites

I've made counters like this in Siemens before but never in Fuhnook.

 

In Siemens I always had to asign the system variable for the clock to another variable to use it.

 

So try #103=#3012 and then use #103 in your evaluation.

 

Also, in my Fuhnookish experience you don't want to use #100's. Every machine I've had my hands on used that range for Renishaw or system macros. Start at #500 and go up.

  • Like 2
Link to comment
Share on other sites

jlw is right about using variables in the #100 range. You need to be careful which ones you use. Sometimes it is useful to check the macro variables prior to using a new program. If you didn't put the value in it then it is likely that variable is used by a canned cycle.

 

The variables in the #500+ range are better suited to your application (persistent part count across shifts) since they will survive a power cycle.

 

I don't see a path to N1 or N2 in your program. What are they for?

 

Can you describe the problem with the night shift counter?

Custom-Macro-Quick-Reference-1.pdf

  • Like 1
Link to comment
Share on other sites

 

So try #103=#3012 and then use #103 in your evaluation

 

This is what I figured, referencing something that is changing every second wont help!

 

The variables in the #500+ range are better suited to your application (persistent part count across shifts) since they will survive a power cycle.

 

I don't see a path to N1 or N2 in your program. What are they for?

 

 

 

The #500 are better, just got to work out which ones the Renishaw probe are not using. The N1and N2 were from earlier attempts.

 

Now have it working, with a few extra bits that should store the previous shifts count in another variable and reset the new shifts count.

 

 

%

O9007(COUNTER)

 

#105=#3012

#106=#3011

 

N100

IF[[#105GT060000]AND[#105LT180000]]THENGOTO3

 

IF[#105LT055959]GOTO4

 

IF[#105GT180000]GOTO4

 

GOTO300

 

N3

#100=#100+1(DAY COUNTER)

 

IF[#101EQ0.0]GOTO6

#103=#101

#101=0.0

 

N6

 

GOTO300

 

N4

#101=#101+1(NIGHT COUNTER)

IF[#100EQ0.0]GOTO7

#102=#100

#100=0.0

 

N7

N300

M30

%

 

I have also added this to the M30 call set in the M/c parameters, i.e M30 will call and run this protected sub and then end and rewind after it is read.

  • Like 1
Link to comment
Share on other sites

I see you got it working by splitting your night shift test

        IF[#105LT055959]GOTO4
 
        IF[#105GT180000]GOTO4

 

I noticed on your original code, you have an "AND" where there should be an "OR" (Not sure if you can use OR in these macros, I am new to this)

But you can not be LT 0600 and GT 1800 at the same time.....

         IF[[#3012LT060000]AND[#3012GT180000]]THENGOTO4

 

If you can combine this back together, might save the machine some processing steps.

  • Like 2
Link to comment
Share on other sites
At home so I haven't tested this but I think it will work.

 



%
O9007(COUNTER)

#105=#3012
#106=#3011

(DAY SHIFT
IF[[#105GT060000]AND[#105LT180000]] THEN #100=#100+1(DAY COUNTER)
IF[#101NE0.0] THEN #103=#101
IF[#101NE0.0] THEN #101=0.0

(NIGHT SHIFT
IF[[#105LT055959]OR[#105GT180000]] THEN #101=#101+1(NIGHT COUNTER)
IF[#100NE0.0] THEN #102=#100
IF[#100NE0.0] THEN #100=0.0
M30
%

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...