HELP: Make pin1 high if pin15 is high

More
10 Apr 2011 12:17 - 12 Apr 2011 11:23 #8743 by JohnoInc
Hello,

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
Last edit: 12 Apr 2011 11:23 by JohnoInc.

Please Log in or Create an account to join the conversation.

More
11 Apr 2011 13:38 #8761 by andypugh
What current will the lamp take?

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.

More
12 Apr 2011 04:04 #8787 by JohnoInc
pin 15 is a input NOT a output.

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.

More
12 Apr 2011 07:49 #8789 by JohnoInc
ok here is the design i need.

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.

More
12 Apr 2011 09:28 #8790 by andypugh
JohnoInc wrote:

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.

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)

Yes, that should be possible, but that is electronics external to EMC2.

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.

More
12 Apr 2011 11:21 #8795 by JohnoInc
How would i write code to enable highs and lows depended upon status of pin15

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.

More
12 Apr 2011 11:44 #8797 by andypugh
If you also have a high on pin 15 triggering e-stop, then the code I first posted (but with the last line changed to parport.0.pin-01-out ) ought to work.

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.

More
12 Apr 2011 14:08 #8802 by andypugh
JohnoInc wrote:

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 pointless-loopback parport.0.pin-15-in => parport.0.pin-01-out

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.

More
13 Apr 2011 07:46 #8826 by JohnoInc
hello all.... this may seem silly to some, but for my hardware set up it is not silly it is required.

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.

More
13 Apr 2011 09:27 #8831 by andypugh
JohnoInc wrote:

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.

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.

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]
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
Or (if you prefer for any reason)
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.

Time to create page: 0.371 seconds
Powered by Kunena Forum