The Start External Program panel in the Program Devices visualizer lets you run an external program to program your device. The external program could use 3rd party software to configure, program or test your device. It can be an executable or batch file.
MegunoLink can check the value returned by the external program to determine if it succeeded or failed. This can be used to control programming sequences.
If your external program and MegunoLink both use the same serial port, MegunoLink can close ports before starting the external program to avoid conflicts. The ports will be reconnected automatically once the external program closes.
Creating a ‘Start External Program’ Panel
To create a panel for starting an external program, click the Add Programmer drop-down menu on the Program Devices visualizer toolbar. Select Start External Program from the list.
Use the Name field to help you remember what the panel is for. After you have configured the external program (see below), you can press the run button to start the program. The indicator will show:
- READY while it is waiting for the program to run.
- PASS when the program has completed successfully (returned the correct result code if result-code checking is enabled).
- FAIL when the program has finished but returned an error code (if result-code checking is enabled).
- TIMEOUT if the program has taken too long to complete (and time-out is enabled).
The lock button disables the Run button. This helps accidentally programming the wrong device if many panels are active. It also disables the panel for programming sequences.
Configuring a ‘Start External Program’ Panel
The main thing to configure is the program which is started by the panel. This can be an
.bat file. Use the Browse button to select the program you’d like to start. Right click on the filename to toggle between absolute paths and relative paths. Using paths relative to the project file makes your project more portable because it doesn’t rely on the target program being in the same place on a different computer.
Programs often set a result code to indicate success or failure. MegunoLink can test this result code when running a programming sequences to decide whether it should continue with the sequence or stop so you can resolve the error.
You can set the maximum amount of time MegunoLink will wait for a program to close before it reports a time-out error. MegunoLink doesn’t kill the external program after the time-out. If a time-out occurs during a serial programming sequence, the sequence will stop.
If your external program will use a serial port the MegunoLink may have open you can have MegunoLink close the port before starting the external program. Put the name of the port (
COM14, for example) in the box provided. Separate multiple ports using a comma (