03-11-2019 08:50 AM
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
03-12-2019 03:37 AM
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
03-12-2019 09:20 AM
Tnx, I hope I can make this VI with your info... and if not I will check it here again...
Henri
03-12-2019 10:46 AM
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
03-18-2019 02:41 PM
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.....
03-19-2019 08:27 AM
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
03-19-2019 08:38 AM
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
03-19-2019 09:06 AM
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
03-19-2019 09:24 AM
Tnx again...
I will tray to get it working like I want to...
sorry for the confusion... 🙂
Henri