DigiMetrix

cancel
Showing results for 
Search instead for 
Did you mean: 

Read from a txt datalog file

Hi All,

 

I want to make a VI to read a serial number of a system we have.

 

the problem is that it is a TXT file with a lot of info and a sertant point the serial number is in there as a binary number:

 

Example of the datalog: Datalog_VI_Info.JPG

 

Tnx in advance,

 

Henri

 

0 Kudos
Message 1 of 9
(7,413 Views)

Hello Henri,

 

I can suggest you the general approach how to get the a serial number from the string like on the screenshot. It would be something like below:

1) Find the substring "System serial number low nibble", lets say its index will be N. N+31 will be the end of that substring.

2) Find the first occurence of substring "Bit0" after the N+31 index. 

3) Extract part of string after "Bit0" until the end of line

4) Find there "=" sign, take part that is after "'=", trim, it will be 0 or 1. Convert to boolean, store.

5) Repeat steps 3,4 for "Bit1", "Bit2", "Bit3". You will have lower half-byte of serial number.

6) Repeat steps 1..5 for "System serial number high nibble" and "Bit0", "Bit1", "Bit2", "Bit3". You will have higher half-byte of serial number.

7) Convert booleans to a number by means of "Boolean Array To Number"

This should give you the serial number.

 

Hope this helps.

Best Regards,

Svetlana

0 Kudos
Message 2 of 9
(7,394 Views)

Tnx, I hope I can make this VI with your info... and if not I will check it here again...

 

Henri

0 Kudos
Message 3 of 9
(7,389 Views)

Hi Svetlana and all other,

 

I have started your advice.. but unfortunetly not all the datalog's have the low nibble on the same place... so anny tips how to do this........

see my screenshot....

 

kind regards Henri

0 Kudos
Message 4 of 9
(7,386 Views)

Hi All,

 

I made some progress with my VI.. the only question now is how can I make the input that I get from the datalog bigger. there are some datalog that the serial number is not read.... how can I expand this and also ceep the sn working....

 

Also I want to reset it all to be able to start the input of datalog more times by activating a boolian...

can someone help me in how to do this.....

Download All
0 Kudos
Message 5 of 9
(7,349 Views)

Hello Henri,

 

To avoid problems with some substrings in the parsed data not always appearing at same index - you can search substrings by "Match Pattern" or "Match Regular Expression" VI and then process only needed part of string.

 

Regarding how to expand the datalog - some additional info from you is needed. How do you get that datalog file? Is it returned by some DigiMetrix library VI? If yes, which one?

 

Best Regards,

Svetlana

 

 

0 Kudos
Message 6 of 9
(7,327 Views)

Tnx for the feedback,

 

I do not now if i understand the fist part... but I will have al lock at the to options that are mentioned

 

for the second part, the datalog is a txt file that is generated by one of our own machines.. I will iclude a few examples...

 

thanks again for the help....

 

Henri

0 Kudos
Message 7 of 9
(7,324 Views)

Henri,

 

I am not sure that I understand your goal right. I thought that you want the machine to provide bigger datalog - but since it is your own machine, I cannot advice anything here. 

 

If you want to get more data from that datalog files - please take a look into "Match Pattern" and "Match Regular Expression" standard VIs, they can be useful for your file parsing.

 

Regards,

Svetlana

0 Kudos
Message 8 of 9
(7,321 Views)

Tnx again...

 

I will tray to get it working like I want to...

sorry for the confusion... 🙂

 

Henri

0 Kudos
Message 9 of 9
(7,318 Views)