585,937 active members*
3,887 visitors online*
Register for free
Login
Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2005
    Posts
    221

    Galil motion controller question

    Not sure if this is the right forum, so please excuse me if I am in the
    wrong place.

    I have a galil 18x2 card and when a variable is not set, and that variable
    is used in a mg (message) statement or an if statement,
    the card returns a "variable error 9 " I would like to be able to check a variable to see if is set, to avoid the error...

    i.e.:

    if (not variable) then set variable = "some safe value"

    I can't find any documentation how to do this.... and I don't want to preset
    the variable every time the program is started....

    Thanks!

  2. #2
    Join Date
    Dec 2003
    Posts
    24221
    Error code 9 is I believe a code that will stop program execution.
    But the program does not know it does not exist until you try and use it, I don't know of any way of testing wether a variable is used.
    But to my mind, if you know you are going to use it in a program, then why not declare it 0 or whatever at the beginning?
    You only have to do that once.
    On a Galil card, even if you load another separate program and run it, the variables are stored globally, they are reset at power down.
    Al.
    CNC, Mechatronics Integration and Custom Machine Design

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.

  3. #3
    Join Date
    Mar 2003
    Posts
    4826
    I suppose you want to reset the variables whenever the PC is rebooted, but not when the program is being rerun?

    I think I would define all the variables that I intended to use at the beginning of the program. They could all be initialized to zero, or whatever you need. Put this list of variables within a loop that itself has a flag so that this initialization loop executes only once, the first time the program is run after a restart of the PC.
    First you get good, then you get fast. Then grouchiness sets in.

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  4. #4
    Join Date
    Sep 2005
    Posts
    221
    Yes, I only want to reset if the controller is reset.
    the variables stored are like cutter diameters and lengths, and therefore
    I do not want them reset everytime the program is restarted.

    I did discover this: it variable called temp is not set yet i.e. after a controller
    reset, then:

    mg temp ==> the variable error

    but:

    test=temp ==> does not cause the error, and if the variable is not set
    it sets test = 0

    Problem solved.

  5. #5
    Join Date
    Dec 2003
    Posts
    24221
    Is this a program in native language direct to the Galil or is this through some other software like Camsoft?
    Because I still do not see why you cannot declare it in a separate program or in a flagged condition that declares all your variables and is run once at start up?
    Al.
    CNC, Mechatronics Integration and Custom Machine Design

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.

  6. #6
    Join Date
    Jan 2007
    Posts
    210
    I just set them when I startup the card (or I send a reset command).
    VB code:
    : RC = DMCOpen(Controller, 0, hDmc)
    : .. If RC = 0 Then
    : ....' OK CONTROLLER ALIVE
    : ..... msg$= "XOSC=0" ' galil global variable "XOSC" initialized to zero
    : ..... RC = DMCCommand(hDmc, msg$, Response, ResponseLength)
    : ....... If RC <> 0 Then stop ' command failed
    : .. Else
    : .... ' CONTROLLER NOT FOUND
    : .. End If

    Bob
    You can always spot the pioneers -- They're the ones with the arrows in their backs.

  7. #7
    Join Date
    Sep 2005
    Posts
    221
    It is stuff I am doing in native Galil language.
    And I don't want to reset every time the program is restarted because
    the value is always changing. I don't know if that makes sense or not...

    It's kind of like tool diameters on a mill, if you tweak them as you go i.e.
    0.4995 instead of 0.500, then you don't want the mill to automatically
    reset them to 0.500 every time you turn it on.


    The method I showed above did work however.
    Thanks for your help.

Similar Threads

  1. Galil question and others
    By jimc in forum Servo Motors / Drives
    Replies: 33
    Last Post: 06-13-2008, 03:25 PM
  2. the Motion group Controller
    By 47MLB in forum Machines running Mach Software
    Replies: 1
    Last Post: 07-23-2007, 10:16 PM
  3. 3-4 axis motion controller
    By grebator in forum Stepper Motors / Drives
    Replies: 5
    Last Post: 04-19-2007, 09:15 PM
  4. PARKER 6K2 or 6K4 Motion controller
    By TUCSONCNC in forum Post Processors for MC
    Replies: 0
    Last Post: 02-02-2007, 07:07 AM
  5. need help please. dc motor motion controller circuit
    By jbbaby in forum CNC Machine Related Electronics
    Replies: 0
    Last Post: 12-06-2005, 08:29 PM

Posting Permissions

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