HELP: Make pin1 high if pin15 is high
i have on pin 15 my estop switch. when i push the locking button it closes the circuit and puts the entire machine into estop state.
i want to add a relay (or similar) to make this switch also turn on a flashing light (12Vdc).
any advice or help greatly appreciated.
HARDWARE:
Probotix FireBall V90
SOFTWARE:
EMC 2.3.3
Please Log in or Create an account to join the conversation.
The ULN2008 chip is an easy way to control higher voltages with a parallel port (consider it as a logic-controlled switch-to-earth and it makes more sense) but it can only handle 500mA or so.
To flash the light you could use a pwmgen component set to 1hz and 50%.
loadrt pwmgen output_type=0
addf pwmgen.update servo-thread
addf pwmgen.make-pulses servo-thread #Normally in base-thread, but this is so slow..
setp pwmgen.0.pwm-freq 1
setp pwmgen.0.value 0.5
net flash-the-light halui.estop.is-activated => pwmgen.0.enable
net flashy-ouptput-pin pwmgen.0.pwm => parport.0.pin-15-out
(I have got this far, and just realised I have answered the wrong question.. Pin 15 isn't an output, is it?
Please Log in or Create an account to join the conversation.
the way you have replied seems to me that i need to do this on a output?
is there a way i could hook a transistor up, so when there is 5Vdc on the output it makes the emitter and collector flow, which will connect the power to the relay making it switch to the nc or no (depending how it is set up)
Please Log in or Create an account to join the conversation.
estop on pin15 input.
when estop is active i want a high on pin1 output.
when estop is not active i want a low on pin1 output.
i will interface pin1 output with a transistor which will act like a relay for my needs. all i need is how to write the code, i just can't get my head around how to.
all help welcomed!
Please Log in or Create an account to join the conversation.
pin 15 is a input NOT a output.[/quote[Yes, I realised that when I got to the end of my post, but thought that what I had written might be interesting anyway.
Yes, that should be possible, but that is electronics external to EMC2.is there a way i could hook a transistor up, so when there is 5Vdc on the output it makes the emitter and collector flow, which will connect the power to the relay making it switch to the nc or no (depending how it is set up)
One important point, don't rely on EMC2 for your e-stop. Your e-stop should cut power outside of software control. The e-stop input pin should be to tell EMC2 that E-stop is active, not to instruct the software to E-Stop.
Please Log in or Create an account to join the conversation.
switch on pin15 input.
when switch is active (high) i want a high on pin1 output.
when switch is not active (low) i want a low on pin1 output.
just the code to do this would be great, thank you for help
Please Log in or Create an account to join the conversation.
This assumes no existing spindle PWM outputs.
Do you want a steady signal to pin 1, or the flashing one I coded earlier?
If you just want to echo pin 15 onto pin 1, and assuming that pin 15 is currently an e-stop input then
net e-stop parport.0.pin-15-in => parport.0.pin-01-out
net e-stop2 parport.0.pin-15-in-not => iocontrol.0.emc-enable-in
Will set pin1 high when 15 is high, and set e-stop low. If you want to drive pin 1 low on estop then
net e-stop parport.0.pin-15-in-not => parport.0.pin-01-out iocontrol.0.emc-enable-in
Will work.
However, it doesn't really make much sense to just echo one pin to another, as you have noted it might as well be done in the hardware.
Please Log in or Create an account to join the conversation.
net pointless-loopback parport.0.pin-15-in => parport.0.pin-01-outswitch on pin15 input.
when switch is active (high) i want a high on pin1 output.
when switch is not active (low) i want a low on pin1 output.
As you might be able to tell from my choice of signal name, I really don't see the point, it just seems like a waste of a pin.
Please Log in or Create an account to join the conversation.
i am confused on all of the coding now, due to prior posts. i do not want to know about flashing lights or flicking highs and lows. just read Q1 and Q2 and answer for those
i want to know the code (please write it ALL instead of referring to other posts) for the following situations, as to i am now more confused. i am reading the Integrators manual, but still haven't got it to sink in.
Q1)
switch on pin15 input.
when switch is active (high) i want a high on pin1 output.
when switch is not active (low) i want a low on pin1 output.
(please give full code)
Q2)
switch on pin15 input.
when switch is active (high) i want a LOW on pin1 output.
when switch is not active (low) i want a HIGH on pin1 output.
(please give full code)
as you can see there are 2 functions i need to work out, they are reverse of each other. If anyone knows how to do this, please give full coding for each of the 2 questions. once i get the working code, i will hook up the hardware and then get a video of it working so you can see why i need this arrangement.
Once again, thank you to all those that have helped me so far, and thank you to those who will reply.
Please Log in or Create an account to join the conversation.
i am reading the Integrators manual, but still haven't got it to sink in.
Also have a look at linuxcnc.org/docs/html/hal_basic_hal.html
What isn't actually mentioned there is what the Realtime layer does.
Every Servo period it reads the inputs of each function that is linked to the servo thread, runs the function, and sets the outputs. It runs the functions in the same order as they are "addf"-ed to the thread. The same happens in the base-thread, but at a much faster rate. Base-thread functions can only do simple integer calculations.
Assuming that the parallel port is loaded and parallel port read/write are added to a thread, also that the realtime threads are loaded and running. [1]switch on pin15 input.
when switch is active (high) i want a high on pin1 output.
when switch is not active (low) i want a low on pin1 output.
net simple-loopback parport.0.pin-15-in => parport.0.pin-01-out
switch on pin15 input.
when switch is active (high) i want a LOW on pin1 output.
when switch is not active (low) i want a HIGH on pin1 output.
net inverted-loopback parport.0.pin-15-in-not => parport.0.pin-01-out
net simple-loopback parport.0.pin-15-in => parport.0.pin-01-out
setp parport.0.pin-15-out-invert 1
[1] This will be the case if you are editing an existing config created by stepconf, and have EMC2 running. If you are starting from scratch with a HAL file only and no GUI then you would use halrun. Typing the following at the command prompt without EMC2 running would give you the behaviour you describe in Q2, but nothing else. Can you describe your actual requirements a little more clearly?
halrun
loadrt hal_parport cfg="0 out"
loadrt threads name1=base-thread period1=500000
addf parport.0.read base-thread
addf parport.0.write base-thread
net inverted-loopback parport.0.pin-15-in-not => parport.0.pin-01-out
start
Please Log in or Create an account to join the conversation.