585,992 active members*
5,588 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > CamSoft Products > Help understanding "variables" and others.
Page 1 of 2 12
Results 1 to 20 of 28
  1. #1
    Join Date
    Mar 2003
    Posts
    332

    Question Help understanding "variables" and others.

    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.

  2. #2
    Join Date
    Nov 2004
    Posts
    446
    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

  3. #3
    Join Date
    Mar 2003
    Posts
    332
    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)

  4. #4
    Join Date
    Nov 2004
    Posts
    446
    Quote Originally Posted by keithorr
    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

  5. #5
    Join Date
    Mar 2004
    Posts
    1543
    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

  6. #6
    Join Date
    Mar 2003
    Posts
    332
    Quote Originally Posted by Karl_T
    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.

    Quote Originally Posted by Karl_T
    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.

  7. #7
    Join Date
    Nov 2004
    Posts
    446
    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

  8. #8
    Join Date
    Mar 2003
    Posts
    332

    Unhappy

    "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.

  9. #9
    Join Date
    Nov 2004
    Posts
    446
    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

  10. #10
    Join Date
    Nov 2004
    Posts
    446
    Quote Originally Posted by keithorr
    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

  11. #11
    Join Date
    Mar 2004
    Posts
    1543
    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

  12. #12
    Join Date
    Nov 2004
    Posts
    446
    Quote Originally Posted by Karl_T
    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

  13. #13
    Join Date
    Mar 2004
    Posts
    54
    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

  14. #14
    Join Date
    Sep 2003
    Posts
    552
    Amen!

    Ben did you get your tool changer working, you I would believe.

    Darek

  15. #15
    Join Date
    Mar 2004
    Posts
    1543
    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

  16. #16
    Join Date
    Apr 2005
    Posts
    51
    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

  17. #17
    Join Date
    Dec 2003
    Posts
    24221
    Quote Originally Posted by Carlo Rechi

    . 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.
    CNC, Mechatronics Integration and Custom Machine Design

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

  18. #18
    Join Date
    Apr 2005
    Posts
    5
    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

  19. #19
    Join Date
    Apr 2005
    Posts
    51
    Mr. Billy,

    My name is Carlo...not Carlos.

    but thank you for your support.

    Carlo

  20. #20
    Join Date
    Nov 2004
    Posts
    446
    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

Page 1 of 2 12

Posting Permissions

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