LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write to binary file

I have the attached older vi and I am trying to recreate it and I'm changing some of the ScanDataIn and ScanDataOut type degs; however, my problem lies with the write to binary file. It seems that the vi has an older version of the write to binary file vi and it does not enforce the big-endian, native, or little-endian byte orders. How do you tell how the data was written in this vi.
0 Kudos
Message 1 of 9
(3,468 Views)

Hi,

In memory:

          If the data is written on a Intel machine (PC) it's Little-Endian

          If the data is written on a Motorola platform (Mac) it's Big-Endian

But software can make it's own Endian  Smiley Wink    Because LV started on a MAC, data in a binary files was written in Big-Endian till LV7

 

Message Edited by K C on 07-04-2007 01:46 PM

Message 2 of 9
(3,451 Views)

Before LabVIEW gave a choice of byte order, everything in LabVIEW was big endian on any platform (to e.g. read or write a little endian file, you had to re-order the bytes manually).

You can safely assume that any old LabVIEW program does big endian unless you see some explicit byte operations in the code.

You did not attach the required subVI ("formatFordata..."), so we cannot really tell anything. Please attach that subVI. Thanks!

0 Kudos
Message 3 of 9
(3,440 Views)
Here are the associated VIs. So more than likely it is big endian, but I don't understand what the enumerated constant is on the old VI. Start, End, Current. What coud these be used for?
0 Kudos
Message 4 of 9
(3,411 Views)
Ok, well the first thing is that you can stop worrying about "endian-differences" because the data that being written is tab-delimited ASCII data. Oh, the author did use the binary file write routine, but the data being written is text. The easiest thing to do is simply replace the binary write with a text write.

Mike...

Message Edited by mikeporter on 07-05-2007 10:15 PM


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 5 of 9
(3,391 Views)
Ok i see why it is text that is being written and that is why you can replace the write to binary to a write to text file, but I don't understand what the enumerated "start, end, current" is used for. Could it be a special case of some sort?
0 Kudos
Message 6 of 9
(3,376 Views)


@rlg50 wrote:
Ok i see why it is text that is being written and that is why you can replace the write to binary to a write to text file, but I don't understand what the enumerated "start, end, current" is used for. Could it be a special case of some sort?

Well, the "start, end, current" is an input for a stock LabVIEW function, so the online help will give you the answer you need. When writing to a file, you can either start writing at the beginning of the file, overwriting what's there, at the current file position, or at the end of the file (appending the new data to the existing file). Here "end" is used and the new data is appended to the existing file data.

While you're at it, you might want to clean up the code a bit. All your subVIs contain outer while loops that serve no purpose. You can delete them without any change in functionality. SubVIs only need a dummy while loop if you have uninitialized shift registers (e.g. action engine), but in this case, the loop is no longer a dummy. 😄

Let's have a quick look at your "format for data..." code. The while loop is useless. Much of the code is overly complex, for example have a look at the two details shown in the image. It shows your code fragments and better alternatives.

.

Message Edited by altenbach on 07-06-2007 08:42 AM

Message 7 of 9
(3,374 Views)
Thank you for those suggestions, I will look into those; however, I inherited this huge heiarchy of labview code and I am changing it to add a little functionality for another similar test. In addition, I am very new to labview so I'm not sure what is going on in a lot of cases. I've been reading the online help and just started going to the labview training courses (i'm hoping they help alot). I'm just not a programmer, to say the least. I can see things easily in my mind, but putting the code together is another story. Thanks for the help.
0 Kudos
Message 8 of 9
(3,357 Views)
If it all works, maybe you shouldn't mess with it until you are very familiar with LabVIEW. 🙂
0 Kudos
Message 9 of 9
(3,347 Views)