LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to export bit stream from a csv file to digital output port?

Hi all,

 

I have a NI USB 6221 BNC device and a csv format file (or any other format) which only contains  binary sequences. Is there a way to export those bits to a digital output port one by one at a given rate, e.g., 2k bits/second ? 

 

Thanks,

 

Wesley

0 Kudos
Message 1 of 10
(2,870 Views)

Hi Wesley,

 

Is there a way to export those bits to a digital output port one by one at a given rate, e.g., 2k bits/second ?

Yes.

I would start with some basic DAQmx examples…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 10
(2,862 Views)

Hi Wesley15

 

You may want to check this link: http://digital.ni.com/public.nsf/allkb/C944B961B59516208625755A005955F2 that talks about: How Can I Import Spreadsheet Files into LabVIEW Using the CSV Format.

 

Also, here is a video https://www.youtube.com/watch?v=mEaItrTA-cI, 

You can also search for Digital Software Timed Output example on LabVIEW, in the example finder. This example is compatible with the USB 6221 BNC.

 

Have a great day.

0 Kudos
Message 3 of 10
(2,827 Views)

Hi GerdW,

Sorry for the late reply. I was thinking about using DAQmx write vi together with read from spreadsheet file vi to realize what I want, but I don't know how to sync read from spreadsheet vi. Do you have any suggestions? I attached the snippet of my uncompleted block diagram below.

Thanks,

Wesley

 

Spreadsheet Read.png

 

0 Kudos
Message 4 of 10
(2,812 Views)

Hi Andr3s_Br3n3s,

Thanks for your reply. I also searched those links you provided but I think they are different from what I want. I will take a look at the Digital Software Timed Output.

Best,

Wesley

0 Kudos
Message 5 of 10
(2,809 Views)

Hi Wesley,

 

how/why do you want to "sync" file read and digital output?

The sample rate is set with DAQmxTiming…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 10
(2,808 Views)

Hi GerdW,

 

I am not sure how the bit streams in the spreadsheet are reading out or the rate they are reading out. I thought if I don't synchronize it, all the bits in the file would read out at once.

 


The sample rate is set with DAQmxTiming…

Do you mean if my sample rate of the Sample Clock vi is 100 Hz, then the DAQmx write vi will read 100 consecutive bits every second from the spreadsheet? In other words, I don't need to provide any timing when reading from spreadsheet?

 

Thanks,

 

Wesley

0 Kudos
Message 7 of 10
(2,799 Views)

Hi Wesley,

 

I am not sure how the bit streams in the spreadsheet are reading out or the rate they are reading out.

The file is read once, there is no "file reading rate"…

 

I thought if I don't synchronize it, all the bits in the file would read out at once

Yes.

Is this a problem for you? (Why should this be a problem?)

 

Do you mean if my sample rate of the Sample Clock vi is 100 Hz, then the DAQmx write vi will read 100 consecutive bits every second from the spreadsheet?

DAQmxWrite does NOT read any files, it only outputs samples to the hardware!

DAQmxTiming determine how those samples are "played" by the hardware…

 

In other words, I don't need to provide any timing when reading from spreadsheet?

No, you don't need to.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 10
(2,792 Views)

Hi GerdW,

 


Is this a problem for you? (Why should this be a problem?)


I have a very large sequences (1's and 0's) stored in a file, I want to send them to the digital output port of my NI device at 2 MHz frequency to control the chip I designed, which is also operating at 2 MHz. That's why I want to read out the sequences one by one at a given rate.

 


DAQmxWrite does NOT read any files, it only outputs samples to the hardware!

DAQmxTiming determine how those samples are "played" by the hardware…

So the DAQmx Write works as a buffer? All the bits in the file will be read into DAQmx Write at once and the DAQmx Timing controls the rate at which those bits are send to the digital output port? 

 

Thanks,

Wesley

 

 

0 Kudos
Message 9 of 10
(2,770 Views)

Hi Wesley,

 

So the DAQmx Write works as a buffer? All the bits in the file will be read into DAQmx Write at once and the DAQmx Timing controls the rate at which those bits are send to the digital output port?

Basically YES.

You need to check with your current hardware and reads its manual. Each DAQ device has its own buffer used to store data - and this buffer is limited.

Hint: did you check the example VIs coming with LabVIEW? They also explain how to output large waveforms!

 

I want to send them to the digital output port of my NI device at 2 MHz frequency to control the chip I designed, which is also operating at 2 MHz. That's why I want to read out the sequences one by one at a given rate.

You don't want to output samples "one by one" at a sample rate of 2MHz!

You want to output a (part of your) waveform to the DAQ-device internal buffer and have the DAQ device output samples at the commanded sample rate!

As said before: check all those example VIs coming with LabVIEW!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 10
(2,762 Views)