Running a Command File Method

Note: Although the MPLAB X IDE can run multiple tools simultaneously, the MDB will run only one tool at a time. However, you can have multiple instances of the MDB running. Refer to Using Multiple Instances of the MDB for details

If programming and debugging needs to be done frequently or multiple times, run the test by running a command file. This is more efficient than entering the commands repeatedly. Put all the commands in a file and run the MDB using this command file in the Command Prompt, for example:

C:\Program Files\Microchip\MPLABX\vn.nn\mplab_ide\bin>mdb.bat <commandfile.txt>

The following is an example of a command file:

C:\MDB-SIMCommand_Target.txt

A line starting with # means that it is a comment. A Sleep command should be added to make sure the MDB has enough time to finish the previous command before it executes the next command. The MDB will run all the commands in the command file sequentially.

Figure 1. Example of Running a Command Line

Creating a Printable Log File

Redirecting output to a file is a general option that can be executed from the command prompt and is not specific to the MDB batch file. Redirecting output to a printable text file can be more useful for examining errors than looking at the Command Prompt window.

To create a printable file, open the MDB.bat file, and modify it by adding >>%mplabx_dir%\bin\mdblog.txt at the end of the batch file. This instructs the batch file to create the mdblog.txt file, which can be printed.