02-24-2019 10:27 AM
We use TestStand 2014 for all of our development. We have 1000's of files which have 1 line of text which goes something like this:
Gain1, 0x111, Offset1, 0x01,Gain2, 0xA12, Offset2, 0x0F......
I know the name of the file and so I must find it and parse it. There are 24 separate elements which go like the aforementioned line. I want to pull in the contents of this 1 line file and fill the 12 hex numbers into TestStand numeric variables. How can I solve this problem?
02-25-2019 11:50 AM
I've done something similar where we call the files "recipes". They were in JSON. We read them in and generate a sequence which we can execute using the limits and parameters from the "recipes". You need some sort of mapping capability to map each element to a lookup string for the step. In your case though you might be able to get away with assuming things are always in the same order.
The question is: How do you know which variable you want to map the offset or gain value to?
02-25-2019 01:54 PM
You can import the content of a .csv file to Teststand using the Property Loader step. The detail is that to use this feature you need to give the .csv file a certain format for Teststand to recognize where to place the input parameters (destination step and variable).
To obtain the format necessary for the sequence you are using, you can export a .csv file first where you specify the destination variables and use it as a template where you can write the parameters you are planning to import. In this article you can find more details about it:
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019RPoSAM&l=en-US
Since you have multiple files that require this treathment, you could create a script that gives all of the files the required format (it could be in LabVIEW or another programming language).
Also, to convert a String variable that contains an hexadecimal number to its numeric counterpart, you could use the Teststand expression:
Val("0x" + Locals.Value_Read)
I hope that helps.
02-25-2019 10:03 PM
The order is always the same with a name starting with Gain1, 0x??? followed by an Offset1, 0x???, where ? = a hex number, until the last Gain12, 0x???,Offset12,0x???. In my actual file, each gain has a unique name like LTA_Gain or LTA_Offset or AA_Gain or AA_Offset etc. But the order and names are always the same. Only the hex numbers will be different.
02-26-2019 09:10 AM
I understood that part, the detail is that Teststand needs you to format the file in certain way to be able to import the parameters directly to the variables of a step. Now, alternatively you could create a VI in LabVIEW (or a little program in another programming language) that processes the .csv files in such a way that you can manipulate the data from the file as an output of such program. Then you can import it to Teststand in an action step and save the values to the type of variable that you see fit for your sequence.
I believe that could be easier.
02-26-2019 10:47 AM
@TonyJ wrote:
The order is always the same with a name starting with Gain1, 0x??? followed by an Offset1, 0x???, where ? = a hex number, until the last Gain12, 0x???,Offset12,0x???. In my actual file, each gain has a unique name like LTA_Gain or LTA_Offset or AA_Gain or AA_Offset etc. But the order and names are always the same. Only the hex numbers will be different.
What do you want to do with these values? Are you using them as limits for a step or as parameters to something? I guess my question is why do you need them in TestStand and where do you want to put them?
Cheers,
02-27-2019 01:28 AM
At the beginning of my sequence I save the PCBA Gains and Offsets to a .csv file via a DOS batch file. During the flash process if a failure is detected (bootloader or app) the board switches to default values and the original values from a previous process (functional test) are lost. I want to pass those values in the textfile and rewrite the Gains and Offsets after the board fails. This occurs in a post flash process after the board is passed thru a repair loop. Once a board fails flash its ability to communicate via CAN is no longer possible. Each Gain and Offset once passed after the repair loop and a successful flash will have it's original Gains and Offsets rewritten.
02-27-2019 04:50 PM
How are you going to write the values back to the flash?
02-28-2019 07:30 AM
I actually will write the values to EEPROM. Once the product software is rewritten there is a safety feature on the final product which blanks out the Gains/Offsets and place defaults there. I guess I'm confusing you because of the flash operation. I will reflash these failed boards and after a power cycle the internal firmware will load default values in EEPROM. Each flash operation before I do anything I save the Gains/Offsets to a .csv file. Only boards which failed flash will be reflashed and loaded with their original Gains/Offsets. I have 2 test sequences. The second of which will only test failed boards, read the .csv file and write the Gains/Offsets using CAN. I want to copy .csv file values into local variables of which I can then build my CAN messages. Thanks for your patience.
02-28-2019 11:09 AM
If it were me I would just create a VI in LabVIEW that reads in the text file and pushes it out to flash through CAN. That way I wouldn't need to put them in a TestStand Variable.
However, if that is not an option then you need to use a code module to read in the file and then assign the variables to the output of the code modules. Which programming language are you using to do your CAN or is it all through IVI steps or some other custom step?