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 12-13-2005, 03:00 PM
 
Join Date: Sep 2005
Location: usa
Posts: 67
howling60 is on a distinguished road
anyone ever have issues with waituntil commands?

I am just wondering...as i seem to run into issues once in a while.

my situation is this... I will have some input, say input #30 that i am waiting on a status change to 1 before my routine progresses. To do this my code looks like this

IF #30<>1 THEN WAITUNTIL #30=1
rest of routine...

Perhaps I am following an odd line of logic, but I would expect that this code should look @ the status of input #30, and if it is not 1... the code should hold in this state, until #30 goes high, and then drop down through to the rest of the code. This does not seem to happen for me in real life however. My experience so far has been that I must put in a sleep command after the if/then, and prior to the waituntil.. otherwise, the code essentially ignores the waituntil, and goes off on it's merry way, leaving behind a wake of destruction.

I had originally written my routines using if/then loops, only to find that the control would hang upon entering the loop. So, that is out..

If anybody could shed some light/insight on this, i would really appreciate it.. as this has been bugging me for a while.
As always, Thanks in Advance!

-nate
Reply With Quote

  #2   Ban this user!
Old 12-13-2005, 04:47 PM
 
Join Date: Apr 2003
Location: United States
Posts: 279
camsoft is on a distinguished road

Make yourself a Logfile.Fil file and follow it through. If you still help send it to us with the note you wrote here.

Tech Support
CamSoft Corp.
(951) 674-8100
support@camsoftcorp.com
www.cnccontrols.com
__________________
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
Reply With Quote

  #3  
Old 12-13-2005, 05:48 PM
HuFlungDung's Avatar
Moderator
 
Join Date: Mar 2003
Location: Canada
Posts: 4,825
HuFlungDung is on a distinguished road

How long is too long to wait? I suppose that maybe your logic needs something to do while it waits and checks....just a wild guess. WaitUntil MIGHT suspend processing so it might not properly see the input change state.

Inputs can only be 0 or 1, so you could better define the conditions:
:STARTLOOP
IF #30=1 THEN GOTO :CONTINUE
IF #30=0 THEN SLEEP .1
GOTO :STARTLOOP
:CONTINUE
__________________
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)
Reply With Quote

  #4   Ban this user!
Old 12-13-2005, 06:32 PM
 
Join Date: Mar 2004
Location: United States
Posts: 36
intrusion is on a distinguished road

Modified version of what HuFlung stated. Just a bit quicker to execute

:STARTLOOP
IF #30=1 THEN GOTO :CONTINUE
GOTO :STARTLOOP
:CONTINUE

Note, however the above could be an endless loop if the input never changes state to a value of 1, bad switch ect....

Also try this
IF#30=0THENWAITUNTIL#30=1
Basically remove the <> and replace with =0, however <> should be valid.

The LOGFILE CamSoft suggested would be the best route to figure this out in any case.
Reply With Quote

  #5  
Old 12-13-2005, 07:56 PM
HuFlungDung's Avatar
Moderator
 
Join Date: Mar 2003
Location: Canada
Posts: 4,825
HuFlungDung is on a distinguished road

Another question which may be relevant is how long does #30=1 ? Is it only an instant and then its back to zero?
__________________
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)
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 12-14-2005, 07:38 AM
 
Join Date: Sep 2005
Location: usa
Posts: 67
howling60 is on a distinguished road

first off, i want to say thanks to everyone for checking this & tossing out some ideas

i have made logfiles to try and figure this out, and far as i remember (it has been a while as my attention has been on other things), the controller looked @ the input, saw the waituntil.. and ignored it, moving on to other logic.

HuFlung: I had tried versions of what you are suggesting, however... that seemed to drop the controller into a nasty little logic loop, from which it could never escape.. caused even more problems. It was actually upon Camsoft's reccomendation that i removed the If/Then loops in *favor* of the waituntil command. I was also thinking that the waituntil might be holding up the system, so that it could not see the input status change, however the control is not hanging, it is just ignoring. Currently i have a sleep of 2 seconds in the routine to help it "see" the change with the waituntil.

