TTL trigger output
- gillinderglass
- Offline
- New Member
- Posts: 10
- Thank you received: 0
Thanks
Bart
Please Log in or Create an account to join the conversation.
Inside the M code you can define one or more output pins to turn on/off.
I hope that it is what you wanted.
Please Log in or Create an account to join the conversation.
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
Please Log in or Create an account to join the conversation.
- gillinderglass
- Offline
- New Member
- Posts: 10
- Thank you received: 0
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.
Better, I think you are all the way there.Am I close?t
Please Log in or Create an account to join the conversation.
- gillinderglass
- Offline
- New Member
- Posts: 10
- Thank you received: 0
Thanks,
Bart
Please Log in or Create an account to join the conversation.
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
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)Could somebody please tell me, in words that an idiot can understand, how to set up an EIC timer?
Please Log in or Create an account to join the conversation.
- gillinderglass
- Offline
- New Member
- Posts: 10
- Thank you received: 0
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.
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.
- gillinderglass
- Offline
- New Member
- Posts: 10
- Thank you received: 0
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.