Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial generation in multiple channels

Solved!
Go to solution

Hi forum, I need to ask some questions. Any helps are appreciated.  

 

1). I need help with dynamic serial generation in multiple channels. From here, we can see how the dynamic data in serial way being generated through one channel. But I cant find anywhere, how to generate multiple serial signals in multiple channels. 

 

2). What is the limit for this serial generation? I believe it depends on hardware, but I'm not sure, which specification is the limit. My hardware is PXIe-6544.

 

3). Is it possible to generate the different signals in different channels using scripts? and to start the generation in those channels at the same time? the given example in labview of script generation is unfortunately only for one channel generation.   

 

Thanks in advance,

regards,

Yan.

0 Kudos
Message 1 of 20
(7,019 Views)

Anyone can help?

 

I found this post from 2009, but I dont see the answer of how to generate multiple signals in multiple HSDIO channels.

And I also found this post from 2013, but I still found no answer for this.

Any help is greatly appreciated.

 

Regards,

Yan.

0 Kudos
Message 2 of 20
(6,972 Views)

You just need to list the channels you want to use in your Channel List when call the niHSDIO Assign Dynamic Channels VI.
I add a screenshot that shows how it has to look like.

x-y calls all channels from x to y
x,y calls only x and y

Message 3 of 20
(6,939 Views)
Solution
Accepted by topic author Mystogan

Hi Yan,

 

Generating on multiple channels with multiple data is difficult without either a tool to visualize the data, or each channel's serial bitstream concatenated in a software ADE and transposed before being downloaded into memory.  To make things visual here, I'll assume that you want to generate a 3-bit pattern on channels 0, 1, and 2 that is 8 samples wide.  Let's assume the following serial bit patterns for each channel:

 

ch 0: 0101 1010

ch 1: 0000 1111

ch 2: 0100 1101

 

So the question now is, how do you load this into the PXIe-6544(or any other HSDIO hardware)?  From the two options, you can use Digital Waveform Editor (DWE) to create it visually and then save to a HWS file type, and then load from HWS using the HSDIO API.  This is the easiest in my opinion.

 

The second way is building the sample data based on a per sample basis.  What I mean is you would take all of the bit streams and build a 2D array so that it looks like:

 

01011010

00001111

01001101

 

A 3x8 array, and then transpose the array that turns it into:

 

000

101

000

100

111

011

110

011

 

Here, you can see we have 8 rows, each row is a sample, and in U32 form read in decimal you get 0, 5, 0, 4, 7, 3, 6, 3.  This is what you can load into our U32 niHSDIO Write Waveform function.  Hopefully you can see how that translation occurs and how that looks in terms of loading it into the board.  Each sample generally contains data for all channels, where each bit in the U32 corresponds to one of the 32 channels available on your device.  So if you want to write a '1' to channel 5, you would load a value of 0000 0000 0000 0000 0000 0000 0010 0000 as a sample, where the 5th bit is 1 and all other bits 0.  In decimal, you would write the value '32'.

 

As for serial size limitation, if your data rate is slow enough you can stream and make a nearly infinite data stream, but assuming you are running at max rate, your serial waveform size is limited by your onboard memory size.  Since each generation sample is 32 bits, that is 4 bytes per sample, so a 32MB memory size will equate to 8MS serial bitstream max.

 

Any questions or feedback are welcome.  Thank you.

 

 

 

 

Kyle A.
National Instruments
Senior Applications Engineer
Message 4 of 20
(6,920 Views)

Hi Kyle, thanks for your guide, its very helpful.

 

I have written pretty much questions actually, but sadly an error has occured as I clicked post, and everything is gone.

 

I need to ask:

 

In my case, with 40MHz clock base, I would generate 3 signals in 3 channels (two 10MHz clocks with 1/2 or 1/4 different phase and a sinewave or ramp signal on the third channel).

 

1). I can use 1D U8 in write function for my generation? This would mean I can have more samples to load to buffer or is it the other way around? I'm pretty confuse, from here number 4, the device would have bigger buffer size when more channels are active. CMIIW.

 

2). To build the two clocks, I would only need 8bit to be repeated forever, right? but to build my sinewave, I would need (for example 1kHZ sinus sampled with 1MHz) 40.000 samples to generate a single amplitude?

 

3). which method is better, script or waveform for me?

 

4). I can choose the generation channels freely? like 0-7 or 8-15, but it has to be 8 channels for U8?

 

5). I need to have the both clocks run forever and the signal comes only when its required. Should I use state machine structure? 

 

6). I'm going to acquire signal at the same time (I'm splitting 16 first channels for generation, and the rest for acquisition), this means the maximum speed would be halved?

 

7). Ive seen the example continuous generation - stream from memory, what should I mind to set the onboard streaming waveform size, it has to be a number of 2^x? 

 

Thanks and regards,

Yan.

0 Kudos
Message 5 of 20
(6,896 Views)

Hi Yan,

 

1) You can use a U32 or a U16, per the device requirements for generation.  You can read more about this in this KB. Using a U16 gives you twice as much memory as a U32 would need, but given your app you won't have to worry about that.

