Home Page with Town List
Topics Topics Help/Instructions Help Edit Profile Profile Member List Register  
Search Last 1 | 3 | 7 Days Search Search Tree View Tree View  
This forum was closed 18 May '07 and transferred to here. The user database was not transferred - sorry, but you will have to register again.

Forum * Human Interface Devices (HID's) * Programming a simple push-button control station for ShopBot < Previous Next >

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

Mike John
Registered
Username: Mikejohn

Post Number: 68
Registered: 12-2005
Posted on Friday, September 08, 2006 - 02:24 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Gerald
can you point me to the thread about 4 button 'Van' control boxes?
Can't find it :-(
Found a picture of Van and the 4 buttons though!!

...........Mike
Top of pagePrevious messageNext messageBottom of page Link to this message

Gerald_D
Registered
Username: Gerald_d

Post Number: 237
Registered: 11-2005
Posted on Friday, September 08, 2006 - 05:15 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

That thread was at the SB forum, but it is missing now? A case-sensitive, whole word search on Van doesn't do it for me?
Top of pagePrevious messageNext messageBottom of page Link to this message

Mike John
Registered
Username: Mikejohn

Post Number: 69
Registered: 12-2005
Posted on Friday, September 08, 2006 - 06:31 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Any chance of posting what you came up with here?
I am looking to set up the files, set up the pallets, get a 'Van'iescu to keep it running for the day.

.....Mike
Top of pagePrevious messageNext messageBottom of page Link to this message

Gerald_D
Registered
Username: Gerald_d

Post Number: 238
Registered: 11-2005
Posted on Friday, September 08, 2006 - 06:46 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

One button box has 4-buttons, but the boxes at the ends of the gantry have 3-buttons:

1

1. E-Stop (Red)
2. Resume (green)
3. Pause (yellow)
4. Reserved for z-zero, but not figured out yet...
Top of pagePrevious messageNext messageBottom of page Link to this message

Gerald_D
Registered
Username: Gerald_d

Post Number: 239
Registered: 11-2005
Posted on Friday, September 08, 2006 - 07:24 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

There is a broken link to the missing thread here. Where did it go?....
Top of pagePrevious messageNext messageBottom of page Link to this message

Gerald_D
Registered
Username: Gerald_d

Post Number: 240
Registered: 11-2005
Posted on Friday, September 08, 2006 - 07:32 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Google's cache of it here
Top of pagePrevious messageNext messageBottom of page Link to this message

Mike John
Registered
Username: Mikejohn

Post Number: 70
Registered: 12-2005
Posted on Saturday, September 09, 2006 - 07:22 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Gerald
I read the cached file, and it (finally gets to the Vaniescu operator point!
Now all I need to know is, how do I do it?

I guess the button box has some sort of electronics (or does each button have its own which I guess is connected to the computer (or is it the control box, or both) and I see a need for some programming.
I can see the solution, I don't know how to get there. :-(


..........Mike
Top of pagePrevious messageNext messageBottom of page Link to this message

Dick van Randen
Registered
Username: Dvanr

Post Number: 12
Registered: 03-2006
Posted on Saturday, September 09, 2006 - 08:49 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Hi Mike

It is fairly straight forward. but it helps if you have an example to follow.

The ZZero routine is an example of program diversion when contact is made by the bit onto the zero plate.

Here is another short example . I have a red pushbutton mounted on my Zero plate that I push when I am good and ready. Skittering around the end of the machine from the computer was getting hazardous with all the dust on the floor.

'----------------------------------------------------------------THE PROGRAM
'Make First Plunge... the following line will display first and wait for key stroke

' *** Hit ENTER and then RED button on Plate when ready to Zero ***
PAUSE

LOOP:
ON INP(2,1) GOTO StartZero
GOTO LOOP


StartZero:
ON INP(2,1)

The very first line is where this example is pasted into the Zzero program. It will sit there all day looping until the button is pushed. Then it jumps out of the loop turns off the switch detection and continues on its way.

I think some of what you want to do can be developed without the hardware switch for now and once you have it working you can then add the switch detection.

What exactly do you want to do? Do you want a button for each pallet or does one button push do all the pallets?
Top of pagePrevious messageNext messageBottom of page Link to this message

Gerald_D
Registered
Username: Gerald_d

Post Number: 241
Registered: 11-2005
Posted on Saturday, September 09, 2006 - 09:50 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Mike, you have a good understanding of the connection of the z-zero plate - one wire is ground/earth, the other wire goes to an "input" point on the controller board. Touch the wires together and you have an input. The pushbuttons do exactly that. (There is no circuit inside those boxes)

It depends on how many spare inputs you have - 2 of them are probably occupied by the E-stop and the z-zero plate. You might only be able to fit 2 buttons to the 2 spare inputs?

Guys like Dick will help you program them for your ShopBot.

Be careful though....more switches mean more wires acting as antennae....your SB may end up cutting an ellipse every time your cellphone rings. :-)
Top of pagePrevious messageNext messageBottom of page Link to this message

Mike John
Registered
Username: Mikejohn

Post Number: 71
Registered: 12-2005
Posted on Saturday, September 09, 2006 - 10:33 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Gerald,
That makes it simple. In the missing Shopbot Forum thread you spoke of a breadboard, which I thought meant some kind of electronics, which confused me.
Dick.
I have 3 pallets with 15 'blanks fitted' that all cut, one after the other, from 1 file.
It is possible to start replacing blanks when the File has 3 blanks left to cut. You replace the first ten (left and centre pallets), the Shopbot stops at the end of the file, if the first pallet is replaced, then it is safe to start again. Normally both the first and second pallet are replaced when the Shopbot stops.
Now I can safely replace the third pallet.
What I want to do is this.
Do all the zeroing at the start of the day, set the program going, get it to pause at the end of the file.
At the press of a button (A) I want the file to restart again at the beginning (JH).
If Vaniescu needs to relieve himself I want him to be able to press a button (B) that pauses the Shopbot, and, on his return press button (A) and everything carries on from where it paused.
In the case of a minor problem, Vaniescu presses 'Pause' (button 'B') and calls for Mike.
In case of a big problems he whacks the existing E-stop and screams for Mike.

At the start of the next day we repeat the cycle.

I understand most of your little program.
I think ON INP(2,1) means when input 2 is closed then carry out the GOTO.
What I dont understand is the ON INP(2,1) instruction after the GOTO. Here I expect to find the first line (or next line) of the Z zero routing.
mind you BASIC is a bit rusty!!

So, three buttons in input 2 - 3 - 4 as E-stop - pause - restart.
I can see how, at the end of the, file I can loop until the restart button is pressed, and how the GOTO will be an instruction to re-start the file.
I dont know how to program the 'Pause' button, which can happen anytime within a file, and then how to tell the restart to now go to the next line.

Thanks for your help.

............Mike
Top of pagePrevious messageNext messageBottom of page Link to this message

Dick van Randen
Registered
Username: Dvanr

Post Number: 13
Registered: 03-2006
Posted on Saturday, September 09, 2006 - 03:00 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

OK, some can be done as you want some you have to compromise.

Mostly it has to do with ON INP (on input) command.
ON INP is known as a hardware interrupt. That is a port or switch is constantly monitored and when it is activated a vector, which is known in Basic as a GOTO or GOSUB is executed.

ON INP(2,1) GOTO StartZero '<----Vector goto the StartZero: label

If there is no vector the interrupt is ignored.
ON INP(2,1) <----- No Vector , No where to go and nothing happens ie it is off

The problem with hardware interrupts is that they are great for repeating things , but a problem when you want to pause. They don't remember where they came from ( line number ) so there is no easy way of going back to the place PAUSE was pressed. I don't know of a way where you can pause, move to a safe spot and then resume from where the pause started.

The only port that pauses and allows you to resume is port 3 , the limit switch port. But it doesn't allow you to move anywhere safe.

Back to the Pause File interrupt on a different switch.

The best you can do is have the blanks cut in a loop , the blank iteration determines the starting point for that blank. In the program there is a PAUSE subroutine it grabs the number of COMPLETED blanks and moves to the safe zone. When PAUSE is pressed again it moves back to the START of the next piece ( even if it was 95% complete) and starts cutting again. No other way that I know of.

You have 3 pallets with 5 pieces each. A, B and C
You will need min two switchs port 2 (and port 4 ( 3 is used for limit switchs) port 2 For RESTARTING the Job from Pallet A and port 4 PAUSE/RESUME from anywhere in the three.

So far so good??
Top of pagePrevious messageNext messageBottom of page Link to this message

Mike John
Registered
Username: Mikejohn

Post Number: 73
Registered: 12-2005
Posted on Saturday, September 09, 2006 - 03:59 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Dick
The file I use looks a bit like this. (Although the numbers are incorrect here)

J3,39.794,39,5
FP,D:\blankA1,,,,,2
J2,39.794,107
FP,D:\blankA2,,,,,2
J2,39.794,175
FP,D:\blankA3,,,,,2
J2,39.794,243
FP,D:\blankA4,,,,,2
J2,39.794,311
FP,D:\blankA5,,,,,2
J3,157.397,39,5
FP,D:\blankB1,,,,,2
and so on, and so on

If, after each blank, I insert
J3,39.794,39,5
FP,D:\blankA1,,,,,2
LOOP:
ON INP(2,1) GOTO interupt
(I deliberately didn't use Pause)
GOTO LOOP
J2,39.794,107
FP,D:\blankA2,,,,,2
LOOP:
ON INP(2,1) GOTO StartZero
GOTO LOOP

interupt
Pause


Then a non-urgent pause will occur at the end of the blank that is being cut as the pause button is pressed.

Now I can restart by pushing the restart button.

Is this correct?

............Mike
Top of pagePrevious messageNext messageBottom of page Link to this message

Mike Richards
Registered
Username: Richards

Post Number: 35
Registered: 05-2006
Posted on Saturday, September 09, 2006 - 08:20 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Mike,
It seems to me that the program will continue with the first statement after the Pause command in the interrupt routine, NOT the next inline statement.

You might try something like this:

LOOP1:
&flag = 0
ON INP(2,1) GOSUB INTERRUPT
IF &flag = 0 THEN GOTO LOOP1

J2,39.794,107
FP,D:\blankA2,,,,,2

LOOP2:
&flag = 0
ON INP(2,1) GOSUB INTERRUPT
IF &flag = 0 THEN GOTO LOOP2

END

'-----------------------
' Interrupt routine
INTERRUPT:
Pause
&flag = 1
RETURN
Top of pagePrevious messageNext messageBottom of page Link to this message

Dick van Randen
Registered
Username: Dvanr

Post Number: 14
Registered: 03-2006
Posted on Sunday, September 10, 2006 - 01:41 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Mike J

What Mike R has given is pretty close to what you want. I would put the Loop at the front of the cut routine (Mike R's example) , instead of having it at the back, like you wanted. This is important so that a piece is completly cut when it returns from an INTERRUPT.

You haven't indicated where StartZero will be. If it is to start the whole sequence over again the label needs to be at the front of the program and the StartZero interrupt needs to be turned off once it has been used. You don't want to start all over when your in the middle of the last blank on pallet C. Don't forget that this is a hardware interrupt! Stop whatever you are doing and go and do this...now!

Good call on not using PAUSE it is a reserved word in basic and would have created problems.

In the INTERRUPT routine you could include the ability to move up and out of the way as well. Keeping in mind where your table's 0,0 is. Are you changing the 0,0 position each time to cut a new blank?

I would strongly suggest you use two switches , it could get confusing as to what might happen next if you push the same button to do different things. Also suggest a third switch as a lockout that needs to be pressed when one of the other two is chosen. This would ensure that the operator has both hands away from the work when the program resumes and also avoids accidental button presses.

I have seen systems where the lockout button is mounted on the other end of the board shoulder width apart and has safety cap that needs to be flipped open to press.

ButtonLayout
Top of pagePrevious messageNext messageBottom of page Link to this message

Mike John
Registered
Username: Mikejohn

Post Number: 74
Registered: 12-2005
Posted on Sunday, September 10, 2006 - 06:31 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Mike and Dick
Thanks a lot, it is now coming clear!
I see how you can put port 2 (or 4) into the 'ON' (1?) position by closing (and keeping closed) the port button with the lockout button. I assume from Dicks' safety idea that, in fact, these would be push buttons that go off when released.
I assume, therefore, that it must be possible to, somehow, change a variable (from 0 to 1 say), and use this to trigger the innterupt at the end of that blank.
Then, after the restart, the variable would be changed back to 0.
So the program has to continually check for this input, then change the variable.
How do I do that?

As all this is going on within the Shopbot program, can I assume it wont introduce any problems, as widows programs working in the background might?
I use DOS at the moment. Could I continue using DOS with these routines?
I have a computer lying idle that could be used for a Windows system, I am just reluctant to change, on the principal :If it 'aint broken,don't change it!'
edited to add

would this work?
&check=0
LOOP1:
&flag = 0
ON INP(2,1) LET &check=1
IF &check=1 GOSUB INTERRUPT

IF &flag = 0 THEN GOTO LOOP1

J2,39.794,107
FP,D:\blankA2,,,,,2

&check=0
LOOP1:
&flag = 0
ON INP(2,1) LET &check=1
IF &check=1 GOSUB INTERRUPT

IF &flag = 0 THEN GOTO LOOP1

END

'-----------------------
' Interrupt routine
INTERRUPT:
Pause
&flag = 1
RETURN

...............Mike
Top of pagePrevious messageNext messageBottom of page Link to this message

Mike John
Registered
Username: Mikejohn

Post Number: 76
Registered: 12-2005
Posted on Sunday, September 10, 2006 - 06:56 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

OK
I can see why that won't work!
I need to set the &check variable at any time during the cutting.
I could do this by introducing that line in between every line in the main cutting program, but this seems somewhat impractical!
and I see I should clear that variable in the interupt routine!
BASIC slowly returning to the surface! Us Grandads still have it!!

.........Mike
Top of pagePrevious messageNext messageBottom of page Link to this message

Mike John
Registered
Username: Mikejohn

Post Number: 77
Registered: 12-2005
Posted on Sunday, September 10, 2006 - 07:21 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

As you can see, I am playing with this, re-thinking as I go along.
The above suggestions, it seems to me, will simply carry on looping between blanks, not going onto the next blank, until the interupt routine is carried out.
What is needed is something that checks, before each blank, to see if the button has been pressed.
If it has not, it simply continues to the next blank.
If the button has been pressed, it carries out the interupt routine until the resume button is pressed.

So, if pressing the button anywhere during the program can change &check from 0 to 1 anywhere during the file, then
IF &check=1 GOSUB INTERRUPT
is the only line needed between blanks.
Is this correct?
How do I get the computer to change the state of &check at any time during the running of the file?

.......Mike
Top of pagePrevious messageNext messageBottom of page Link to this message

Mike Richards
Registered
Username: Richards

Post Number: 36
Registered: 05-2006
Posted on Sunday, September 10, 2006 - 08:00 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Mike,
Sometimes it helps to NOT think in computer terms. Think in terms of everyday objects, like road construction people who raise and lower flags, depending on whether or not they want traffic to stop. Like a flagman, a button can either raise (set) or lower (clear) a flag. Or one button can raise one flag and lower another.

So in your example, you would first lower (clear) the flag variables. Until a button is pushed, the flag variables would stay cleared. As you approach each blank, you would check to see if the flag was raised (1) or lowered (0). If the flag was lowered (0), you would cut the blank. If the flag was raised, you would GOSUB a subroutine that just looped until you pressed another button. When you pressed that button, the flag would be cleared and you would return from the subroutine to the place in the program where the subroutine was called and continue cutting.

The command:

ON INPUT( port, state) GOSUB some_subroutine

is just the same as a foreman telling a flagman that when the flagman sees a construction vehicle within a certain distance, the flagman is to raise his flag to stop traffic until the construction vehicle travels to another point on the road. By issuing an ON INPUT(port,state) command, you're just telling the computer that when you push a button, you want the computer to recognize that you've pushed the button and then do something out of the ordinary until you push another button.
Top of pagePrevious messageNext messageBottom of page Link to this message

Dick van Randen
Registered
Username: Dvanr

Post Number: 15
Registered: 03-2006
Posted on Sunday, September 10, 2006 - 01:03 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

I see how you can put port 2 (or 4) into the 'ON' (1?) position by closing (and keeping closed)
the port button with the lockout button. I assume from Dicks' safety idea that, in fact, these would be push buttons that go off when released.
I assume, therefore, that it must be possible to, somehow, change a variable (from 0 to 1 say), and use this to trigger the interrupt at the end of that blank.
Then, after the restart, the variable would be changed back to 0.
So the program has to continually check for this input, then change the variable.
How do I do that?


Not entirely true.

Think of ON INP as equivalent of the word "FIRE!"
It doesn't matter what you are doing or what time it is when you hear that word you do two things, STOP what you are doing and do something else NOW!
There is nothing to check at the end of a blank being cut. If you hit Pause and invoke the INTERRUPT the bit will stop dead in its tracks and wait for the program to tell it what to do next.

The push buttons are momentary , you just press them once and let go , you don't have to hang on to them. In fact if you invoke the statement ON INP (2,1) then the buttons are ignored. If you didn't do that and you hung onto the buttons the
program would continually revisit the ON INP line.

here is an example

ON INP (4,1) GOSUB INTERRUPT ' set port 4 switch to goto INTERRUPT label

3,39.794,39,5
FP,D:\blankA1,,,,,2

END

'Subroutines

INTERRUPT:
LOOP:

ON INP(2,1) GOTO RESUME

GOTO LOOP ' wait for the START/RESUME switch to be pressed Once it is pressed jump to the 'resume label and return from where the INTERRUPT was generated.

RESUME:
RETURN

If you hold the switchs down you will stay on the first line GOSUB INTERRUPT , if you let go the program will run , but if you press the buttons again it will haul the program back to GOSUB INTERRUPT. That is why it is important to turn off the ON INP. Keep in mind this is not a fast rule , there may be special cases where you want to keep it on.

To correct the problem you would put ON INP (4,1) right after the LOOP: label in the sub routine section.

Where would you put the statement ON INP (2,1) to turn off the resume interrupt after it had been used?
Top of pagePrevious messageNext messageBottom of page Link to this message

Dick van Randen
Registered
Username: Dvanr

Post Number: 16
Registered: 03-2006
Posted on Sunday, September 10, 2006 - 02:31 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

'Using Two pushbutton Switches Port 2 Start/Resume Port 4 Pause

STARTLOOP:
ON INP(2,1) GOTO CUTFILES 'Wait here for the Start/Resume button to be pressed
GOTO STARTLOOP

CUTFILES:

ON INP (2,1) 'Turn the Start interrupt off
SO 1,1 'Make sure the router is on

ON INP(4,1) GOSUB PAUSE_FILE 'turn Pause_file on
J3,39.794,39,5
FP,D:\blankA1,,,,,2

ON INP(4,1) GOSUB PAUSE_FILE
'this needs to be done at each blank in order to update where the interrupt came from
J2,39.794,107
FP,D:\blankA2,,,,,2

ON INP(4,1) GOSUB PAUSE_FILE
J2,39.794,175
FP,D:\blankA3,,,,,2

ON INP(4,1) GOSUB PAUSE_FILE
J2,39.794,243
FP,D:\blankA4,,,,,2

ON INP(4,1) GOSUB PAUSE_FILE
J2,39.794,311
FP,D:\blankA5,,,,,2

ON INP(4,1) GOSUB PAUSE_FILE
J3,157.397,39,5
FP,D:\blankB1,,,,,2
'and so on, and so on

'when you get past so on and so and actually finish

GOSUB PAUSE_FILE

GOTO CUTFILES: 'Start the whole thing over again

END
'SubRoutines****************************

PAUSE_FILE:
ON INP(4,1) 'Turn gosub pause_file off but doesn't loose where to RETURN too.
JZ 2.0 'inches use 50 for metric
SO 1, 0 'turn the router off
Pause 2 'let the router run down
J2 &safeX,&safeY

RESUMELOOP:
ON INP (2,1) GOTO RESUME
GOTO RESUMELOOP 'wait for the Start/Resume key to be depressed, when pushed jump out and return

RESUME:
ON INP (2,1) 'turn off Start/Resume
RETURN ' go back to the ON INP that sent control to PAUSE_FILE

END ' just in case we get this far by accident

***********************

I think that is close to what you want to do. If you see yourself doing a bit of this , find a decent text editor. There are lots out there, even for DOS. I use one called Crimson Editor for Windows which I have colour coded to the Shopbot syntax. It makes reading , editing and troubleshooting that much easier. If you use the Crimson one I can post how to set up the syntax highlighting
Don't forget to use ' these in front of your comments so they don't become part of the code!
Top of pagePrevious messageNext messageBottom of page Link to this message

Dick van Randen
Registered
Username: Dvanr

Post Number: 17
Registered: 03-2006
Posted on Sunday, September 10, 2006 - 02:40 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Whoops! There are a couple of mistakes in the file.

The program will run (I think, I hope ) but two problems arise, one with the Pause key and the other with the Resume key.

Can you spot them?
Top of pagePrevious messageNext messageBottom of page Link to this message

Mike John
Registered
Username: Mikejohn

Post Number: 78
Registered: 12-2005
Posted on Monday, September 11, 2006 - 05:51 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Dick

I am having a problem fully understanding the concept. My fault, not your explanation.

With the following

ON INP(4,1) GOSUB PAUSE_FILE
J2,39.794,175
FP,D:\blankA3,,,,,2

does the PAUSE(4) button have to be pressed at the moment that line is reached.
What happens if the button is pressed during the running of the 'blankA3' file?
If I press the button twice, does it go from 0 to 1 and back to 0?
If the program recognises the PAUSE(4) button to having been pressed at any time during the running of 'blankA3', does it then activate the PAUSE at the end of that file, when it reaches the ON INP statement?
When it returns, does it go back to that ON INP statement, check for the button on/off, if off(0) does it then start cutting the next file?

Or does it stop at the moment the button is pressed, halfway through cutting the 'blankA3' file, and return to the ON INP at the start of 'blankA3'.re-cutting the start of the file again?
Either of those ways would work for me.
What wouldnt work, if it stops mid-file, is if the RETURN goes to the line in the 'blankA3' when the button was pushed.
If the next move had a negative Z, then the cutter would ramp into the material from the safe position.

I do appreciate your taking up time to give me these lessons. I taught my son, from age 8 to 12, how to program. Since then he has taught me!!
He is now 31, and a programming wiz kid in Sydney. Maybe you have met him? Tall with a lot of dark hair, looks a bit like me, no moustache.
Unfortunately, being in Sydney, he is not on hand to assist! :-)

...............Mike
Top of pagePrevious messageNext messageBottom of page Link to this message

Dick van Randen
Registered
Username: Dvanr

Post Number: 18
Registered: 03-2006
Posted on Monday, September 11, 2006 - 09:23 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Vantastic Programming 101


ON INP(4,1) GOSUB PAUSE_FILE
J2,39.794,175
FP,D:\blankA3,,,,,2

does the PAUSE(4) button have to be pressed at the moment that line is reached.


No. What the ON INP statement does is set up the action that will happen when the button is pressed . It comes into effect once the line has been processed and stays in effect EVERYWHERE in the program till you change it or turn it off. By the way each time ON_INP (4,1) GOSUB PAUSE_FILE is invoked a small change takes place . The action remains the same but where the program returns to gets changed.

What happens if the button is pressed during the running of the 'blankA3' file?

It will immediatly stop processing (cutting) the blank file, even if 99% complete and go to the last invoked ACTION for that button.

If I press the button twice, does it go from 0 to 1 and back to 0?

Actually I believe it is 1 to 0 and then 1 to 0 again you are pulling the port low. In any case two button pushes will interrupt the program twice . There is no harm done here , but it is good practice to turn off the button once it has gone into a loop and another ACTION needs to happen. However, in this case we should leave it on. More on this down the list.

If the program recognises the PAUSE(4) button to having been pressed at any time during the running of 'blankA3', does it then activate the PAUSE at the end of that file, when it reaches the ON INP statement?

No. It stops mid file and goes into the PAUSE_FILE loop. The ON_INP has to be turned on at the beginning of a program block if you want that switch monitored in the program block being executed. The BASIC interpreter reads and runs the program one line at a time in sequence.

When it returns, does it go back to that ON INP statement, check for the button on/off, if off(0) does it then start cutting the next file?

Good point. I don't believe it does . I turned it off in PAUSE_FILE. Here is a good example of leaving it on so that it is still active when it returns to cut the file over. The way it is written now it will ignore a key press on return from the Paused blank. Then it turns on again. (Geez Mike , your making me sweat, we have M R and G D looking over our shoulders)

Or does it stop at the moment the button is pressed, halfway through cutting the 'blankA3' file, and return to the ON INP at the start of 'blankA3'.re-cutting the start of the file again?

Yes, but as your prev question pointed out there is a glitch. The PAUSE button will not function during the recut.

Either of those ways would work for me.
What wouldnt work, if it stops mid-file, is if the RETURN goes to the line in the 'blankA3' when the button was pushed.
If the next move had a negative Z, then the cutter would ramp into the material from the safe position.


That won't happen. But even if it did there is away around that as well. It is all a matter of how much you like to type, circumvent the system and get into using SYS VAR ie %(1) and %(2) the X and Y locations at the time of the interrupt.

So Mike J what do you have so far as a program? As it sits mine doesn't work all that well.
Top of pagePrevious messageNext messageBottom of page Link to this message

Dick van Randen
Registered
Username: Dvanr

Post Number: 19
Registered: 03-2006
Posted on Monday, September 11, 2006 - 01:11 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Hey Mike,

Don't rush, take your time and write something and come back with it. If it with stands scrutiny you get to try it out and see if you pass. The proof is as they say "in the vanilla pudding"


D
Top of pagePrevious messageNext messageBottom of page Link to this message

Scott Worden
Registered
Username: Scott

Post Number: 5
Registered: 06-2006
Posted on Wednesday, September 13, 2006 - 05:23 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

I don't know if this helps or not, but you can also test the state of an input (such as 1,1 or 1,0) and stay in a loop like this.

WAITHERE:
&TEST=%(51)
IF &TEST=1 THEN GOTO REPEAT
PAUSE .2
GOTO WAITHERE

I use this with a momentary button to wait for me to change a blank and then continue. %51 is the state of input 1. I'm not sure what the other inputs are.
Top of pagePrevious messageNext messageBottom of page Link to this message

Dick van Randen
Registered
Username: Dvanr

Post Number: 20
Registered: 03-2006
Posted on Wednesday, September 13, 2006 - 11:49 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Hey Scott,

That's excellent ! The rest of the inputs are 2 - 8 respectively %52 to %58 .

What I really like about your idea is that multiple ports can be detected while still using the interrupt! Suddenly 7 inputs is no longer the limit.

Add Your Message Here
Post:
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action:

Topics | Last Day | Last Week | Tree View | Search | Help/Instructions | Program Credits Administration