Source Waveform NI-Digital Example Doesn't Generate Any Output

Updated Aug 16, 2018

Reported In

Driver

  • NI-Digital Pattern Driver

Issue Details

I'm trying to run the Source Waveform C example that ships with the NI-Digital driver, but it doesn't generate any data when I output in Serial mode. Why is that and how can I fix this?

Solution

This example by default configures the source waveform samples to be 32-bits wide. This means that, when generating a serial source waveform, it requires 32 vectors with the source opcode to generate one entire sample. However, the pattern included with this example only loops over the source opcode vector 8 times, which is not enough to finish the first sample or generate any data.

To properly configure this example, set the sampleWidth variable on line 27 of the NI Digital Source Waveform.c source code to 8, which matches with the width of two hex character samples, as shown below:

/* Source Waveform Values */ 
ViInt32 dataMapping = NIDIGITAL_VAL_BROADCAST, 
bitOrder = NIDIGITAL_VAL_MSB_FIRST, 
waveformSize = 10, /* number of data samples in data array for broadcast operation */ 
numWaveforms = 2, /* number of unique waveforms for site unique operation */
samplesPerWaveform = 5; /* number of samples per unique waveform for site unique */ 

ViUInt32 sampleWidth = 32; 
ViUInt32 data[] = { /* waveform data array */ 

0x00, 0x02, 0x04, 0x06, 0x08, 
0x06, 0x04, 0x02, 0x00, 0x00


This will cause the program to output the entire first waveform sample as is. Note however that the first sample in the generated waveform is 0x00, so only generating one sample still will not toggle any lines high. To output the entire 10 sample waveform, you should change the opcode in vector 1 of the Pattern.digipat file included with the example to set_loop(80) as shown in Figure 1. This will make the pattern generate all 80 bits required to generate 10 8-bit-wide samples of a serial source waveform.


Figure 1: Modified Source Waveform example pattern

WAS THIS ARTICLE HELPFUL?

Not Helpful