CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > Machine Controllers Software and Solutions > CamSoft Products


CamSoft Products Discuss Camsoft PC based CNC controller products here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 05-06-2005, 04:30 PM
 
Join Date: Mar 2003
Location: USA
Posts: 332
keithorr is on a distinguished road
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.

Last edited by keithorr; 05-06-2005 at 04:53 PM.
Tweet this Post!Share on Facebook
Reply With Quote

  #2   Ban this user!
Old 05-06-2005, 05:40 PM
 
Join Date: Nov 2004
Location: USA
Age: 50
Posts: 446
murphy625 is on a distinguished road

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
Tweet this Post!Share on Facebook
Reply With Quote

  #3   Ban this user!
Old 05-06-2005, 06:21 PM
 
Join Date: Mar 2003
Location: USA
Posts: 332
keithorr is on a distinguished road

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)
Tweet this Post!Share on Facebook
Reply With Quote

  #4   Ban this user!
Old 05-06-2005, 06:34 PM
 
Join Date: Nov 2004
Location: USA
Age: 50
Posts: 446
murphy625 is on a distinguished road

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
Tweet this Post!Share on Facebook
Reply With Quote

  #5   Ban this user!
Old 05-06-2005, 07:01 PM
Karl_T's Avatar  
Join Date: Mar 2004
Location: Dassel,MN,USA
Posts: 1,308
Karl_T is on a distinguished road

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
Tweet this Post!Share on Facebook
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 05-06-2005, 08:35 PM
 
Join Date: Mar 2003
Location: USA
Posts: 332
keithorr is on a distinguished road

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.

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.
Tweet this Post!Share on Facebook
Reply With Quote

  #7   Ban this user!
Old 05-06-2005, 08:47 PM
 
Join Date: Nov 2004
Location: USA
Age: 50
Posts: 446
murphy625 is on a distinguished road

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
Tweet this Post!Share on Facebook
Reply With Quote

  #8   Ban this user!
Old 05-06-2005, 10:54 PM
 
Join Date: Mar 2003
Location: USA
Posts: 332
keithorr is on a distinguished road
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.
Tweet this Post!Share on Facebook
Reply With Quote

  #9   Ban this user!
Old 05-07-2005, 07:52 AM
 
Join Date: Nov 2004
Location: USA
Age: 50
Posts: 446
murphy625 is on a distinguished road

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
Tweet this Post!Share on Facebook
Reply With Quote

  #10   Ban this user!
Old 05-07-2005, 08:01 AM
 
Join Date: Nov 2004
Location: USA
Age: 50
Posts: 446
murphy625 is on a distinguished road

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
Tweet this Post!Share on Facebook
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 05-07-2005, 08:40 AM
Karl_T's Avatar  
Join Date: Mar 2004
Location: Dassel,MN,USA
Posts: 1,308
Karl_T is on a distinguished road

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
Tweet this Post!Share on Facebook
Reply With Quote

  #12   Ban this user!
Old 05-07-2005, 08:50 AM
 
Join Date: Nov 2004
Location: USA
Age: 50
Posts: 446
murphy625 is on a distinguished road

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
Tweet this Post!Share on Facebook
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -5. The time now is 07:58 AM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353