Alarms & Timers
Generating Alarms (#3000)
Writing to system variable #3000 immediately halts program execution and displays an alarm on the CNC screen. The syntax is #3000=nnn(MESSAGE TEXT), where nnn is an alarm number from 0 to 200. The control adds 3000 to the value and displays the result with the message text on the CNC alarm page — #3000=100(MESSAGE) shows as alarm 3100. (On 30i-era controls, bit 1 (MCA) of parameter 6008 switches to an MC-prefixed format that accepts 0 to 4095.)
After an alarm is triggered, the operator must press RESET to clear it. The primary use of #3000 is input validation at the start of macros -- checking that required arguments were passed and that values are within expected ranges before any cutting begins.
IF [#1 EQ #0] THEN #3000=100(MISSING DIAMETER)
IF [#1 LT 0] THEN #3000=101(DIAMETER MUST BE POSITIVE)
IF [#2 GT 100] THEN #3000=102(DEPTH EXCEEDS MAX)
Recommended alarm number ranges:
| Range | Suggested Use |
|---|---|
| 1–99 | Argument validation errors |
| 100–149 | Runtime errors (tool breakage, out of tolerance) |
| 150–200 | Machine/fixture errors |
Operator Messages (#3006)
Writing to #3006 displays a message and stops execution, similar to an M00 optional stop. The syntax is #3006=1(MESSAGE TEXT). Unlike #3000, this does not generate an alarm -- it pauses the program and waits for the operator.
The operator must press CYCLE START to continue (not RESET). This makes #3006 ideal for tool change prompts, measurement verification steps, and any point where an operator decision or action is needed mid-program.
#3006=1(FLIP PART AND PRESS CYCLE START)
#3006=1(VERIFY CLAMP PRESSURE)
#3006=1(INSERT TOOL 5 AND PRESS START)
Clock Variables (#3001 / #3002)
Fanuc provides two clock-related system variables for timing and machine hour tracking:
| Variable | Function | Resolution | Reset |
|---|---|---|---|
#3001 | Millisecond timer (counts at all times; accuracy 16 ms) | 1 ms | Cleared to 0 at power-on, or by writing #3001=0; wraps to 0 after 2147483648 ms |
#3002 | Hour timer (counts only while cycle start is active) | 1 hour | Retained through power-off; read/write, presettable; wraps to 0 after 9544.371767 hours |
#3001 is useful for measuring cycle time within a macro. Reset it to zero before the operation, then read it afterward to get elapsed milliseconds:
#3001=0 (RESET TIMER)
(... machining operations ...)
#100=#3001 (READ ELAPSED MS)
#500=#100/1000 (CONVERT TO SECONDS)
#3002 counts hours only while the cycle start lamp is on (automatic operation), so it accumulates run time rather than total powered-on time. Its value is kept through power-off, and it can be preset or reset by writing to it.
Date and Time Variables (#3011 / #3012)
These read-only system variables provide the current date and time from the CNC controller's internal clock:
| Variable | Format | Example |
|---|---|---|
#3011 | YYYYMMDD | 20260224 = Feb 24, 2026 |
#3012 | HHMMSS | 143025 = 2:30:25 PM |
These are useful for timestamping parts (with DPRNT), logging cycle start/end times, and shift tracking. Example extracting individual date components:
#100=#3011 (GET DATE AS YYYYMMDD)
#101=FIX[#100/10000] (EXTRACT YEAR)
#102=FIX[#100/100]-#101*100 (EXTRACT MONTH)
#103=#100-FIX[#100/100]*100 (EXTRACT DAY)
Practical Patterns
Input Validation Block
Validate all arguments up front before any cutting begins. Use #3000 for hard errors and default assignments for optional arguments:
(VALIDATE ALL ARGUMENTS UP FRONT)
IF [#1 EQ #0] THEN #3000=100(A= DIAMETER REQUIRED)
IF [#2 EQ #0] THEN #3000=101(B= DEPTH REQUIRED)
IF [#3 EQ #0] THEN #3=#9 (DEFAULT FEED IF NOT GIVEN)
IF [#1 LE 0] THEN #3000=102(DIAMETER MUST BE POSITIVE)
Cycle Time Measurement
Use #3001 to measure elapsed time and #3006 to alert the operator if a threshold is exceeded:
#3001=0 (START TIMER)
(... machining operations ...)
#100=#3001 (ELAPSED MS)
IF [#100 GT 60000] THEN #3006=1(CYCLE EXCEEDED 60 SEC)
Conditional Operator Prompt
Combine variable comparison with #3006 to pause only when an out-of-tolerance condition is detected:
IF [#500 GT #501] THEN #3006=1(PART OUT OF TOL - CHECK)
See also: Feed Hold & Auto Mode for #3003/#3004 auto mode control, External Output / DPRNT for logging data to files, and Macro Structure for macro template with validation.
References
- Peter Smid, Fanuc CNC Custom Macros, Industrial Press, 2004.
- Fanuc, Operator’s Manual / Parameter Manual, FANUC Corporation.
- Fanuc, Series 30i/31i/32i-MODEL B Plus Operator’s Manual (Common), B-64724EN/01, FANUC Corporation.
Have a question or want to contribute?
Contact us with corrections, additions, or topics you'd like covered.
Get in Touch