[comedi] External trigger

Fredrik Ragnarsson <[email protected]> Fri, 6 May 2022 15:55:28 -0700 (PDT)
Newsgroups gmane.linux.comedi
Message-ID <[email protected]>
------=_Part_3416_1579146584.1651877728943
Content-Type: multipart/alternative; 
	boundary="----=_Part_3417_776993133.1651877728943"

------=_Part_3417_776993133.1651877728943
Content-Type: text/plain; charset="UTF-8"

Hi!
I'm trying to use an external trig signal to control the acquisition. 
I would like to start the acquisition on positive edge and stop on negative 
edge and after that write the data to a file.

I'm reading asynchronously with 
while(1) {
    n = read(comedi_fileno(dev), buf, bufsz);

// alt 1
cmd->start_src = TRIG_EXT;
cmd->stop_src = TRIG_COUNT;
cmd->stop_arg = X;
This set-up starts the acquisition by the external trig signal and it stops 
after X acquisitions.

// alt 2
cmd->start_src = TRIG_EXT;
cmd->stop_src = TRIG_NONE;
This set-up starts the acquisition but then it runs for ever.

// alt 3
cmd->start_src = TRIG_NOW;
cmd->scan_begin_src = TRIG_EXT;
cmd->scan_end_src = TRIG_COUNT;
cmd->scan_end_arg = 0;
cmd->stop_src = TRIG_NONE;
This set up starts a scan on positive edge and stops the scan on negative 
edge (read is blocking until the trigger goes high again).  
I can't find out how to get a notification when the trigger goes zero so I 
can write the data to the file and close it.

The options for my card NI pci-6023e are:
start: now|ext|int
scan_begin: timer|ext
convert: timer|ext
scan_end: count
stop: none|count

Any suggestions?





-- 
You received this message because you are subscribed to the Google Groups "Comedi: Linux Control and Measurement Device Interface" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/comedi_list/7466e95f-c1d7-4102-8ff8-71b1b8515c85n%40googlegroups.com.

------=_Part_3417_776993133.1651877728943
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div>Hi!</div><div>I'm trying to use an external trig signal to control the=
 <span>acquisition. </span></div><div>I would like to start the <span>acqui=
sition on positive edge and stop on negative edge and after that write the =
data to a file.<br></span></div><div><span><br></span></div><div><span>I'm =
reading <span>asynchronously with <br></span></span></div><div><span><span>=
<span>while(1) {<br></span></span></span></div><div><span><span>&nbsp;&nbsp=
;&nbsp; n =3D read(comedi_fileno(dev), buf, bufsz);</span></span></div><div=
><span><br></span></div><div><span>// alt 1<br></span></div><div><span>cmd-=
&gt;start_src =3D TRIG_EXT;<br></span></div><div><span>cmd-&gt;stop_src =3D=
 TRIG_COUNT;</span></div><div><span>cmd-&gt;stop_arg =3D X;<br></span></div=
><div><span>This set-up starts the <span>acquisition by the external trig s=
ignal and it stops after X <span>acquisitions.<br></span></span></span></di=
v><div><span><span><span><br></span></span></span></div><div><span><span><s=
pan>// alt 2<br></span></span></span></div><div><span><span><span>cmd-&gt;s=
tart_src =3D TRIG_EXT;<br></span></span></span></div><div><span><span><span=
>cmd-&gt;stop_src =3D TRIG_NONE;<br></span></span></span></div><div><span><=
span><span>This set-up starts the <span>acquisition but then it runs for ev=
er.</span></span></span></span></div><div><span><span><span><span><br></spa=
n></span></span></span></div><div><span><span><span><span>// alt 3</span></=
span></span></span></div><div><span><span><span><span>cmd-&gt;start_src =3D=
 TRIG_NOW;<br></span></span></span></span></div><div><span><span><span><spa=
n>cmd-&gt;scan_begin_src =3D TRIG_EXT;<br></span></span></span></span></div=
><div><span><span><span><span>cmd-&gt;scan_end_src =3D TRIG_COUNT;<br>cmd-&=
gt;scan_end_arg =3D 0;<br>cmd-&gt;stop_src =3D TRIG_NONE;<br></span></span>=
</span></span></div><div><span><span><span><span>This set up starts a scan<=
span> on positive edge and stops the scan on negative edge (read is blockin=
g until the trigger goes high again).&nbsp; <br></span></span></span></span=
></span></div><div><span><span><span><span><span>I can't find out how to ge=
t a notification when the trigger goes zero so I can write the data to the =
file and close it.<br></span></span></span></span></span></div><div><span><=
span><span><span><span><br></span></span></span></span></span></div><div><s=
pan><span><span><span>The options for my card NI pci-6023e are:</span></spa=
n></span></span></div><div><span><span><span><span>start: now|ext|int<br>sc=
an_begin: timer|ext<br>convert: timer|ext<br>scan_end: count<br>stop: none|=
count<br></span></span></span></span></div><div><span><span><span><span><br=
></span></span></span></span></div><div><span><span><span><span>Any suggest=
ions?<br></span></span></span></span></div><div><span><span><span><span><br=
></span></span></span></span></div><div><span><span><span><br></span></span=
></span></div><div><span><span><span><br> </span></span></span></div><div><=
span><br></span></div><div><span><br></span></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;Comedi: Linux Control and Measurement Device Interface&quot; group.<br=
 />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">comedi_=
[email protected]</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/d/msgid/comedi_list/7466e95f-c1d7-4102-8ff8-71b1b8515c85n%40googlegroups=
.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/ms=
gid/comedi_list/7466e95f-c1d7-4102-8ff8-71b1b8515c85n%40googlegroups.com</a=
>.<br />

------=_Part_3417_776993133.1651877728943--

------=_Part_3416_1579146584.1651877728943--