TTL trigger output

More
26 Nov 2013 01:06 #41163 by gillinderglass
I would like to start a measuring device with a TTL trigger after a programmed move. Can I do that with an M code?

Thanks
Bart

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

More
26 Nov 2013 06:09 #41167 by emcPT
Replied by emcPT on topic TTL trigger output
The M code is a file located in the path defined in the ini.
Inside the M code you can define one or more output pins to turn on/off.
I hope that it is what you wanted.
The following user(s) said Thank You: gillinderglass

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

More
26 Nov 2013 15:47 #41174 by ArcEye
Replied by ArcEye on topic TTL trigger output

I would like to start a measuring device with a TTL trigger after a programmed move. Can I do that with an M code?


Depending upon how exactly youre going to trigger it, see the M codes, M62 through to M68

www.linuxcnc.org/docs/html/gcode/m-code.html#sec:M62-M65
www.linuxcnc.org/docs/html/gcode/m-code....ec:M67-Analog-Output
www.linuxcnc.org/docs/html/gcode/m-code....ec:M68-Analog-Output

regards
The following user(s) said Thank You: gillinderglass

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

More
21 Apr 2014 19:23 #46170 by gillinderglass
Replied by gillinderglass on topic TTL trigger output
I would like to send and receive TTL signals on my idle A axis.
This is what I think I should do, but I would really appreciate
guidance so I don't burn anything.

In standard_pinout.hal I have
net Astep => parport.0.pin-09-out
net Adir => parport.0.pin-08-out

Can I change that to
net Mstart => parport.0.pin-8-out
net Mdone <= parport.0.pin-9-in

And then in core_stepper.hal There is no mention of the A axis, so add
net Mstart motion.digital-out-00 => parport.0.pin8-out
net Mdone motion.digital-in-00 <= parport.0.pin9-in

And then in my G-Codes
m63 p0
g0 x1
m66 p0 l2 q999
g0 x2

Am I close?

Thank you,
Bart

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

More
22 Apr 2014 05:36 #46200 by andypugh
Replied by andypugh on topic TTL trigger output

Am I close?t

Better, I think you are all the way there.
The following user(s) said Thank You: gillinderglass

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

More
07 May 2014 23:45 #46694 by gillinderglass
Replied by gillinderglass on topic TTL trigger output
I followed the instructions in 2. Pause & Resume in http:/linuxcnc.org/docs/html/hal/halui_examples.html and got a signal on my output pin! I know that doesn't sound like much, but I put in a lot of time to get there. I don't understand the classic ladder instructions. Could somebody please tell me, in words that an idiot can understand, how to set up an EIC timer?

Thanks,
Bart

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

More
08 May 2014 05:55 #46701 by andypugh
Replied by andypugh on topic TTL trigger output
Going back to the previous question, you can't arbitrarily choose a parallel port pin to be input or output. You have to choose the pins from those that actually exist.
This is the list of pins for a single parport:
     6  bit   IN          FALSE  parport.0.pin-01-out
     6  bit   IN          FALSE  parport.0.pin-02-out
     6  bit   IN          FALSE  parport.0.pin-03-out
     6  bit   IN          FALSE  parport.0.pin-04-out
     6  bit   IN          FALSE  parport.0.pin-05-out
     6  bit   IN          FALSE  parport.0.pin-06-out
     6  bit   IN          FALSE  parport.0.pin-07-out
     6  bit   IN          FALSE  parport.0.pin-08-out
     6  bit   IN          FALSE  parport.0.pin-09-out
     6  bit   OUT         FALSE  parport.0.pin-10-in
     6  bit   OUT         FALSE  parport.0.pin-10-in-not
     6  bit   OUT         FALSE  parport.0.pin-11-in
     6  bit   OUT         FALSE  parport.0.pin-11-in-not
     6  bit   OUT         FALSE  parport.0.pin-12-in
     6  bit   OUT         FALSE  parport.0.pin-12-in-not
     6  bit   OUT         FALSE  parport.0.pin-13-in
     6  bit   OUT         FALSE  parport.0.pin-13-in-not
     6  bit   IN          FALSE  parport.0.pin-14-out
     6  bit   OUT         FALSE  parport.0.pin-15-in
     6  bit   OUT         FALSE  parport.0.pin-15-in-not
     6  bit   IN          FALSE  parport.0.pin-16-out
     6  bit   IN          FALSE  parport.0.pin-17-out

