View Full Version : Help understanding "variables" and others.
keithorr 05-06-2005, 03:30 PM Using CNC Lite:
From GCODE.FIL as delivered, the logic commands associated with G1 (G01);
!'DISPLAY4 {f*[\73/100]}
!'DISPLAY5 {s*[\74/100]}
!TIME CYCLE;\4
!DISPLAY7 \4
!RUNTIME \4
!DISPLAY8 \4
-----G1
I kind of understand the first two lines. The apostrophe at the beginning of the first two lines make them unread by the system, Yes/No? I don't see the apostrophe being used in any other G codes.
I understand the logic values DISPLAY, TIME CYCLE, RUNTIME. I don't understand the use of the semicolon after TIME CYCLE. What parameter would/could be placed after TIME CYCLE?
I don't understand the variable \4. What is happening? The variable "4" is all over the place in GCODE.fil and MCODE.fil but doesn't seem to be a dedicated variable like \73 and \74.
Any help appreciated.
murphy625 05-06-2005, 04:40 PM Ok.. Im not good at reading other peoples code but here goes:
Assuming the control named DISPLAY7 is visible in your interface, the following code will grab the value that is stored in variable \4 and put that value into the display box on your interface.
!DISPLAY7 \4
This code will get the time since the cycle was started and store that time into variable \4.
!RUNTIME \4
This code will get the value stored in variable \4 and show that number on your interface in the control named DISPLAY8.
!DISPLAY8 \4
One cool way to learn the camsoft code is to make a clock. Try this.
In your Startup.fil place the following code:
!Timer ON;1000 'this line turns the timer on and sets the interval to 1000ms
!\500=1 'this line simply makes variable number 500 equal 1
In your Timer.fil place the following code:
!\500={\500+1} 'this line reads the value of variable 500 and adds one to it.
!DISPLAY1 \500 'this line reads the variable 500 and puts that number into your display box.
On your interface, make sure DISPLAY1 is visible.
When your interface starts, the control named DISPLAY1 will change every 1000 milliseconds (1 second) and it will read a new number that is 1 higher than the previous number.
Every 1000 milliseconds, the timer file will run all the code that was placed in the file. Since there is code there that tells it to get the value of 500 and +1 to it then variable 500 will increase by 1 incrementaly every second.
Instead of placing the code in the timer.fil file, you could also go into your Mcodes and place the code there.. Then assign that Mcode to a button and everytime you press the button the variable \500 will update by 1.
You get only 999 variables to make your program and you can use them over and over in any way you want. All codes place anywhere in any of your .fil files can access the value in any variable. The values in your variables can be anything you can type with your keyboard but be carefull because when you start messing with filenames as variables, the camsoft software goes to another dimension of understanding.
Once you get the hang of it, you can so some very crazy things with the interface.
Hope this helps .
Murph
keithorr 05-06-2005, 05:21 PM That helps.
Since variable \4 is a time value, the DISPLAY7 (Cut Time) and DISPLAY8 (Run Time) are being updated each time a G01 line of code is run.
I still don't get the apostrophe in front of DISPLAY4 (Feed Rate) and DISPLAY5 (Spindle Speed)
murphy625 05-06-2005, 05:34 PM I still don't get the apostrophe in front of DISPLAY4 (Feed Rate) and DISPLAY5 (Spindle Speed)
The apostrophe makes it so that the processor ignores that line.
Good for adding notes or temporarily making it so a line wont run without having to delete the line.
Murphy
Karl_T 05-06-2005, 06:01 PM You need to learn Camsoft's search engine(Its way cool and helps a lot). Here's the result of the TIME command:
TIME
Returns various elapsed times in minute format since the machine has been turned on into the user-supplied variable. There are two parameters. The first parameter is the keyword. The keywords are ON, CYCLE, IDLE, DATE, MS and RESETMS. The ON keyword returns the time elapsed since the machine has been on in minutes. CYCLE is the amount of time the machine has been in either auto cycle or single step mode. IDLE is the amount of time the machine has been idle and not in cycle. DATE is the current month, day, year, hour, minute and second. MS returns the number of milliseconds that elapsed since the last RESETMS was done or since the EXE was started. Minimum CPU time cycles will vary between computers (15ms to 60ms). Accuracy is very good above this. RESETMS is used to zero out the MS counter. The second parameter is the variable.
EXAMPLE: TIME ON;\55
In your case TIME has the parameter CYCLE and stores the result to the variable after the semicolon, \4 in your case.
Later on, you can attach potentiometers for feed to analog input 1, uncomment out all the lines with \73 in them, and have a knob to adjust feedrate on the fly. The programming is all done for you, just remove the comments. Same story for spindle speed.
There's a bit of a learning curve for you. Stick with it,Camsoft is the most powerful control out there.
Karl
keithorr 05-06-2005, 07:35 PM You need to learn Camsoft's search engine(Its way cool and helps a lot). Karl
I got the search engine business ok. I just can't keep reading the same text over and over. It doesn't get any better.
I understand that TIME CYCLE and RUNTIME enter values into variable \4 and DISPLAYx utilizes the variable value.
In your case TIME has the parameter CYCLE and stores the result to the >variable after the semicolon, \4 in your case.Karl
FYI, the example in the first post is a default from camsoft. Nothing I made up. I want to know if there are typos in the examples.
According to the Camsoft search engine, semicolons are used to fill a space when a parameter value is not being used. What parameter value could be used following TIME CYCLE?
Why isn't RUNTIME or CYCLES (not time-cycles) followed by a semicolon?
Again, why is there an apostrophe in front of DISPLAY in the Gcode.fil for G1 but not G0,G2,3,10,81 etc?
I understand the \73,74 override.
murphy625 05-06-2005, 07:47 PM The apostrophe is so the code doesnt run.
It may only be my view but it seemed to me that all of the camsoft code that came with the package was just examples of how to do things.
If your inquiry is based on the fact that the piece of code you gave us didnt make sense in a real world application then you would be correct in most cases.
Here is some more examples of coding..
!IF #29=1 THENIF \17=<0 THEN#28=0 :#29=0 :#62=0 :ESTOP
Notice the semicolon ":" that seperates the commands.
The above code says:
If output 29 is on then if variable 17 is equal or less than 0 then turn off output 28 turn off output 29 turn off output 62 and emergency stop.
Did that help?
Murphy
keithorr 05-06-2005, 09:54 PM "If your inquiry is based on the fact that the piece of code you gave us didnt make sense in a real world application then you would be correct in most cases."
I was told by sales that the G Code is ready to go out of the box. I'm wondering why the lines were included if the display boxes were not going to be updated.
I know some of the examples are just examples, and not usable as delivered. The documentation even states as such for StartUp.fil, InputIO.fil etc but I was told different regarding gcode.fil.
Also, your example of THEN#28=0 :#29=0 :#62=0 :ESTOP is using a colon, not a semicolon so it's not germaine to my concerns.
With the syntax being so specific, I don't want to make mistakes on an active machine.
I finally realized I can play back G Code files in the "demo" mode by using the "single step" button and see what updates with each line. If I use the "cycle start" the lines run right to the end with no chance to see what is going on.
If camsoft doesn't reply here I will contact them on Monday.
murphy625 05-07-2005, 06:52 AM The ":" seprates commands on the same line.
The ";" is used to seperate parameters within the same command.
Here is an example.
!BUTTON1 OUT;DESCRIPTION;12;FILENAME
!BUTTON1 IN;WATER ON; 15; MyButton.bmp
The above example is right out of the book but is a useless example that is meant to show only the syntax to be used for the BUTTON command.
!BUTTON1 ;;;Manual.bmp
The above example is my own code. Notice the differences. I do not require a parameter for IN or OUT so I skip that parameter but it still needs the ; to be there.
I also do not need to include a DESCRIPTION for the button so I placed another ; there.
The 12 is a color code and since I didnt need that either, I just placed the ; there.
The file name I needed so that changes with my code.
Am I making sense here? If you were sitting next to me this would take less than 60 seconds for me to show you and you would understand. Typing it out here makes it allot more difficult to show.
The button command requires 4 parameters. Those are:
ON or OFF
A DESCRIPTION which puts text onto the button for the user to read
COLOR which is a number 0-15 or something like that.
FILENAME which tells the interface to find the file name and use that filename as the buttons picture graphic.
Here is another example
!TIMER ON;1000
The TIMER command takes 2 parameters. The first parameter is either ON or OFF. Then a ; is placed there to seperate parameters and the second parameter is the timer interval in milliseconds.
Here is an example of turning on the timer, and setting an output to ON.
!TIMER ON;1000 :#29=1
Here is an example of turning off the timer and turning off the output.
!TIMER OFF : #29=0
Here is an example of turning on the timer again at 1/2 sec interval and also setting variable 5 to the value of HELLO
!TIMER ON;500 :\5=HELLO
I hope this helps..
I know your getting fustrated.. This is a very normal reaction to the camsoft software and it will go away quickly once you get the basics figured out.
Keep asking questions.. I will help you as often as I log on to check the messages..
Murph
murphy625 05-07-2005, 07:01 AM I finally realized I can play back G Code files in the "demo" mode by using the "single step" button and see what updates with each line. If I use the "cycle start" the lines run right to the end with no chance to see what is going on.
If camsoft doesn't reply here I will contact them on Monday.
Here is another trick..
Go into the directory that contains all your files and delete the file called
LOGFILE.FIL
The next time you open your interface, make sure to open the diagnostics screen. Opening the diagnostics screen forces a new LOGFILE to be created. Run your code, and when you close your interface, a new log file will contain all the commands and actions your program did and how the camsoft interface reacted to them. The LOGFILE was created for exactly this purpose.
Here is a tip about camsoft. (Maybe I should just keep my mouth shut but here goes anyhow).
My own experience has shown that when it comes to the very basic stuff that is explained and shown in the book, they tend to stay mute to questions. When it comes to advanced questions that are not addressed in the instruction book(s), they tend to speak up and answer.
I know your fustration.. Believe me I know it.. Just hang on and keep asking questions and you WILL figure it out shortly. Once you figure out the basics, you will begin to love this program.
Murphy
Karl_T 05-07-2005, 07:40 AM Here is a tip about camsoft. (Maybe I should just keep my mouth shut but here goes anyhow).
My own experience has shown that when it comes to the very basic stuff that is explained and shown in the book, they tend to stay mute to questions. When it comes to advanced questions that are not addressed in the instruction book(s), they tend to speak up and answer.
I know your fustration.. Believe me I know it.. Just hang on and keep asking questions and you WILL figure it out shortly. Once you figure out the basics, you will begin to love this program.
Murphy[/QUOTE]
Both points here are right on. Put yourself in the techs. shoes for a second; they are not there to teach programming 101. Their purpose is too help with technical problems. For this, THOSE CAMSOFT GUYS ARE THE BEST! Don't wear out your welcome on the basics. Learn on your own and ask here.
The CBK you have will run a machine right out of the box. But it won't be exactly right for your appication. If I were you, I'd pick a very simple modification to work on - say add a light to the display - read everything and try it. Be sure and keep backups so you can alllways go back. Learn one thing a day - in a month it will all make sence and seem easy.
Karl
murphy625 05-07-2005, 07:50 AM The CBK you have will run a machine right out of the box. But it won't be exactly right for your appication. If I were you, I'd pick a very simple modification to work on - say add a light to the display - read everything and try it. Be sure and keep backups so you can alllways go back. Learn one thing a day - in a month it will all make sence and seem easy.
Karl
I have to disagree with that but only on a personal level.
I found it much easier to scrap EVERYTHING and start from a blank slate with no code in any files... (maybe it's just my way of learning)
My disclaimer would be that my machine is so far removed from any Mill CNC type application that none of the code would help me anyhow.... I did however use the old codes to check syntax examples when the book did nothing to help.
Murphy
Ben Olson 05-08-2005, 01:59 AM taking a month to figure out Camsoft is all great and good when you're Farting around with a home CNC router in your garage..... but taking a month when you NEED the machine to run NOW ..... just plain sucks.....believe me . I don't care if you can eventually get it to have dancing tinkerbelles running around the screen.... I want my VMC to run some parts NOW! and reliably without endless hours of frustating fiddling with code that is too generic to be usefull
what I was expecting and what I was sold ( simple reliable .. hook up the wires and GO! ) was not what I got
those folks at Camsoft should go RUN a machine with a Haas control , go RUN a machine with a Fanuc control , learn how a VMC should work and go write a ROCK SOLID .cbk file that works everytime out of the box.....later on down the line if you want to fiddle with different color buttons ( who really cares? ) go ahead
HillBilly 05-08-2005, 05:48 AM Amen!
Ben did you get your tool changer working, you I would believe.
Darek
Karl_T 05-08-2005, 07:32 AM Ben
You're going to need somebody that knows Camsoft to hook you up. I believe Camsoft Corp. calls them Integrators. They have a network of these folks. If you don't have more hardwiring to do, this is a trivial job for a person like this.
I can see you're pissed at this point. Me thinks you'll change your mind when you see how good a product you have.
Karl
Carlo Rechi 05-08-2005, 09:24 AM Ben
Karl is right. You will find that Camsoft is better and more opened than standard controls and no propriety hardware. I have only used it a short time and it offers everything a standard control offers and more. They did offer me operator pendants like you speak of and also installation service but my friend and me did it our self. Only motion card and his PC. You can see ready to go operator pendants on their website like you mentioned. The last 2 news newsletters I got showed 2 news very good looking ones. I do not know the names of these.
I to worked on the wiring for almost a month but I did this in my spare time. Camsoft did offer me new motors and drives but my friend wanted to reuse his old ones again. If I had got new motors from Camsoft it would of been done in only a few days.
If there is a tool changer or turret I find Camsoft the best. This idea of theirs having the computer program the tool changer is brilliant. I hate ladder logic takes to long and too many mistakes. I would not do a PLC control when I have Camsoft to use.
Any control is going to take you time to hook up old motors and drives. Any other control would make you use crazy ladder logic to program any tool changer.
The software so far did work out of the box as you say CBK interface. I am very impressed with what they gave me.
Carlo
Al_The_Man 05-08-2005, 09:52 AM . Any other control would make you use crazy ladder logic to program any tool changer.
I don't find that strictly true, for example Mitsubishi include dedicated ATC ladder instructions and registers that take care of complex tool change management, that makes programming ATC's a cinch, IMHO ladder is not that complicated.
I have retrofitted machines for some years, including Camsoft etc.
Al.
Billyboy 05-08-2005, 10:05 AM I think you should not lose sight that most controls have fixed features. A Haas or Fanuc control is built for a particular purpose with certain working number of axis, spindle type and known motor brands. So it does work well for that purpose.
If you have old motors or tool changes on one of these closed controls it is sometimes impossible to reuse the old drives and motors. Plus more time consuming to program a PLC for a tool changer than CamSoft. If you know ladder logic well as Al does thats great, but regular guys find CamSoft logic easier to learn.
A control pendent like this is very expensive and not opened to customize easily like CamSoft. CamSoft also offers very professional looking operator controls like Carlos said. This would make it easier. I don't know if the prices are better but it does look like they are. I do know that you have to watch out because their prices for these operator pendants are priced without software, motors and motion card. Some have computers and some do not.
There CBK files are very open. The ones I have seen address the basic functions I think most controls come with. The great thing and I have to say is the best approach yet is to open the system to the user so you can make changes to the operator interface , G and M codes and logic to run tool changers. There must be dozens of ready to use CBK files on the CamSoft CD and a huge library of tool change routine already written. Carlos is right on when he said CamSoft logic beats PLC ladder logic any day.
If your machine is different in any way or just want to make it better than CamSoft has everyone beat including Fanuc and Hass.
Billy
Carlo Rechi 05-08-2005, 10:09 AM Mr. Billy,
My name is Carlo...not Carlos.
but thank you for your support.
Carlo
murphy625 05-08-2005, 01:12 PM I have had more trouble with my GALIL 1822 card than the camsoft software that came with the package.
My galil card has blown on me 2 times for no apparent reason.. 1st time warranty, 2nd time out of warranty and $150 to repair.
The camsoft software and getting things hooked up has been relatively easy as compared to the trouble shooting problems the galil card gave me..
At this point in my experience, I firmly believe I could make the camsoft software run just about anything short of the space shuttle.. CNC or not..
Murphy
Ben Olson 05-08-2005, 07:35 PM trust me guy's I'm not pissed... the machine actually runs now ( still can't use G01 , I need to change all the programs to use G10 ) and no tool changer yet
and I got the handwheel to work , something the tech's at Camsoft were unable to do ( you have to delete all the logic for the 4 th axis handwheel in the inputIO.fil then the spindle will work ) surprise!
it still has the occasional glitch that pops up out of nowhere but as long as I keep the programs simple it makes parts
in the meantime while we were hemmorhaging money to get the Camsoft system working we had to get another machine so I leased a Haas VF3 ...I know a lot of you guys are Camsoft true believers .... but they have a ways to go before they have a Real CNC system
Karl_T 05-08-2005, 07:43 PM At this point in my experience, I firmly believe I could make the camsoft software run just about anything short of the space shuttle.. CNC or not..
Murphy
Hmmm... What'd'ya think, Rubin & Ernie? The shuttle is fly by wire, I bet the control surfaces are servos with encoder feedback, The control stick would just be a multi axis handwheel, I/O is a piece of cake. I hear it's do for a retrofit. Murphy here can handle everything else. <VBG>
Karl
murphy625 05-08-2005, 07:55 PM Hmmm... What'd'ya think, Rubin & Ernie? The shuttle is fly by wire, I bet the control surfaces are servos with encoder feedback, The control stick would just be a multi axis handwheel, I/O is a piece of cake. I hear it's do for a retrofit. Murphy here can handle everything else. <VBG>
Karl
LOL..
That's funny..
Actually, I was reading an artical that said the shuttle is hydraulic and that they were considering the servo's on the replacement. It mentioned something about the servo's not being a proven technology when the shuttle was designed. Weight savings was supposed to be several thousand pounds by switching it over. I love popular science magazine...
Murph
murphy625 05-08-2005, 07:59 PM and I got the handwheel to work , something the tech's at Camsoft were unable to do ( you have to delete all the logic for the 4 th axis handwheel in the inputIO.fil then the spindle will work ) surprise!
it still has the occasional glitch that pops up out of nowhere but as long as I keep the programs simple it makes parts
I think this is exactly the reason I found it easier to just delete all the standard files.. I now remember a host of interference problems with other code and things that had already been programed in. I didnt realize it then when I was learning and that was part of my problem.
I bet if you clean up all the stuff you dont need, your occasional glitch will go away..
Murphy
Al_The_Man 05-08-2005, 10:26 PM Regarding Bens predicament, This is something I have raised before and I got shot down for saying so, but as someone who has used alot of systems to retrofit, including the PC based systems, I still claim that although I appreciate any system that offers flexiblity, I would like to see every system offer G codes that work as they should out of the box according to industry standards without having to custom write them, or modify them.
I get that right now with Mitsubishi, Fagor, Fanuc and others etc without the need or desire to modify them.
If the ability to modify is there , Great, but to reduce the time needed to implement the retrofit, it is a big advantage not to have to start customizing G codes.
These functions, G codes, are already pretty much industry standardized, as to what to expect of the control when they are issued.
If I use say, a Mitsubishi lathe package on any lathe of my chosing, I expect and get predictable results as far as the way G codes react, no matter what the make, model or end configurations are.
Machine control (M codes etc) is another matter, that is usually flexible, and should be, whatever system is used.
Al.
Billyboy 05-09-2005, 11:06 AM Hey Al,
I do think you're right but have you looked at Camsoft latety? They seem to list all the standard G codes on their web-site and more. CNC Lite and Plus seemed to have a lot less but still the standards. The G codes in their pro version is over the top. You can even create your own new ones.
I agree the Mitsubishi, Fagor and Fanuc are nice and it may be that being able to customize them adds to peoples questions about them but at least I can modify the G codes if I need to.
Billy
murphy625 05-09-2005, 11:25 AM Hey Al,
I do think you're right but have you looked at Camsoft latety? They seem to list all the standard G codes on their web-site and more. CNC Lite and Plus seemed to have a lot less but still the standards. The G codes in their pro version is over the top. You can even create your own new ones.
Billy
Their website needs work...
Good product, good company, good support, but if I was offering the camsoft software for sale, I would consider their current website as an inadequate company resource in almost every aspect.
I have dealt with several companies with the same symptoms.. There are hundreds more on the internet. I wonder why these companies don't bother to put their best face forward..
Murphy
HillBilly 05-09-2005, 12:54 PM The G codes in their pro version is over the top.
Billy
G28 only returns the machine to home with no index check (basically useless.). They do not even list G98 & G99, two useful additions to drill cycles.
Darek
|
|