Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Only 1 "NewWfmReference" per .HWS file?

Here is my CVI code.  When I try to import the resulting .hws file into the NI Digital Waveform editor, it does not recognize it as a valid waveform.  I guess my question is, "Are you limited to one Waveform Reference per file?"  That would explain what my problem is.
 
tHWS_FileHandle
     FileHandle;
 tHWS_WfmRef
     WaveformRef,
     WaveformRef2;
char
     chrArray[5];
 
chrArray[0]=0;
chrArray[1]=1;
chrArray[2]=1;
chrArray[3]=1;
chrArray[4]=0;
 
//Open HWS
niHWS_OpenFile ("card1.hws",niHWS_Val_ReadWriteCreateNewAlways, &FileHandle);
 
//Write waveform reference 1
niHWS_NewWfmReference (FileHandle, "group1 ", "a", 0, &WaveformRef);
niHWS_WriteDigitalWDT (WaveformRef, niHWS_Val_GroupBySignal, 1, 5,chrArray);
 
//Write waveform reference 2
niHWS_NewWfmReference (FileHandle, "group1 ", "b", 0, &WaveformRef2);
niHWS_WriteDigitalWDT (WaveformRef2, niHWS_Val_GroupBySignal, 1, 5,chrArray);             
 
//Close file
niHWS_CloseFile (FileHandle);
 
----
If you are limited to one waveform reference to a file, how would someone go about putting 80 nodes with 20,000 samples (without breaking up the .hws file).  If you can only write one waveform reference, you're stuck with an array of size 80*20,000.
 
Any thoughts?
 
0 Kudos
Message 1 of 5
(3,349 Views)

Jakeus,

Your CVI code looks good. HWS files can contain many individual wfms in a single file, however the Digital Waveform Editor is only capable of reading HWS files that contain ONE waveform.

It is perfectly reasonable to have a single wfm in HWS that has 80 nodes and 20k samples. HWS was designed to support very wide digital patterns, and 20k samples is a very small number. HWS can handle millions of samples.  Also, if you keep all 80 of your nodes in one waveform datatype, than the DWE can read all 80 nodes.

Is there a reason you want to break up the 80 nodes?

-Jared

0 Kudos
Message 2 of 5
(3,343 Views)
I figured out the waveform issue.  I had misunderstood what it meant by "waveform".  I thought it was similar to adding a new signal to the HWS file (like if you add 20 waveforms, you end up with 20 nodes with waveforms in the file), but I realized it was adding an independent set of signals to the HWS file.  I think I understand what that means now. 
 
My problem with this WriteWaveformWDT function is, how I can programmatically generate a large HWS file without having to declare a huge array for the WriteWaveformWDT function. For example, lets say I have 50,000 samples with 20 nodes.  I'd have a huge array.  I was hoping there was another way I could do this without declaring an array with a size of 1,000,000.
0 Kudos
Message 3 of 5
(3,337 Views)

The way you write large sets of data to an HWS file is to do repeated writes on smaller chunks of data.

In your 50,000 sample example, you could initialize just 1000 samples (with 20 nodes) and then in a for loop generate the data for just 1000 samples and call niHWS_WriteDigitalWDT  to write those 1000 samples.Set the For loop to run 50 times.. The niHWS_WriteDigitalWDT  will automatically append each 1000 sample segments to the end of the waveform. So after calling niHWS_WriteDigitalWDT 50 times, you end up with one waveform that is 50,000 samples long.

If you have NI-HSDIO installed, I beleive there is a "streaming data to disk" example that shows how to do this.

-Jared



Message Edited by JaredW on 02-26-2008 04:40 PM
Message 4 of 5
(3,334 Views)
I forgot about that.  I've seen the appending with one signal on a waveform, I didn't realize it would apply to many signals.  Alright, thanks for the help.
0 Kudos
Message 5 of 5
(3,325 Views)