LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert a binary number to ascii

OK, I'll try to explain but at some point you may want to work through the free on-line LabVIEW course offered here so that you can better understand this stuff...

I have taken the AWG_MakeWaveformData.vi and cleaned it up so that it is easy to see everything that is going on, annotated it and attached it. See it that makes it any clearer and if you still have questions ask them (being very specific about what parts you do not understand).

(BTW, if the attached file is not clear enough in your browser you might try using the browser's ZOOM function or else save the file to your disk and open it with some other program)

Message Edited by Warren Massey on 12-01-2005 08:40 AM

0 Kudos
Message 11 of 13
(960 Views)
Thanks for the explaination.  However the vi was not the part that was confusing me.  It was the main vi.
There was no option to transfer *.txt file in the drop down box.   I am totally clear on what the vi is doing now and your explaination re-confirms my understanding.
Thanks again.

The vi they supply does not help me.  They do not convert their *.txt data to binary.  Your Read File II.vi is a much better help.  However I am trying to reverse the vi by converting the sine.txt file into the sine.wfm format.  Adding the Header and the trailer into the file.
I have 2 types of *.txt file.  One with tab delimited (waveform.txt) and the other the data points are listed in a column (sine.txt).  I have to make sure my program allows for both types of files to be converted and that I count the number of points in the file.  The total points must be a multiple of 4 and must be greater that 960 points.  If not zeros will be added at the end of the file before the trailer (clock).

I thank you for helping me out on this.
Download All
0 Kudos
Message 12 of 13
(950 Views)

I've attached a zip file that contains a couple of VIs that will convert a properly-formatted TXT file into a WFM file. I've also included a properly-formatted TXT file. You can use the previously-posted READ FILE II.vi to prove that the process is reversable.

 

I’ll leave it up to you to deal with data files that are not properly formatted.

After all, I can’t have all the fun now can I?

 

If it were up to me, I’d rewrite the AWG_MakeWaveformData II.vi, turning it into a state machine that first recognised the data file format and then extracted the pertinent data from the file and then formatted the data into a proper output data stream. I don’t know what you are going to do about generating the value for the CLOCK parameter if it is not in the file since it cannot be determined by looking at the file data if it is missing from the file.

 

Just a hint – it is easy to convert a file like your “waveform.txt” into a file like your “sine.txt” just using the “speadsheet string to array” and “array to spreadsheet string” VIs and a couple of constants. But then if you really do use a state machine to do all this then it may actually be easier to just use  the “speadsheet string to array” VI only to convert both file types to a common array type and then process the array of string data (rather than a string of data) into the properly-formatted output string.

 

And, if you do much with state machines, here is a tool that makes wiring them as they evolve much easier.

0 Kudos
Message 13 of 13
(940 Views)