Discussion:
Only 1 "NewWfmReference" per .HWS file?
(too old to reply)
Jakeus
2008-02-26 19:10:05 UTC
Permalink
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 1niHWS_NewWfmReference (FileHandle, "group1 ", "a", 0, &WaveformRef);niHWS_WriteDigitalWDT (WaveformRef, niHWS_Val_GroupBySignal, 1, 5,chrArray);
 
//Write waveform reference 2niHWS_NewWfmReference (FileHandle, "group1 ", "b", 0, &WaveformRef2);niHWS_WriteDigitalWDT (WaveformRef2, niHWS_Val_GroupBySignal, 1, 5,chrArray);             
 
//Close fileniHWS_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?
 
JaredW
2008-02-26 22:40:07 UTC
Permalink
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 WriteWaveformWDT to write those 1000 samples.Set the For loop to run 50 times.. The WriteWaveformWDT will automatically append each 1000 sample segments to the end of the waveform. So after calling WriteWaveformWDT 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

Loading...