![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| Fanuc Discuss Fanuc controllers here! |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
hey everyone i'm wondering if there is a way to detect the state of the opt-stop switch on the operator's panel on any fanucs... programmatically. system variable # by chance? that would be perfect i want to send out status changes via dprnt when opt stop is on, but igonore them when the M1 is ignored (ie opt stop off) thanks - gwarble |
|
#3
| ||||
| ||||
| You will need to tie the input for the switch to a variable via the PMC UI0000 = #1000 ~~~~ UI0031 = #1031 UO0000 = #1100 ~~~~ UO0031 = #1131 GL
__________________ *********************************************************** *~~Darwinian Man, though well-behaved, At best is only a monkey shaved!~~* *********************************************************** *__________If you feel inclined to pay for the support you receive__________* *_______Please give to charity http://www.oxfam.org/en/getinvolved_______* *********************************************************** |
|
#4
| ||||
| ||||
| I found a way to do that without editing ladder but it is a little bit strange. First i set a macro called by M01 (O9021) O9021 #3001=0 (RESET TIMER) M01 IF[#3001 LT 1000] GOTO 20 IF [#500 EQ 0] GOTO10 (DONT SEND IF THE STATE HAS NOT CHANGE) POPEN DPRNT[M01 ON] PCLOS #500=0 (RETAIN THE STATE OF THE SWITCH) N10 M99 N20 IF [#500 EQ 1] GOTO 30 (DONT SEND IF THE STATE HAS NOT CHANGE) POPEN DPRNT[M01 OFF] PCLOS #500=1 (RETAIN THE STATE OF THE SWITCH) N30 M99 The bad thing it is that you send the info only after cycle start is pressed after the M01. How it works: first a timer is set to 0 and begin do count(by milisecond increment) If M01 is deactivate, a small amount of time depending of the block processing time, will be ellapsed so you have to set the comparative value of the first IF higher than the processing time to jump a the right place. If M01 is activate, the timer will increase while the pause is active and when you will end the pause, the timer value will be higher than the comparative value, so you will know that M01 was active. I tested it on a 0-MD and it works fine. Let me know if you can do sometinhg with that |
|
#5
| ||||
| ||||
|
Wouldn't this cause a loop ? calling M01 inside the macro.
__________________ *********************************************************** *~~Darwinian Man, though well-behaved, At best is only a monkey shaved!~~* *********************************************************** *__________If you feel inclined to pay for the support you receive__________* *_______Please give to charity http://www.oxfam.org/en/getinvolved_______* *********************************************************** |
| Sponsored Links |
|
#6
| ||||
| ||||
| It won't cause a loop. When you use a M or G code inside a macro called by itself, it will be executed normally inside the macro. It allow to call macro with standard G or M code without loose the functionallity of this code. |
|
#7
| |||
| |||
| yup, samu's right... and if you need to call a macro from a macro you can use g65 p90xx if necessary i like your clever thinking finding a solution for this with the timer, samu... but like you pointed out you only know after the M1 the two methods i've tried (but don't like the extra step) is to define my own M1 as follows, which allows me to use #101 macro variable as a secondary opt-stop with "status" dprnts: Code: O9006(OPT STOP...) IF[#101EQ1]GOTO1111 M1 M99 N1111 POPEN DPRNT[//HOLD] PCLOS M0 POPEN DPRNT[//START] PCLOS M99 Code: O9006(OPT STOP...) /M1 /M99 POPEN DPRNT[//HOLD*M1] PCLOS M1 POPEN DPRNT[//START*M1] PCLOS M99 - gwarble |
|
#9
| |||
| |||
| so i know when a machine has stopped... really the computer software should handle it but its a work in progress... i don't want to DPRNT the M1 status... i want to send the "HOLD" string when the machine stops at the M1 and send the "START" string when the cycle start happens again, if the opt stop actually stops the program... and send nothing if M1 does nothing i want my log of statuses to look like this: status: time: Code: start 30sec hold 10sec start 30sec end Code: start 60sec end Code: start 30sec hold 0sec start 30sec end my first example, pretend variable #101 is another opt-stop button... and it works like i want opt-stop to thanks - gwarble |
|
#10
| ||||
| ||||
| I wrote a set of macro that do exactly wath i think you want. It is the macro itself that calculate time ellapsed and send it with the appropriate string (start, hold, end) I don't have time to post it right now but tomorow i will show you. Maybe it could be interesting to add time between cycle(part changing time) |
| Sponsored Links |
|
#12
| ||||
| ||||
| I hope that i will be clear enough and you'll take time to understand it.English is not my first language, so some explanation could appear nebulous. Have Fun![]() effectively, the machine won't know ahead for M1, but once the pause is finish, it send the duration of the pause and the time ellapsed before the pause. I keep the same concept to detect M01. At the begining of the main program i store the current time of day(system variable #3012) in a common variable via a macro that translate it into second for easy calculation. Instead of M01 i call the detection macro. At the first line of detection macro, i store again the current time of day in another common variable.If M01 is not detected, i go back to the main program.If M01 is detected, once the pause is finished i store again (always via a macro) the current time of day and call another macro to do the calculation of the duration of each segment(Time ellapsed from start to pause and pause duration) and DPRNT this info before go back to main program. At the end of the main program, once again, i store the current time of day and call a macro to to de calculation and send the right info. Here is the code: O1234 (Main program) M64 B101(SAVE CURRENT TIME OF DAY in #101 once it is translated in second) G04 X2.0 M98 P9021 (M01 WITH DETECTION) G04 X2.0 M64 B104 (SAVE CURRENT TIME OF DAY IN #104) IF[#110 EQ1] GOTO 10 (IF M01 WAS ACTIVE) G65 P9022 A#104 B#101 C1.0 (CALCULATE DURATION OF WHOLE PROGRAM C=0 FOR HOLD TIME, C=1 FOR START TIME) GOTO 15 N10 G65 P9022 A#104 B#103 C1.0 (CALCULATE DURATION AFTER PAUSE) N15 POPEN DPRNT[END] PCLOS M30 O9021 (M01 DETECTION) #3001=0 (RESET TIMER) M64 B102 (STORE TIME OF DAY IN #102) M01 IF[#3001 LT 1000] GOTO 20 (IF M01 IS INACTIVE) M64 B103 (STORE TIME OF DAY IN #103) G65 P9022 A#102 B#101 C1.0 (SEND START TIME BEFORE PAUSE) G65 P9022 A#103 B#102 C0 (SEND HOLD TIME) #110=1 (STORE THAT M01 WAS ACTIVE) M99 N20 #110=0 (STORE THAT M01 WAS INACTIVE) M99 O9022 (CALCULATE DURATION,TRANSLATE IN HOUR,MINUTE,SECOND AND SEND INFO) #106= [#1- #2] (DELAY TIME IN SEC) #107= FIX[#106/3600] (HOUR) #108= FIX[[#106- #107*3600]/60] (MINUTE) #109=[#106-#107*3600-#108*60] (SECOND) POPEN IF [#3 EQ 1] GOTO10 (IF START TIME IS OUTPUT) IF [#107 EQ 0] GOTO3 (IF LESS THAN 1 HOUR) DPRNT[HOLD;#107[20]HOUR;#108[20]MIN;#109[20]SEC] GOTO20 N3 IF[#108 EQ 0] GOTO4 (IF LESS THAN 1 MINUTE) DPRNT[HOLD;#108[20]MIN;#109[20]SEC] GOTO20 N4 DPRNT[HOLD;#109[20]SEC] GOTO20 N10 IF[#107 EQ 0] GOTO13 DPRNT[START;#107[20]HOUR;#108[20]MIN;#109[20]SEC] GOTO20 N13 IF[#108 EQ 0] GOTO14 DPRNT[START;#108[20]MIN;#109[20]SEC] GOTO20 N14 DPRNT[START;#109[20]SEC] N20 PCLOS M99 O9023 (STORE AND TRANSLATE TIME OF DAY IN SECOND) #1=#3012 #3=FIX[#1/10000] #4=FIX[[#1-#3*10000]/100] #5=[#1-10000*#3-100*#4] #[#2]=3600*#3+60*#4+#5 (TOTAL TIME IN SEC) M99 O9023 is called by a M code that is not buffered (set M code value in parameter #111 or #112 (on a 0-MD)) It is very important else, the time of day will be stored as soon that the line #xxx=#3012 is read into the buffer. Another method shold be to put a cople of empty block before that line but cause the buffer size isn't the same on evry control it is not a good way to do. Argument passed in this macro is the variable number where time of day will be stored(in sec). In my example: #101=time at start #102=time at the beginning of pause #103=time at the end of pause #104=time at the end of program when you call macro O9022, you also pass as argument the two time value on wich the duration have to be calculated and if it is a START or a Hold period. So: A=end of period B=start of period C=0 if it is a hold and 1 if it is a start (to send the good string before the time) It works great, the only fail is if a part is start before midnight and end after midnight. But it won't be difficult to correct it. It could be easier to use timer instead of time of day but #3001 can only count about 64 sec and #3002 is only precise within 3.6 sec (1/1000 hour) Here is how the data looks like once it is send START 5SEC END START 2SEC HOLD 2SEC START 4SEC END START 2SEC HOLD 4MIN 13SEC START 3SEC END START 3SEC HOLD 2MIN 20SEC START 3SEC END Another possible faillure i forgot, timer #3001 reset itself after about 64 sec. So if pause duration is about a multiple of 64 sec, pause can end when timer value is less than the comparative value in the macro detection.To reduce this risk, comparative value must be set as small as possible(just high enough to compansate block processing time) |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| New Mach version "Elapsed Time" doesn't stop | kprice1658 | Tormach PCNC | 5 | 04-14-2010 03:53 PM |
| How to monitor VSD-A "Ready" status? | LBodnar | Granite Devices | 19 | 06-05-2009 07:59 AM |
| Continue subprogram after push "CYCLE-STOP" | dzga | Fanuc | 2 | 06-13-2008 05:18 AM |
| "HACKING" the optional functions on the Haas control? | AMCTony | Haas Mills | 16 | 12-03-2006 11:28 AM |
| How do I stop receiving "News Letters" from the site? | CNCadmin | CNCzone.com FAQ | 0 | 03-03-2006 10:47 AM |