From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Solve randomness in Digital Output

During my project, I am trying to control PIC24 with Labview. Unfortunately, computers available in school are not capable of running FPGI modules, so I had to somehow send Data and CLK in parallel as a Digital output from NI-BNC-2110 DAQ. I managed to create the program called "LED controller.vi" (attached with this forum), but unfortunately when it is run, it outputs CLK and Data randomly. I ran through the program multiple times, but I am not generating any random value in it. When the program is run, it outputs correct data couple of times, on the other hand, once in a while it shifts the data making it a false result. Can you please help me solve this problem? This program runs through multiple VIs, which are attached with this forum as well. I have also included couple of pictures showing the correct output and false output. 

 

Side Note: Within PIC, the data is to be accepted with rising and falling edge of the CLK, so at every edge, it should read the data value. 

0 Kudos
Message 1 of 4
(2,996 Views)

Hi,

 

I am unable to run the LED controller.vi you attached. Is thwe subvi named Create Array.vi one that you've created? If so, could you please include it?

 

Thanks,

Matt
NI Community Team
National Instruments
0 Kudos
Message 2 of 4
(2,978 Views)

Hi,

 

My apologies! Yes, I did create "Create Array.vi" for this project. I have attached it with the new version. I also tried connecting similar program to connect with a digital potentiometer (so I would bypass microcontroller), but that has the same issue.

 

I have attached the proper VI with all the sub vis with this post.

 

Thank you for your time and support.

 

Regards,

Manan

0 Kudos
Message 3 of 4
(2,973 Views)

Hi Manan,

 

I took a look at your code and if I am correctly interpreting what the issue is, you need the clock output and data output to be synchronized. It looks like these outputs are software timed in the current setup, which would explain why the outputs are occasionally not lining up as expected.

 

You likely need to implement some sort of synchronization architecture in your code. Check in the Example Finder for DAQmx synchronization (Hardware Input and Output>DAQmx>Synchronization>Multi-Function) Although none of these examples are specifically designed for two digital outputs, they may give you an idea of using the DAQmx timing functions and Sequence Structures to synchronize DAQmx events.

 

I hope this helps! Let me know if you think I am misinterpreting your problem.

 

Thanks,

Matt
NI Community Team
National Instruments
0 Kudos
Message 4 of 4
(2,963 Views)