584,871 active members*
5,101 visitors online*
Register for free
Login
IndustryArena Forum > MetalWorking Machines > Dyna Mechtronics > Dyna 4M macros and custom G codes
Results 1 to 3 of 3
  1. #1

    Dyna 4M macros and custom G codes

    I know my way around Fanuc custom macro pretty well, but this thing has me befuddled. I'm trying to create a custom G code, and be able to input variables just like you can with normal G codes, i.e. G1 Xnn Ynn Znn. I'm led down the garden path by the manual to believe this is possible. Just write a sequence of commands and stick it in the 4M_SUB.DAT file and away you go. I did this and the command doesn't do anything. No matter what I call the command, G121, G66.1, whatever, I get a "E402: The user G code is not defined" error. I dug around in the 4M directory and found a file called 4M_CODE.H which seems to contain definitions for most of the macros in the 4M_SUB.DAT file, so I dutifully created my definition for the custom G code, and ... nada. Ignores it just like before. I also tried M codes, and this doesn't generate any errors, but it also doesn't execute the macro. I've tried every conceivable variation in syntax, even copying another canned cycle verbatim like G84 and renaming it, no dice. Re the 4m_code.h file, in the software world, a ".h" file is usually implies a source file, in C/C++ it's a header file, I think. That would be tragic if it would require some unobtainable compiler to "bake" the custom code to the .exe. Without this capability, my automatic, customizable probing cycles can't work, because there would be no way to input a definition of what to probe, i.e bore, boss, size of feature, etc. I guess I could run it as a program and manually stuff everything in macro variables, but as someone put it so elegantly in another forum years ago "I'd rather pull nose hairs with pliers".

    Just opened the 4m.exe with a hex viewer, and I definitely see references to G codes in there. It's, of course, unintelligible gibberish, just like any executable, so a bit hard to draw any conclusions... Someone with knowledge in this arcane art could probably do a stack trace and figure out what happens when you launch a G84, but that would not be me.

    Has anyone out there managed to create a custom G code for a 4M control?

  2. #2
    Join Date
    Oct 2005
    Posts
    672
    Dave,

    I think the manual is misleading. There is no ability to create your own G/M codes. The terms macro, subprogram, and subroutine are used interchangeably in the Dyna reference materials.

    What is allowed (but not well explained), is that subroutines can be included within the current program or in a file called user_sub.DAT that is stored in the C:\PROG directory. The 4M software will not call a separate program from the current program.

    For a subroutine that is used frequently by other programs, it can be handy to store it in the user_sub.DAT file rather than having to include it in every main program. For example, if the company logo is to be engraved on numerous different parts, instead of including it inside each part program, it would be contained in the user_sub.DAT file (along with any other commonly used subroutines).

  3. #3
    Join Date
    Jul 2006
    Posts
    3

    Re: Dyna 4M macros and custom G codes

    You've probably moved on by now, but I stumbled across this as I'm beginning my adventure into 4M control on a DM1007 and thought I'd add my input for posterity.

    You should be able to make your own user defined G and M codes; note that system codes take precedent so don't try to overwrite them.

    System codes are in 4M_SUB.DAT and user codes in USER_SUB.DAT
    User codes are defined the same way as system with the scheme (N-xyyzz) where 'N-' is static, 'x' is either 1 for G or 2 for M, 'yy' is label for jumps, 'zz' is the Number. N-10077 is G77

    You can access parameters using '#nn' where nn is the letter digit
    A=0, F=5, K=10, Z=25. (e.g. G77 X_Y_Z_A_ values can be accessed as #23, #24, #25, #0)
    You can also access other variables in the machine just as system macros do.

Similar Threads

  1. help using custom M codes and M-FIN on haas
    By josh591 in forum Haas Mills
    Replies: 8
    Last Post: 08-26-2017, 02:40 PM
  2. FANUC 0T-C / P-Codes and Macros
    By Minesterran in forum Fanuc
    Replies: 1
    Last Post: 01-31-2012, 01:01 PM
  3. Replies: 2
    Last Post: 04-07-2010, 02:46 AM
  4. Custom G codes in Custom G codes
    By stevo1 in forum Fanuc
    Replies: 7
    Last Post: 09-09-2008, 08:32 PM
  5. Need Custom macros for Fanuc 3M
    By brgrii in forum Fanuc
    Replies: 1
    Last Post: 07-23-2006, 02:30 AM

Tags for this Thread

Posting Permissions

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