From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronization of TTL and Analog signal

Hello All,

I am trying to synchronize TTL signal of Piezo Stage and AI signal of Detector. Could anyone please suggests how I can write a code and run in NI DAQmx. 

0 Kudos
Message 1 of 15
(2,738 Views)

@Rehmanymu  已写:

Hello All,

I am trying to synchronize TTL signal of Piezo Stage and AI signal of Detector. Could anyone please suggests how I can write a code and run in NI DAQmx. 


Hi Rehmanymu,

I wonder if I understood your question accurately. Do you want to use a DI module and an AI module to detect two signals, and synchronize these two processes?

I wrote a VI based on my understanding, with comments. I hope it will help you. 

0 Kudos
Message 2 of 15
(2,638 Views)

Hi @YuWang822

Thank you for your answer. First of all,   I am unable to use the Labview code that you share here,  It shows the error, maybe due to the old version Labview. I am using LabVIEW 2016.

Yes That's right. The TTL signal from Pixel clock of Piezo stage and AI from the detector. These signals, I am trying to read through DI and AI module according and try to synchronize or trigger. My final goal is to get data and reconstruct the image.   

0 Kudos
Message 3 of 15
(2,622 Views)

Hi @Rehmanyhu,

 

The principle of synchronization is that you select one task as a master task ,the other as a slave task. The slave task uses the trigger and the sample clock of the master task, and waits before the master task begins. 

 

I saved my code in version 2016,  I wish it works or you can look at the screenshot or the page below.

http://www.ni.com/tutorial/5376/en/

This tutorial explains the synchronization of analog input in great detail, I think it will also apply to your problem.

Download All
0 Kudos
Message 4 of 15
(2,602 Views)

Hi @Rehmanymu,

 

Is your problem solved according to my support?

0 Kudos
Message 5 of 15
(2,566 Views)

Hello Yu,

Thank you, No It not working yet. I tried with this code, It cannot show anything and also no error at all. I also read the page you suggest to me. But still looking solution.  Are you from Taiwan?

0 Kudos
Message 6 of 15
(2,548 Views)

Hi Rehmanymu,

Since there is no error, I think maybe there is something wrong with settings.Does the AI/DI channel you choose in VI correspond to the pin you wired? You can check the product's spec for relevant information. What system and modules do you use?

I'm from China.

0 Kudos
Message 7 of 15
(2,531 Views)

Hello YU,

I think the wired connections are correct. I am using NI USB-6259 and the module AI (AI/ai0) and DI ( Port0/line1). IF possible can We discuss on Wechat, My Wechat id is khalil_pk.  

0 Kudos
Message 8 of 15
(2,526 Views)

Hello Rehmanymu,

Due to work reason, I can only support you in the forum. I will reply to you after a verification according to your case.

0 Kudos
Message 9 of 15
(2,518 Views)

Hello Rehmanymu,

I just tested the attached VI using NI USB-6259. In my test, I use NI MAX to build two tasks to generate a AO signal and a pulse for AI,DI.

Pic1&2 are the screenshots of the front panel and block diagram, the code works. Pic 3 shows how I connect the device:

1. AI task: pin 47&48 (AO2) to pin1&2 (AI/ai0) for differential configuration;

2. DI task: pin 89 (counter output ) to pin66 (port0/line1).

In this test, I found that you only need to set the ai/sampleclock as the source of the DI task, which you can find it in the user manual of M Series, at page 89.

http://www.ni.com/pdf/manuals/371022l.pdf

If you want to test one task immediately, you can get help in LabVIEW.

Help>>Find examples>>Hardware Input and Output>>DAQmx, you can select your device and run these example VIs, this may help you find the problem of connection, etc.

I hope this can solve your problem.


Download All
0 Kudos
Message 10 of 15
(2,507 Views)