08-12-2019 11:27 PM
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.
08-16-2019 06:36 AM
@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.
08-16-2019 10:50 AM
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.
08-16-2019 06:09 PM - edited 08-16-2019 06:12 PM
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.
08-20-2019 01:03 AM
Hi @Rehmanymu,
Is your problem solved according to my support?
08-20-2019 10:29 PM
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?
08-21-2019 01:48 AM
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.
08-21-2019 02:16 AM
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.
08-21-2019 03:19 AM
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.
08-21-2019 09:09 AM
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.