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.

Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Generation of Serial Data with Timer?

Good day everyone,

 

I'm trying to generate serial Data using HSDIO. And I've found this example very helpful from NI (Dynamic Generation of Serial Data for NI-HSDIO).

I could generate serial data using this example VI, and I found that the data will be sent IMMEDIATELY after the previous data been sent. I've edited a bit,

*so this program is sending 0~5 (as 16bit boolean per data: 0000000000000000 1000000000000000 0100000000000000 1100000000000000 0010000000000000 1010000000000000). As result, the time of this generation is depend on Clock Rate of HSDIO board: with using 40MHz clock rate, which means 25 ns per bit or 400 ns per 16 bits (1 data). Means it generates signal with 400 ns interval per data:

 

Time          Data

0 s              0 (0000000000000000)

400 ns       1 (1000000000000000)

800 ns       2 (0100000000000000)

1,2 us          3 (1100000000000000)

1,6 us          4 (0010000000000000)

2 us             5 (1010000000000000)

DynGenSerial.png

I've modified a bit that VI, so I can send a digital waveform instead of array of "0" or "1".

 

And I'm now having trouble while trying to add DELAY between data that being sent. I mean, I want this VI works like this:

-I want to use T1 (range ms), for example 1 ms. Then I would have something like this:

 

Time          Data

0 s              0 (0000000000000000)

1 ms            1 (1000000000000000)

2 ms           2 (0100000000000000)

3 ms           3 (1100000000000000)

4 ms           4 (0010000000000000)

5 ms           5 (1010000000000000)

 

It should be not really hard I believe, but I just cant find the idea to realize it yet.

An idea was using while loop with delay, but I dont think I know where to put this while loop with delay, since niHSDIO initiate.vi will start and write all data (0~5) at once, right?

And I dont have to generate the same data for the whole delay, which means like generating 2500 (desired T1/time for 1 data = 1ms/400ns) signals. 

I just need to write data, then wait until T1 elapsed, then write the next data.

 

Any helps are appreciated.

Regards,

Yan.

Download All
0 Kudos
Message 1 of 2
(4,446 Views)

I can use while loop and its (i) to index the output of FOR LOOP and using "wait until next ms multiple vi" I can control the time of how often the data will be written into HSDIO device. But somehow I'm getting error after finish writing 256 datas of mine:

"The write operation cannot be performed because the number of signals in the waveform does not match the number of dynamic channels assigned to this session".

Its weird, since I'm getting this error only when I'm trying to index my output. But if I'm not indexing my output, just let it flow consecutively, it works (but this way I cant control my desired time or each value that been generated).

 

regards,

Yan. 

0 Kudos
Message 2 of 2
(4,438 Views)