01-08-2021 07:56 AM
Thank you, but I don't know how to do that. Do u know any good tutorials online that can help me with the same.
01-08-2021 08:05 AM
All you need is to know is about string manipulation (Format into String, Concatenate Strings and alike) and file I/O.
Those are quite general and easy tasks.There are examples in the general tutorials and the LabVIEW help.
What's the main difficulty?
01-08-2021 08:22 AM
Thank you, I am not talking about labview, I am talking about the cmd file. I am not sure how to make the cmd file accept input from an outer source.
01-08-2021 08:26 AM
I got a look at the documentation. For example, you may have an initial command string like
"STMFlashLoader -c --pn 2 -i STM8_32K"
then you concatenate the name of the chosen file:
"STMFlashLoader -c --pn 2 -i STM8_32K" + " -d --fn " + "chosenfile.hex"
then you decide to activate protection and concatenate another option:
"STMFlashLoader -c --pn 2 -i STM8_32K -d --fn chosenfile.hex" + " -p --erp".
The resulting string can be written to a text file with .cmd extension (example name: download.cmd).
Disclaimer: I'm not sure the example I gave is syntactically correct
01-08-2021 08:28 AM
@govindsankar ha scritto:
Thank you, I am not talking about labview, I am talking about the cmd file. I am not sure how to make the cmd file accept input from an outer source.
No need to accept input from whatever: you want to generate the complete command line.
01-11-2021 05:40 AM
Thank You,
I created the cmd file and it is able to download into device. Now I try running the cmd file in labview using system-exec.vi. But it is not working. I have attached two screenshots. One is the sreenshot when I just run the cmd file. There it works properly. Next when I run the cmd file using labview system-exec.vi. Then it is just opening an empty cmd page. I have attached the screenshot of that as well. Why is that. I have saved the cmd as .bat file. Is that the problem.
01-11-2021 06:17 AM
The empty command window is expected behaviour since the default for SystemExec() is to wait for the command to terminate "wait for completion? = True" and in that case the standard IO for the console is redirected to the LabVIEW SystemExec() and returned through the "standard output" string control in the front panel together with the "standard error", if the program reported any error. Since LabVIEW captured the standard IO, there is nothing for the command window to display.
You can set "run minimized" to true to not have that empty command line window popup on your screen.
You most likely do not want to set "wait for completion?" to False, as you really want to know when your flash script has finished.
But you can review the result of the command in the standard output and standard error controls of your System Exec VI.
01-11-2021 06:36 AM
Thank You, I just did what u said and I got it in standard output. But is there a way to have it in the cmd window or else, it is also fine if it is in standard output window as well. The problem is it takes around 30 seconds to flash the firmware and then verify. So when I do it in labview it will look like this 30 seconds nothing is happening and after 30 seconds the whole thing will appear in standard output. But if run it only in cmd window without labview then the cmd will show downloading line by line and not just the whole thing at the end. Is there a way to show that in labview as well that is line by line and not the whole thing together at the end in standard output. Thank You.
01-11-2021 07:03 AM
Not sure if it works: try redirecting output to a file, like this:
STMFlashLoader -c --pn 2 -i STM8_32K -d --fn chosenfile.hex > C:\temp\flashloader-output.txt
This command line should redirect the STMFlashLoader program output to a text file, located in a directory of your choice (here, C:\temp).
While the program is running, you may try to read and parse the file content. Not really super easy.
But not all the console programs support outputting to a file. Furthermore, the output file could be locked while opened by STMFlashLoader.
Give it a quick try.