Results 1 to 7 of 7

Thread: Galil motion controller question

  1. #1
    Registered
    Join Date
    Sep 2005
    Location
    USA
    Posts
    221
    Downloads
    0
    Uploads
    0

    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
    Community Moderator Al_The_Man's Avatar
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    18,943
    Downloads
    0
    Uploads
    0
    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 (Skype Avail).

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


  3. #3
    Moderator HuFlungDung's Avatar
    Join Date
    Mar 2003
    Location
    Canada
    Posts
    4,826
    Downloads
    0
    Uploads
    0
    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
    Registered
    Join Date
    Sep 2005
    Location
    USA
    Posts
    221
    Downloads
    0
    Uploads
    0
    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
    Community Moderator Al_The_Man's Avatar
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    18,943
    Downloads
    0
    Uploads
    0
    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.
    Last edited by Al_The_Man; 07-22-2007 at 03:41 PM.
    CNC, Mechatronics Integration and Custom Machine Design (Skype Avail).

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


  • #6
    Registered
    Join Date
    Jan 2007
    Location
    MI. USA
    Posts
    203
    Downloads
    0
    Uploads
    0
    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
    Registered
    Join Date
    Sep 2005
    Location
    USA
    Posts
    221
    Downloads
    0
    Uploads
    0
    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 and Drives
      Replies: 33
      Last Post: 06-13-2008, 10:25 AM
    2. the Motion group Controller
      By 47MLB in forum Machines running Mach Software
      Replies: 1
      Last Post: 07-23-2007, 05:16 PM
    3. 3-4 axis motion controller
      By grebator in forum Stepper Motors and Drives
      Replies: 5
      Last Post: 04-19-2007, 04:15 PM
    4. PARKER 6K2 or 6K4 Motion controller
      By TUCSONCNC in forum Post Processors for MC
      Replies: 0
      Last Post: 02-02-2007, 01:07 AM
    5. need help please. dc motor motion controller circuit
      By jbbaby in forum General Electronics Discussion
      Replies: 0
      Last Post: 12-06-2005, 02:29 PM

    Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.