586,069 active members*
3,704 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > Fanuc > Where is the syntax error in this Fanuc code?
Results 1 to 16 of 16
  1. #1
    Join Date
    Feb 2007
    Posts
    167

    Where is the syntax error in this Fanuc code?

    Bear with me, I am very new to using industrial machines so im sure my error is very obvious.

    Pasted below is the beginning part of my ~2000 line program, upon trying to run this in single block mode I get a syntax error, can you spot it?
    (RhinoCAM posted this code, my Fanuc 21m controller adds a semicolon character at the end of each line)

    O0001
    %
    N0005G0 G91 Z0
    N0010G0 G90 G17 G20 G40 G80 G90 G94 G64
    N0015G0 G90 G54 X0 Y0
    (2 1/2 Axis Facing)
    N0020 T3 M6
    N0025 M8
    N0030 G90 G1 X-0.8875 Y0.6125 F200. S5000 M3
    N0035 G90 G43 Z0.25 H0
    N0040 Z-0.0625 F60.
    N0045 Y2.75
    N0050 X-0.8753 Y2.8744
    N0055 X-0.839 Y2.994
    N0060 X-0.7801 Y3.1042
    N0065 X-0.7008 Y3.2008
    N0070 X-0.6042 Y3.2801
    N0075 X-0.494 Y3.339
    N0080 X-0.3744 Y3.3753
    N0085 X-0.25 Y3.3875
    N0090 X3.25
    Rockcliff PE/Aluminum Router > 4'x8' CNC Router/Plasma > Manual DRO/CNC X2 > 4 Axis Syil SX3 and an Emco PC Mill 125

  2. #2
    Join Date
    Mar 2003
    Posts
    2932
    What is the alarm number?

  3. #3
    Join Date
    Mar 2003
    Posts
    2932
    Could be the H0. I would guess it should be H3.

  4. #4
    Join Date
    Mar 2003
    Posts
    2932
    I would also think you want N0005 to be G0 G91 G28 Z0 to take Z up to it's home position.

  5. #5
    Join Date
    Feb 2007
    Posts
    167
    Error is: 9 N 0 SYNTAX ERROR (i have changed H0 to H3, what does this do?)
    Rockcliff PE/Aluminum Router > 4'x8' CNC Router/Plasma > Manual DRO/CNC X2 > 4 Axis Syil SX3 and an Emco PC Mill 125

  6. #6
    Join Date
    Feb 2006
    Posts
    338
    Quote Originally Posted by idtkid View Post
    Error is: 9 N 0 SYNTAX ERROR (i have changed H0 to H3, what does this do?)
    G43 H# activates the tool length offset for tool # in this case tool 3
    dcoupar's other comment looks like a good change as well.

    Which line is it stopping on? You should be able to look at the line after the error pops up. If you have a problem with that, try using single block until you get the error. That should narrow it down greatly.

    Edit: Doh, your second line is % that usually marks the beginning and end of a g-code file.

  7. #7
    EOB goes before the comment




  8. #8
    Join Date
    Apr 2007
    Posts
    3
    First what I see isunnormal lookig line NG90G43Z0.25HO
    I think firs should be H value than Z value.
    Tray this way NG90G43H3Z0.25
    If not work let me know

  9. #9
    Join Date
    Dec 2008
    Posts
    3109
    O0001
    %
    N0005G0 G91 Z0
    The % is not part of NC language

    it is used with communication software for start and end of transmission

    This is the only source for the syntax error. It is to be the only code on #1 line ( some controls use it at the end of the filename string on the 1st line--Okuma's ) or deleted, it should also be the last character in the file

    All other items mentioned will not cause the machine to not cycle start

  10. #10
    Sorry to nitpick

    But having % mid way through the program doesn't cause the Syntax error.

    Not having the program number after the % at the beginning of the program will cause an error.

    When the data is sent over RS232 it uses the O program number after the % to name it's self.

  11. #11
    Join Date
    Feb 2006
    Posts
    1792
    H0 cancels the tool length compensation, like G49.

    Like many others, I am not comfortable with % sign. Remove it and run the program in single block to find out where exactly it alarms out.

  12. #12
    Join Date
    Feb 2006
    Posts
    338
    Quote Originally Posted by MysticMonkey View Post
    Sorry to nitpick

    But having % mid way through the program doesn't cause the Syntax error.

    Not having the program number after the % at the beginning of the program will cause an error.

    When the data is sent over RS232 it uses the O program number after the % to name it's self.
    Actually on our machines 15,16, 16i They all default to O0000 if there isn't a program number, but that may be a parameter option. Anyhow it's almost certain the % should not be there. A question is it there in the file, or somehow on the control? And again which line is it stopping on in single block.

  13. #13
    Join Date
    Feb 2007
    Posts
    167
    Thanks guys, removing the first % sign fixed the prob, I forgot to try placing it before the program number to see if that would cause it as well. Appreciate the help!
    Rockcliff PE/Aluminum Router > 4'x8' CNC Router/Plasma > Manual DRO/CNC X2 > 4 Axis Syil SX3 and an Emco PC Mill 125

  14. #14
    Join Date
    Mar 2006
    Posts
    54
    I have the 18i on a new FADAL. My tool call has to be M6 T#. Where are you alarming out at, what line? Line # 5 shouldn't be there. At least not like that. Add a G28. But when you make a tool change, your Machine will return to Z0 without line # 5. Line 35, your G90 should be GO instead. H should be the same as the tool #. And put that percent sign at the start and end of the Program.

  15. #15
    Join Date
    Sep 2005
    Posts
    767
    Glad you found the problem, but there's one other thing to watch out for:

    Your 21i is apparently set to accept ASCII characters instead of ISO. Most older Fanuc models would have thrown a TH (Tape horizontal) alarm when reading your comment. Lower-case letters are legal in ASCII but not in ISO. On the 21i, there is a parameter for this (I think it's a bit in parameter 100)

  16. #16
    Join Date
    Feb 2007
    Posts
    592

    O0000

    Quote Originally Posted by dpuch View Post
    Actually on our machines 15,16, 16i They all default to O0000 if there isn't a program number, but that may be a parameter option. Anyhow it's almost certain the % should not be there. A question is it there in the file, or somehow on the control? And again which line is it stopping on in single block.
    Technically I was told that program o0000 is assigned to the MDI buffer.

Similar Threads

  1. Auto Tool Zero VBA Code gives Syntax Error
    By kiltjim in forum Mach Wizards, Macros, & Addons
    Replies: 2
    Last Post: 02-03-2009, 12:32 AM
  2. Fanuc Error code
    By Racecarengineer in forum CNC (Mill / Lathe) Control Software (NC)
    Replies: 1
    Last Post: 06-12-2008, 06:46 PM
  3. Fanuc 10M Error Code
    By WallStreet in forum CNC (Mill / Lathe) Control Software (NC)
    Replies: 1
    Last Post: 10-12-2007, 09:41 PM
  4. Error code help on Fanuc
    By digger1969 in forum Fanuc
    Replies: 8
    Last Post: 03-29-2007, 10:38 AM
  5. syntax error
    By pyroracing85 in forum G-Code Programing
    Replies: 9
    Last Post: 01-28-2005, 02:09 AM

Posting Permissions

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