Running a Command File Method
If programming and debugging needs to be done frequently or multiple times, run the test by running a command file. This will be more efficient than entering the commands repeatedly. Put all the commands in a file and run MDB using this command in the Command Prompt, for example:
C:\Program Files\Microchip\MPLABX\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. MDB will run all the commands in the command file sequentially.
Figure: Example of Running a Command File
Creating a Printable Log File
By default, the MDB generates xml log files into the MPLAB IDE binary log directory
<MPLAB X installation location>\mplab_ide\bin\log. 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.