Intrusion:
see note above in reference to logic loop
Also try this
IF#30=0THENWAITUNTIL#30=1
Basically remove the <> and replace with =0, however <> should be valid.

been there, tried that.. both with the <> and =0 both options work fine, if the delay between the initial check, and the input status change is short. however, i'm working with a machine that doesn't like to be rushed.. she takes her sweet time, which is where i run into the issues of waituntil being ignored

As for the input being a rapid change: It is actually on a zero speed line for my spindle that i am currently seeing the problem. The spindle is commanded to stop, and then the routine should wait until the zero speed goes high, then an orient is performed (camsoft only gets a spindle ramping & zero speed for reference, no encoder feedback). This time around, the problem caused me to blow out the orient plunger, as the spindle was still turning 1k when the plunger fired .

in any case.. i will go and monkey around with stuff, and see what i can see. I saw a similar issue posted a while ago, regarding a waituntil stop command, where the solution seemed to be a series of waituntil stop: waituntil stop heck.. i'll put in 10 of them if it means not blowing out any more parts.

I would like to know why this seems to be an issue however. Camsoft, does the waituntil command "hang" the system in any way, that might cause it to possibly do funky things? I know it is stated that the waitauxio command will ignore all other io changes...

anywho, thanks everyone!

-nate
Reply With Quote

  #7  
Old 12-14-2005, 07:54 AM
HuFlungDung's Avatar
Moderator
 
Join Date: Mar 2003
Location: Canada
Posts: 4,825
HuFlungDung is on a distinguished road

Are other motors possibly in motion, or nearly finished their motion when this logic is being applied? I'm just wondering if such were to happen, that an incomplete movement may hang your system, and it comes out looking like the error is at this input?

So this zero speed signal, is it an actual switch, or some kind of hi/lo state, where lo does not quite equal zero? If the loop hangs indefinitely when properly written, it sounds as though there is not a clear indication of #30 going to zero. Try wiring a simple toggle switch into that input circuit, use the WAITUNTIL or equivalent loop and see if it works more reliably when the circuit actually is broken. If it works consistently, you might need a small relay operated by the #30 and then use the relay contacts as your actual input line.
__________________
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)
Reply With Quote

  #8   Ban this user!
Old 12-14-2005, 09:17 AM
 
Join Date: Sep 2005
Location: usa
Posts: 67
howling60 is on a distinguished road

it's a high/lo output on the spindle drive, which then throws an opto-relay. So i'm pretty sure it knows if/when it's at 1 and 0.. i'll run it again once my orient plunger is repaired, with a logfile, as i cna't power up the machine w/out my hydros right now

the issue however isn't with the system hanging, it's with the system seeming to ignore the waituntil command, the exact opposite of hanging.. just running through instead. I dunno.. it's got me stumped.. perhaps another vacation from the machine is in order so i can come back with a clear head again

-nate
Reply With Quote

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

Nate,

I had a problem like yours. I forgot exactly what the problem was but it had to do with an input and my program code not executing correctly because of it. I think mine was a looping problem...
Anyhow, try breaking it down to the absolute basics and running it manually. Run a couple wires to your desk and keyboard from that switch that is supposed to trigger the waituntil command. Unload your entire setup and create a brand new interface / codes with nothing but that input and start testing it.
There was one time I found that the code I wrote was fine but my switch was wired NC instead of NO.. It was a simple fix..

I use plenty of WaitUntil commands and they seem to work perfectly in my application.

My point is this:
Get rid of all other things physically and programmatically so that you are working with nothing but a switch, a piece of code, and a few wires. One you do this, finding the problem should be a much easier task. The fact that you say the program seems to ignore the Waituntil tells me that there is something "physical" in nature that is going on.. I could be wrong.. I'm a newbie myself but what I have learned is that when camsoft says it should work, it should work.. If it doesn't, its usually my own fault with a crossed wire, a bad switch, bad optical relay, or some other stupid thing that makes me feel like an idiot when I find it...
The one trouble shooting procedure I have learned to follow is to remove all other accessories, code, switches, I/O's, etc etc and do my testing with only the most basic requirements. It takes a bit of effort to unload my CBK file and create a new one, disconnect other wires from the IO boards, etc,, but it has proved to save me time in the long run when nothing else seems to work.
The old famous quote applies:
"When you have eliminated all other possibilities, what is left must be the answer"

