![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| General Electronics Discussion Discuss basic electronics, power supplies and anything else electronic related here. |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
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
| ||||
| ||||
| 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 Machine Design. “Logic will get you from A to B. Imagination will take you everywhere.” Albert E. |
|
#3
| ||||
| ||||
| 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
| |||
| |||
| 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
| ||||
| ||||
| 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 Machine Design. “Logic will get you from A to B. Imagination will take you everywhere.” Albert E. Last edited by Al_The_Man; 07-22-2007 at 02:41 PM. |
| Sponsored Links |
|
#6
| |||
| |||
| 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
| |||
| |||
| 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. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Galil question and others | jimc | Servo Motors and Drives | 33 | 06-13-2008 09:25 AM |
| the Motion group Controller | 47MLB | Machines running Mach Software | 1 | 07-23-2007 04:16 PM |
| 3-4 axis motion controller | grebator | Stepper Motors and Drives | 5 | 04-19-2007 03:15 PM |
| PARKER 6K2 or 6K4 Motion controller | TUCSONCNC | Post Processors for MC | 0 | 02-02-2007 12:07 AM |
| need help please. dc motor motion controller circuit | jbbaby | General Electronics Discussion | 0 | 12-06-2005 01:29 PM |