TTL trigger output

More
12 years 5 months ago #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:
Code:
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
12 years 5 months ago #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
12 years 5 months ago #46737 by andypugh
Replied by andypugh on topic TTL trigger output

gillinderglass wrote: 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
12 years 5 months ago #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.

More
12 years 5 months ago - 12 years 5 months ago #46761 by andypugh
Replied by andypugh on topic TTL trigger output

gillinderglass wrote: Does it seem right?


Not quite.
I actually prefer the long-form of the net command, it saves space :-)
Code:
loadrt oneshot count=2 ... addf oneshot.0 servo-thread addf oneshot.1 servo-thread ... net prog-paused halui.program.is-paused => oneshot.0.in net take-photo oneshot.0.out => parport.0.pin-09-out setp oneshot.0.width 0.01 net photo-done parport.0.pin-10-in => oneshot.1.in net restart-prog oneshot.1.out => halui.program.resume setp oneshot.1.width 0.002

Should probably work. (I haven't tested it)
Last edit: 12 years 5 months ago by andypugh.
The following user(s) said Thank You: gillinderglass

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

More
12 years 5 months ago #46771 by gillinderglass
Replied by gillinderglass on topic TTL trigger output
You are fantastic. Thank you. I wouldn't have ever figured this out.

There is just one error. command - (EMC_TASK_PLAN_RESUME) cannot be executed until the machine is out of E-Stop and turned on.

Regards,
Bart

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

Time to create page: 0.143 seconds
Powered by Kunena Forum