LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data conversion from 212 format

I found a problem during conversion data.
I have a file which contains ASCII characters (in fact they're look
like ASCII on any editor) . I have to convert them to integer but I
know that data are organised into pairs of 12bit numbers packed into
byte triplets (format 212).

I made some vi (which convert 2 following ASCII characters to binary,
then divide them to pairs of 4bits, then some rotation etc..) but the
whole conversion takes too much time (64kb file conversion is taking
approx. 1minute).

Thank you for any suggestions,
Michael (muirgen@pf.pl)
0 Kudos
Message 1 of 7
(3,843 Views)
> I made some vi (which convert 2 following ASCII characters to binary,
> then divide them to pairs of 4bits, then some rotation etc..) but the
> whole conversion takes too much time (64kb file conversion is taking
> approx. 1minute).
>

This is one of those things that is quite sensitive to how it is coded.
If you make your VI available, others, including myself can give you a
hand with speeding it up.

As for guessing at what might be going on, first look at the array wire.
If you are using locals or property nodes to access the array, that is
the cause. If the array is written to a global and later accessed via
the global, that is causing it.

I suspect that the bit manipulations on 64K should take something like a
few seconds.

Greg McKaskle
0 Kudos
Message 2 of 7
(3,843 Views)
On Wed, 18 Sep 2002 02:27:25 GMT, Greg McKaskle
wrote:

>This is one of those things that is quite sensitive to how it is coded.
> If you make your VI available, others, including myself can give you a
>hand with speeding it up.
>
>As for guessing at what might be going on, first look at the array wire.
> If you are using locals or property nodes to access the array, that is
>the cause. If the array is written to a global and later accessed via
>the global, that is causing it.
>
>I suspect that the bit manipulations on 64K should take something like a
>few seconds.
>
>Greg McKaskle

Thank you for your support.

In this case I have only one vi and I don't use any global/local
variables.
At the beginning of the vi I load all
text character from file to
memory and then I'm making further operations.

If it helps I can send the vi with data file.

Thnx,

Michael (muirgen@pf.pl)
0 Kudos
Message 3 of 7
(3,843 Views)
Dear Michal,

I hope this vi work faster.

Input: 3bytes, data type unsigned int (U8)
Output: 2 values, data type integer. (INT16)

of course read all file to memory. Don't read everytime from file by 3
bytes.

Deniss

ps. vi i send by e-mail.

"Michal Szaj" wrote in message
news:t7choucisnu6pv0rmh0ntbph10ps411qrc@4ax.com...
> On Wed, 18 Sep 2002 02:27:25 GMT, Greg McKaskle
> wrote:
>
> >This is one of those things that is quite sensitive to how it is coded.
> > If you make your VI available, others, including myself can give you a
> >hand with speeding it up.
> >
> >As for guessing at what might be going on, first look at the array wire.
> > If you are using locals or property nodes to access the a
rray, that is
> >the cause. If the array is written to a global and later accessed via
> >the global, that is causing it.
> >
> >I suspect that the bit manipulations on 64K should take something like a
> >few seconds.
> >
> >Greg McKaskle
>
> Thank you for your support.
>
> In this case I have only one vi and I don't use any global/local
> variables.
> At the beginning of the vi I load all text character from file to
> memory and then I'm making further operations.
>
> If it helps I can send the vi with data file.
>
> Thnx,
>
> Michael (muirgen@pf.pl)
0 Kudos
Message 4 of 7
(3,843 Views)
Great problem...

I think I've got it a little faster... first covert the output of a "file
read" to a Byte Array (U8)... then feed the string into a For Loop with a
shift register index into 3 bytes at a time (deleting the 3 bytes from the
string each time around the loop)... use the "split number" function and
then the "join number" functions to re-group the bits (including an extra 4
bits of zeros to create a 32 bit Integer)... pass the Integers out of the
loop enabling indexing. When the loop finishes reshape the array!

Good luck,
Bill

Muirgen wrote in message
news:hdmeou86f3t81rp0tlhqsvqou2av2tmguh@4ax.com...
> I found a problem during conversion data.
> I have a file which contains ASCII characters (in fact they're look
> like ASCII on a
ny editor) . I have to convert them to integer but I
> know that data are organised into pairs of 12bit numbers packed into
> byte triplets (format 212).
>
> I made some vi (which convert 2 following ASCII characters to binary,
> then divide them to pairs of 4bits, then some rotation etc..) but the
> whole conversion takes too much time (64kb file conversion is taking
> approx. 1minute).
>
> Thank you for any suggestions,
> Michael (muirgen@pf.pl)
0 Kudos
Message 5 of 7
(3,844 Views)

Bill,

Taking some of your following suggestions, I have tried to make a vi which needs to read a 212 format binary file. I will greatly appreciate if you can suggest me with what I need to change so as to read a data file continuously.

Please see attached vi.

Thanks.

0 Kudos
Message 6 of 7
(3,678 Views)
I am not exactly sure what you need to decode your file, but I can show you how to break pieces of a file all the way up into binary data. This will allow you to reform the data any way you would like. Below is an example that I made from the "best guess" of what the data in your file looks like. Perhaps using this example you can find the exact answer to your problem.

The main idea of the example is taking the three U8's and converting them all the way down to a boolean array (binary values). After that I split the middle one and put four bits with each of the outer two. Finally I converted those values back into integers.

I hope this helps enough to get you on the right track.

Regards,
Rick Kuhlman
Applications Engineer
0 Kudos
Message 7 of 7
(3,639 Views)