Hope this helps.
Murphy
Reply With Quote

  #10   Ban this user!
Old 12-14-2005, 11:12 AM
 
Join Date: Apr 2003
Location: United States
Posts: 279
camsoft is on a distinguished road

Nate,

After reading what you just wrote, we believe we got this figured out. We haven't seen the Logfile.fil yet to confirm this but it does seem obvious.

First we can answer and explain a few of the known items that were brought up.

(1) The logic is Boolean. The values will either be 0 or 1.
Using the statement <> 1 or =0 is the same for I/O


(2) When one command is more appropriate than another depends on many strategies, but in general use.
WAITUNTIL is a tight method for focusing on a certain event
WAITAUXIO is a very tight method for fast reaction to I/O on auxiliary I/O boards
IF THEN is best for freeing up more computer resources to process other logic files running in the background.

WAITUNTIL is the best method in this case.


(3) No need for multiple WAITUNTIL commands in a row to check for the same I/O state. Unless you where waiting to hit the switch (1) and then wait to come off the switch (0).

(4) No need to use IF THEN for WAITUNTIL
Example: IF #30<>1 THEN WAITUNTIL #30=1
The WAITUNTIL command all by itself without IF THEN will work.
If #30<>1 then WAITUNTIL would wait until is did anyways.
If #30 did equal 1 then WAITUNTIL will pass on by anyways.


(5) The logic must be passing by the whole line, NOT ignoring WAITUNTIL.
IF #30<>1 THEN WAITUNTIL #30=1
It's not that the IF THEN is true and then it ignores the WAITUNTIL. It is passing by the IF THEN because at that time it is a false statement and doesn't ever execute the WAITUNTIL

(6) Here's what is most likely happening.
#30 must be a switch you're waiting on after doing some logic above this in the file. The physical switches on the machine need time to engage or disengage but the logic for checking I/O runs at compiled speeds. A slight delay is needed to allow the physical switch or pin to engage. As you mentioned the machine is heavy and slow as compared to the speed at which the computer can process and check on switch a moment is required before it checks.

Whatever event before this that executes the next step which in this case is #30=1 has flown by the logic by the time it gets there. What we are saying is that I/O #30 is already 1 at this point.

Here is the cleanest way to write this:

SLEEP 2
WAITUNTIL #30=1


Tech Support
CamSoft Corp.
(951) 674-8100
support@camsoftcorp.com
www.cnccontrols.com
__________________
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 12-15-2005, 07:28 AM
 
Join Date: Sep 2005
Location: usa
Posts: 67
howling60 is on a distinguished road

camsoft:
hhmm I do see what you are saying, and i agree with the diagnosis that I am indeed dealing with a large & slow machine, which cannot physically react nearly as fast as the software can. At the same time however (and once i can power the machine up again i will test this) input #30, is on my zero speed for the spindle. This consistantly, and reliably only goes high when the spindle motor is essentially stopped (below 3 rpm). When i am decelling from a 1200 rpm spindle rate, to a full stop. I am looking at a time span on the order of 4-5 seconds before that line can have a chance of being driven high, signifying that the spindle has stopped turning.

If input #30 had gone high, and the code blew by it, i would be happy as a clam, as it would signify that the spindle was no longer turning, but i can't see how that input would have gone high prematurely.

I will check back in after i have had a chance to make up another testing routine/logfile for this, but it'll be a few days as we must make the new orient plunger before i can power anything up again.

As usual, thanks for all the ideas/suggestions/help everyone, it is most appreciated.

-nate
Reply With Quote

  #12   Ban this user!
Old 12-15-2005, 11:57 AM
 
Join Date: Mar 2003
Location: USA
Posts: 332
keithorr is on a distinguished road

Is your input device stable? I was getting false "high" on my input until I started using an isolated power supply for the input common.
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 01:36 PM.





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 354 355 356 357 358 359 360 361