01-11-2019 07:56 AM
Hi maverikk,
I have made the transmitter and receiver vi in the same block diagram to take care of the synchronization issue.
Placing some code in parallel in a VI does NOT take care of synchronization!
Did you examine the example VIs coming with LabVIEW? There are also examples to sync AI and AO in parallel…
I need to store and compare the received and transmitted data to cross verify whether is it same or not?
That's up to your task description! What is your task?
How should I answer this question?
Where am I wrong? I am transmitting and receiving at the same data rate.
But not in sync…
01-14-2019 03:15 AM
Hi GerdW,
I have modified my VI and now it is in sync. However I am now struggling with the idea of converting to Boolean. As you can see in the vi that I have an array in matlab script which has 1s and 0s. I want to make a 1D array of Boolean according to the pattern of 1s and 0s. I have taken less number of 1s and 0s just to check first. Actually they are total 250000 samples of 1s and 0s. How do I convert it into boolean array having the same pattern?
Also is there a way I can get rid of the matlab script by storing these 1 and 0 pattern in some sort of array?
01-14-2019 03:38 AM
01-14-2019 07:59 AM
Hi GerdW,
I am still having doubt about synchronization. When I run the attached vi I am seeing behavior which I can't understand. As can be seen in block diagram I am using on-board (PXIe-6366) clock of 8 MHz which is being shared by both output and input. I thought this is enough to synchronize the transmitter and receiver.
The confusion is this:
1) At the transmitter side no matter how many 'samples per channel' I specify in DAQmx timing vi, 'number of samples written per channel' by DAQmx write vi is always 250k samples only. Which is okay since I am generating 250k samples.
2) At the receiver side, in DAQmx timing vi, when I specify 250k samples to be read (since I transmitted that many samples only) I am receiving nothing but static high output. Only when I increase number of samples per channel (in receiver timing vi ) at least 3 times the samples specified for transmitter timing vi, then only I am receiving my transmitted signal. But I am receiving so many extra samples as well.
Why can't I receive just 250k samples that I transmitted? So that I can compare.
01-14-2019 08:18 AM - edited 01-14-2019 08:20 AM
Hi maverikk,
I thought this is enough to synchronize the transmitter and receiver.
No, that's not enough.
Did you examine those example VIs explaining how to synchronize AI and AO? You should use a StartTrigger for both DAQmx tasks…
(I know there are examples!)
1) When you supply 250k samples then the task will not write more samples than that…
2) Because you didn't synchronize your DAQmx tasks. The Rx task will start earlier as you call the DAQmxStart before you even start to write the samples for the Tx task! Writing the samples takes some time for 250k samples!
01-17-2019 07:01 AM
Hi GerdW,
Thanks for being a lot of help.
Attached is the modified vi. It is in synch and working as desired. But I want to write more such signals on other lines.
(1) Will I have to create different tasks for these lines as well? Say I want to write one digital waveform to port 0 line 1 and another different digital waveform (different bit patterns) to port 0 line 6. And then simultaneously read from these output lines. How to go about this? I changed the instance of DAQmx write vi from one channel multiple samples to multiple channel multiple samples. But this is not working.
(2) Also why can't I write to/read from PFI lines (port 1 and 2) ? I went through the manual and spec sheet of PXIe-6366 (DAQ card I am using). It says they can be used only as
(i) Static digital input/output
(ii) Timing input/output
(iii) Counter/timer functions.
Its not very clear to me. Can't I write digital waveform to or read from these lines?
01-17-2019 09:35 AM
Hi maverikk,
But I want to write more such signals on other lines.
Then you need to supply a waveform for each line. And change the DAQmxWrite to "N chan N samples" mode.
No need for more tasks, one is enough!
Also why can't I write to/read from PFI lines (port 1 and 2) ?
PFI lines most often use the very same connector pin as an "ordinary" DIO pin. So to use them for static DIO you call them by their port/line name. To use them as for PWM/CTR you create counterIO tasks…
01-17-2019 01:41 PM
(1). You can have no more than 1 hw-clocked DI task and 1 hw-clocked DO task running at a time on your X-series 6366 board. You would need both 0.1 and 0.6 lines included in the same DO task. You'd do a similar thing for reading from the loopbacked DI lines.
The way I recall approaching it is to config DO with all lines 0.1 and 0.6 grouped as 1 channel and then writing data as an array of u8 values (or u32, or whatever the width of port 0 was). Only the value of bits 1 and 6 within the u8 values will actually affect the output signal. The other bits of the u8 value would have no effect because those lines weren't part of the task.
I suspect there's a way to do this with the digital waveform datatype. I personally have typically only used them for graph & chart displays. When first introduced they seemed rather opaque so I just stuck with the raw bit-wise representation I had an intuitive feel for.
(2). That's a typical restriction on NI's MIO boards. Only port 0 supports hardware-clocked DIO. So no, you *cannot* write or read hardware-clocked waveforms on ports 1 or 2.
-Kevin P
01-18-2019 01:17 AM
Hi GerdW,
I tried to simultaneously write and read from 2 channels. Using the same vi and analog signals I successfully tested for AI and AO channels. (VI is attached.) But for DO and DI I am having trouble. I keep getting this error 200284 which basically means timeout is occurring before samples are being read. I tried everything listed to remove this error; increasing the sample rate/decreasing the number of samples/increasing the DAQmx read timeout etc. Still I am not getting output.
01-18-2019 01:21 AM
Please ignore the previous VIs.