Andy Holcomb wrote:
> How would I implement this? To be more specific which pin on the LPT 
> port would I attach the  wire to?

Any pin that is an input and isn't already in use.

> Would I need to have the other leg of 
> the switch tied to ground or 5 volts? 

EIther one.  If you tie the other end of the switch to +5, then
closing the switch will pull the parport pin high.  You need
something else to pull it low when the switch is open.  If you tie
the other end of the switch to ground, then closing it will pull
the parport pin low.  Since A) many parports already have pullups,
and B) there isn't a convenient source of +5 on the parport, its
usually easier to hook a switch between the parport pin and ground.

The above is NOT an EMC specific issue.  How to hook a button to a
parport is basic fundamental knowledge for using a PC to control
anything.  This information is on the web - for example
http://www.epanorama.net/circuits/parallel_output.html
Inputs are addressed in the section "Input Circuits" about 3/4 of
the way down the page.  Electrically, connecting a pushbutton or
toggle switch is no different than connecting a limit or home switch.

> In which config file will I need 
> to set this up

In your HAL file.  You have a choice - you can add custom HAL
stuff to your existing file (I assume that is a copy of one of
the sample configs) or you can put your stuff in another file
and invoke it from the ini file.

> and how would I do that?

Lots of possibilities.  You could get fancy and use classicladder
to make a latching pushbutton (push button A to pause, button B
to resume).  You could do the same thing with the HAL flipflop
component (simpler - see "man flipflop").  You could use a toggle
switch instead of a pushbutton - that means no latching is needed
at all.

A couple of detailed examples:

1) You are using a toggle switch, and wired it to pin 10 of the
parport.  The switch is wired from pin 10 to ground, then when
you flip it ON, pin 10 goes low.  Add this to your hal file:

# when external PAUSE switch is on (input low), pause the
# machine using feedhold input
net feedhold parport.0.pin-10-in-not motion.feed-hold

2) You have two buttons. PAUSE is connected to parport pin 10,
and RESUME is connected to parport pin 11.  Both are active low
(pressing the button makes the pin on the parport go low).
Use a flipflop to do the latching:

# need a flip-flop to latch the state of feedhold
loadrt flipflop count=1
addf flipflop.0 servo-thread
# connect the flipflop output to the motion controller
# so motion will stop when the flipflop is set TRUE
net feedhold flipflop.0.out motion.feed-hold
# the PAUSE button should set the flipflop
net pause-button parport.0.pin-10-in-not flipflop.0.set
# and the RESUME button should reset it
net resume-button parport.0.pin-11-in-not flipflop.0.reset

I sincerely hope you do NOT just copy these examples and
use them.  To get the most out of EMC and HAL, you should
understand what it is doing.  The HAL code above is not very
complicated, and it is commented.  If you read it and
understand it, you have taken the first step from "machine
user" to "machine builder".  If you aren't willing to take
that step, then you are stuck using the stock configuration.

The EMC2 Integrator Manual is the "bible" for machine builders.
http://www.linuxcnc.org/docs/2.1/EMC2_Integrator_Manual.pdf

Regards,

John Kasunich


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to