2) There is a minimum waveform size of 4 samples, so anything above that will work which also meets memory requirements (such as waveform quantum, may need a sample size divisible by 2, or 4, etc.)  

3) I have to defer this question due to the nature of point 5.

4) You can choose ANY channel selection, even 0, 2, and 15.  As long as your data width covers all channels selected.

5) To achieve this, you'll have to take into consideration a lot of different variables.  Of course, there is some clarification that I don't have that keeps me from really giving the best answer.  HSDIO is digital, so how are you going to generate a sinewave with it? You would need an FGEN to do that.  If you eliminate the need to make a sinewave on the HSDIO, the clocks generating forever with a continuous generation onboard memory (non-streaming) becomes very simple.  But considering I don't know if you want to create a true sinewave or a digital format sine wave, I cannot say one way or the other whats easiest.  

6) I don't understand your reasoning behind halving the max speed, but all channels will run with their respective timing engine clock rates.  If they run at 40 MHz each, at 32 channels you will have 4 bytes per sample, meaning 160 MB/s bandwidth.  The 6544 can stream up to 400 MB/s generation, 660 MB/s acquisition (depending on host hard drive).  Refer to streaming tutorials if you would like to see what's all involved in that process.

7) I believe you are referring to waveform quantum.  I don't remember off the top of my head, but if it is 2^x then yeah do that. The API will throw an error if you load an invalid size, but it should be an easy fix given your waveform patterns.  

Kyle A.
National Instruments
Senior Applications Engineer
0 Kudos
Message 6 of 20
(6,884 Views)

Hi Kyle, thank you very very much for your helpful answers. I have a feeling that you know all the stuffs that I need to know about HSDIO Smiley Very Happy

 

I'm generating my sinewave like what shown in the snippet (basically a simple sinewave generation).

Parameter 2^x is for scaling the sinewave amplitude to range 0 ~ 2^x-1.

Then elements of output numeric array (here: signalverluafsgraph) will be converted into boolean array one by one.   

 

 

sinewave.png

 

 

1). So, in order to generate 1kHz sinewave sampled with 1MHz, with 40MHz clockrate I would have 40booleans for 1 sinus sample and 40k booleans to generate a single sinus periode, right?

This 40k booleans will be sent into the device, then generated repeatedly.

 

2). Referring to your statement, if I'm using 32 channels (16 for generation and 16 for acquisition) I would have 80MB/s bandwidth in acquisition, correct?

 

3). What you meant with waveform quantum in my case is this 40k booleans right? and it must be in a number of 2^x. Somehow I could only use 2^19 in input alocate named waveform.vi.

 

4). I'm still not too clear with the buffer size.

Sometimes I got error 1074115902 which says

Procedure Name: hsdiointernalscriptmywfm
Procedure Size: 112
Total Device Memory: 4194304

Largest Available Memory Block: 0
Memory Used by Waveforms: 4194304
Memory Used by Procedures: 0
Units: Bytes

What is actually this red numbers mean? I'm assuming it is 1Mbit/channel capacity (device internal memory) with 1bit sample = 4bytes? is it for one channel or one device? in my case, I should be able to generate like 100x 40k booleans (or 100 periods), send into device, and generate? 

Btw, the link you gave me doesnt work, can you send me again please.

 

regards,

Yan.

 

0 Kudos
Message 7 of 20
(6,869 Views)

5). If I'm trying to generate 30 secs sinewave and then off, I need to generate some sinewave-periods (into maximal allowed size from internal memory) and repeat them?

0 Kudos
Message 8 of 20
(6,864 Views)

6). In an example of HSDIO; Continous Generation - Stream From Memory.vi, I dont really get what happens in Step 7.

What is the purpose of FOR-loop? is it like splitting the data (if my data is too big) into smaller pieces? Is that a "trick" to stack and load data into device onboard memory?

 

7). What happens in Step 10 (False-case) actually? if the available space is not enough; then dont write. Is it like just waiting the buffer to flush out whats inside the onboard memory?

 

Cont_Gen.png

 

 

0 Kudos
Message 9 of 20
(6,859 Views)

Hi Yan,

 

1) Sounds about right, I'm not used to seeing a sine wave generated serially with a single boolean toggle, but if that is what your application calls for, you seem to have it down.

2) Yes.

3) What I mean is a waveform with 7 samples throws an error, stating that it needs to be a multiple of 2.  So then you would have to increase the waveform size to 8 samples, or 10, 12, etc.  Not sure why you had to use 500k samples.

4) I searched that error code and tried to find an explaination for it, but it seems the code you posted is not a valid code. I can only guess that considering it says something about your script that you are either trying to generate 0 samples or there is an invalid function being used. It's hard to say.

5) Not sure what you mean.

6) Step 7 writes N blocks of memory to memory before initiating the generation.  Then during the generation, when the amount of available space is greater than a single block, it will load another block into memory to keep up with the generation.

7) Yes.

Kyle A.
National Instruments
Senior Applications Engineer
0 Kudos
Message 10 of 20
(6,853 Views)