Syntax for command files (.CM)

  • It is unfortunate that this is not documented anywhere, but I found the IF statement synax in one of Fanuc's .cm files.


    Here it is:

    Check out the Fanuc position converter I wrote here! Now open source!

    Check out my example Fanuc Ethernet/IP Explicit Messaging program here!

  • More commands found in various .CM files :


    # PCVLOAD namefile - to load namefile.SV
    # TXPLOAD namefile - to load namefile.TX
    # ASLOAD namefile - to load namefile.AS (assembly files - used internally)



    #PCCLEAR namefile - to clear namefile.PC
    #DELFR FR:namefile.filetype - to delete namefile.filetype from FROM
    #DEL filepath:\filename.filetype\ - to delete filename.filetype located in filepath

  • You are a very great guy, nobody can learn these great info. from any FANUC manual.
    I have a question about '*.as file' which seems that you are good at it, I got a as-file, however, I can not understand the code inside.
    by the way,can you share more about karel software development, I am also interested in it.

  • Quote

    I have a question about '*.as file' which seems that you are good at it, I got a as-file, however, I can not understand the code inside.


    .as files are Assembly files, basically they are used to perform direct manipulation of internal memory (or registry) of the Operating system

  • thanks for your advice
    I'm totally agree with you, the info., in the karel manual, sometimes makes me waste much time to understand, because some incorrect info. will mislead me and i have to do many experiments to get one point from it.
    as you said, the motion part in J3iB Karel manual can not be found in the new manual. however, as a software developer, it's important.
    I am learning from your *.CM FILE, and I'll work hard on karel programming, there's so much fun in it.
    if you have any info, about karel, i will be your first fan to follow it.


  • .as files are Assembly files, basically they are used to perform direct manipulation of internal memory (or registry) of the Operating system



    i got two *as file, however, I really dont understand about it's rules in it.
    e.g.
    1:% ASM #2 EMCD #2#1
    2:$0a000000 #31 $F4 !Online shift use$CUSTOMMENU[4]


    i can understand the first line, but, I cant transfer the second line's code one by one
    i can guess the function about the second line.


    the other prog.
    1:% ASM #2 TOPK #2#3#1
    2:07000000#31 $F5 !F7:CAN/STR(CANCEL/Start line)
    3:08000000#31 $F6 !F8:LOG/END(Log/End line)
    4:09000000#31 $F7 !F9:CAN/STR(Start/Convert)


    if you have any advance to share, feel free. thanks.



  • I've been learning cm.file for two weeks, and I found [PCVLOAD] also used in the *.vr and *.pc files.
    when used in *pc.file load, it's also same to PCLOAD.
    if anything is incorrect, thanks for your suggestion.



  • Hi,master bidzej
    I'll add some syntax about CM-file, which I also don't know about its function.However, I wish master bidzej or someone will fix it out oneday. :nanananana:
    the structure is
    1.#SPEP_ON.........#SPEP_OFF
    2.#FRCLRPR.........#FRSETPR


    another question is about [How to Start the CM.file]
    if there's no KCL command in the cm.file,I can start the CM.file.
    However, if the cm.file contains the KCL command, I need to set the varaible [$RMT_MASTER] to '1', disable the teach pedant, and switch to AUTO mode. In the case, I can start the CM.file finally

  • And still, using such a construction -> SETVAR $ CCSCB2_GRP [1]. $ FS_TYP2 1, you do not ever refer to a variable of type STRING.
    It is better to refer to the variables like this:
    KCL SET VAR $ ATCELLSETUP. $ HOME_MACRO = 'BLA_BLA'
    KCL SET VAR $ ACC_MAXLMT = 15
    KCL SET VAR $ AP_AUTOMODE = TRUE

  • Change Status - Di\Do\Ri\Ro\Flag


    !***************
    !DI 33 SET Sim Mode and True
    SETIOVAL 1 33 1 0 1


    !DI 34 SET Sim Mode and False
    SETIOVAL 1 34 1 0 0


    !DI 35 SET UnSim Mode
    SETIOVAL 1 35 0 0 0


    !***************
    !DO 33 SET Sim Mode and True
    SETIOVAL 2 33 1 0 1


    !DO 34 SET Sim Mode and False
    SETIOVAL 2 34 1 0 0


    !DO 35 SET False
    SETIOVAL 2 35 0 0 0


    !DO 36 SET TRUE
    SETIOVAL 2 36 0 1 0


    !************
    !RI 1 SET Sim Mode and True
    SETIOVAL 8 1 1 0 1


    !RO 1 SET Sim Mode and True
    SETIOVAL 9 1 1 0 1


    !************
    !Flag[10] = true
    SETIOVAL 35 10 0 1 0


    !Flag[11] = false
    SETIOVAL 35 11 0 0 0

  • I recently used a Command File to populate UALRMs on several(16) robots. It took minutes, instead of hours to do.
    I was quickly and easily able to implement 200+ User Alarms :top:


    Sample of syntax:
    SETVAR $UALRM_MSG[1] "Invalid Argument"
    SETVAR $UALRM_MSG[3] "BG Logic 1 not running"
    SETVAR $UALRM_MSG[4] "BG Logic 2 not running"
    SETVAR $UALRM_MSG[5] "BG Logic 3 not running"
    SETVAR $UALRM_MSG[6] "BG Logic 4 not running"
    SETVAR $UALRM_MSG[7] "BG Logic 5 not running"
    SETVAR $UALRM_MSG[8] "BG Logic 6 not running"
    SETVAR $UALRM_MSG[9] "BG Logic 7 not running"

    - - - MH - - -

  • DELTP program - deletes the specified .TP program from the Robot memory


    Use this before TPLOAD device:program.tp (like loading from USB). It won't alarm if the file exists in Robot memory where the TPLOAD will if the file exists & it ends the execution of the .cm file.

  • If the .tp file already exists in the Robot controller, say TEST.tp & the TPLOAD UT1:Test.tp command is given, there will be a message displayed "Program already exists" & you will have it hit F4 (OK), it's the only choice given. At that point, the .cm file has not completed. Just to be on the redundant side, on the line before the TPLOAD command, give it the DELTP TEST, & even if that file does not exist in the Robot, all will be fine.

  • Another way to work around the overwriting problem is to use the Karel equivalent in the CM file:


    KCL LOAD TP <FILENAME> <OVERWRITE - OPTIONAL>
    KCL LOAD TP ALARM OVERWRITE


    Instead of:
    TPLOAD ALARM.TP (which will abort the CM if the file already exists)

    - - - MH - - -

Advertising from our partners