Note that all the numbers are two digits. The inputs have both an "in" and an "in-not". The "in-not" is purely for convenience when you need an active-low signal.
The output pins all have a parameter that allows their sense to be inverted.
It is possible to configure the parallel port in a mode more biased to inputs, in which case the pin-name list is different. The manual page explains:
www.linuxcnc.org/docs/html/hal/parallel_port.html

Could somebody please tell me, in words that an idiot can understand, how to set up an EIC timer?

I can try if you can reciprocate by explaining what an EIC timer is. (you might well not need Classic Ladder, I haven't used it yet, though I acknowledge its usefulness)
The following user(s) said Thank You: gillinderglass

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

More
08 May 2014 23:16 #46725 by gillinderglass
Replied by gillinderglass on topic TTL trigger output
Thank you for helping me out.

I changed my hal files to link signals to parport.0.pin-09-out and to parport.0.pin-10-in. The output signal does work. I don't know if the input works.

I tried to use M63 and M66 earlier, but the program didn't output a signal or pause and I gave up on that.

When I tried M0, I got a steady 3.3V signal out on pin9 which seems like progress to me, but it isn't quite good enough. The instructions for Pause and Resume say that the G-Codes won't resume until the output signal is turned off and a new signal comes in. Fix the timing problem by using ClassicLadder and a monostable timer to deliver a narrow output pulse and also to fix the input signal. I looked up monostable timers and I got the impression that they had been replaced by EIC timers. I looked at the instructions for EIC timers but couldn't comprehend anything.

I just want my machine to output a signal and pause until it gets a reply. I am really struggling with the manuals.

Regards,
Bart

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

More
09 May 2014 03:19 #46737 by andypugh
Replied by andypugh on topic TTL trigger output

I changed my hal files to link signals to parport.0.pin-09-out and to parport.0.pin-10-in. The output signal does work. I don't know if the input works.

I tried to use M63 and M66 earlier, but the program didn't output a signal or pause and I gave up on that.


You need to output the signal then wait on input. That would be G-code something like:

M64 P0 ; set output 0
M66 P0 L3 ; wait for input 0 to go high
M65 P0 ; reset output 0

But be aware that an unconnected input pin will float high and the code will drop straight through. It is often easiest to wire them to ground, so then you would use M66 P0 L4.

I don't see any reason to use CL to enforce a short pulse, the "oneshot" HAL component can do that:
www.linuxcnc.org/docs/html/man/man9/oneshot.9.html

The example that uses "program.is-paused" and "program.resume" is fairly neat compared to 3 lines of G-code. Ca you describe what you want to actually do and what the externally-connected hardware looks like?

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

More
09 May 2014 21:41 #46759 by gillinderglass
Replied by gillinderglass on topic TTL trigger output
This is a camera attached to rotary stages. The camera shoots
at every position. The shutter speed varies from 1 to 60 seconds.
The camera can start on a ttl signal and signal when it
is finished. It moves and shoots once a minute now, but I want to
eliminate the slack time.

I used the example that uses "program.is-paused" and "program.resume".

I put EMCMOTMOD = motmod in the motion control section of my ini file

net Mstart halui.program.is paused => parport.0.pin-09-out
;example typo here
and
net Mstop halui.program.resume <= parport.0.pin-10-in
gave me errors about the pin not existing, so

In standard_pinout.hal I put
net Mstart => parport.0.pin-09-out
net Mstop <= parport.0.pin-10-in

In core_stepper.hal I put
net Mstart <= halui.program.is-paused
net Mstop => halui.program.resume

Now M0 gives me a 3.3V continuous signal on pin 9 that shuts off when I hit the mini resume button.

This is this what I think I should do.

Put into core_stepper.hal
loadrt oneshot
addf oneshot servo-thread
change net Mstart <= halui.program.is-paused to
net Mstart <= oneshot.out
change net Mstop => halui.program.resume to
net Mstop => oneshot.in

Does it seem right?

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

Time to create page: 0.093 seconds
Powered by Kunena Forum