Data Commands

To display information about the data commands available in the MDB, type help data. The table below provides additional information for this class of commands.

Table 1. Data Commands
Command Description
Print Prints a variable with optional formatting.

Command format:

print [/f] [/datasize:value] variable

  • f - Optional format letter

    The format letters supported are:

    x - Print as integer in signed hexadecimal.

    d - Print as integer in signed decimal.

    a - Print the address of a symbol.

  • datasize:value – optional data size.

    Variable in assembly code might not have data size information. The user can specify the data size if the .cof or .elf file does not have the size information.

    The values supported are:

    1 - The data size is 1 byte.

    2 - The data size is 2 bytes.

    4 - The data size is 4 byte.

    Use this command (not case sensitive) to display the pin information.

Command format:

print pin pinName

Example:

print pin RA0

This command will print Pin, mode, Value, and Owner or Mapping.

  • For Pin, it displays the name of the signal that the user types to find the pin
  • For Mode, it displays the A/D state and I/O state
  • For Value, it displays HIGH/LOW for Digital mode or the HIGH/LOW nominal voltage for Analog mode
  • For Owner or Mapping, it displays the pin owner and all the signals in this pin
  • The owner of the pin is the signal with parentheses.
Stim Specifies a simulator SCL stimulus file to use.
This loads the specified SCL stimulus file into the simulator, or if no path to the file is specified, it clears a loaded file.
Note: If the path or filename has spaces in it, you must use the quotation marks, as shown below. If there are no spaces in the path of filename, the quotation marks are not needed.

Command format:

Stim “[path to file]”

Stim

Write Use this command to write to memory.

Command format:

write [/t] addr word1 word2 ... wordn

  • t - the type of memory. The type of memory is any of the following:

    r – File Registers (RAM) memory. This is the initial default.

    p – Program (flash) memory

    e – EE Data memory

    Each time you specify a memory type with write, that type becomes the default memory the next time you use write.

  • addr – the starting address where you want MDB to begin writing to memory
  • word – the following values will be written to successive words of memory

Use this command to set a pin high or low when the simulator is used as a debug tool.

Command format:

write pin pinName pinState

Example:

write pin RA0 high

Use this command to set a the voltage of a pin when the simulator is used as a debug tool.

Command format:

write pin pinName pinVoltage

Example:

write pin RA0 3.3V

x Examine memory.

You can use the command x (for examine) to examine memory in any of several formats, independent of your program’s data types.

Command format:

x [/tnfu] [addr]

  • t – the type of memory.
    Note: Each time you specify a memory type with x, that type becomes the default memory the next time you use x. The type of memory is any of the following:

    r – File Registers (RAM) memory. This is the initial default.

    p – Program (flash) memory.

    m – Memory-mapped control registers (PIC32 peripheral memory).

    e – EE Data memory.

  • n – the repeat count. Repeat count is a decimal integer; the default is 1. It specifies how much memory (counting by units u) to display.

    f – the display format. The display format is one of the formats used by print (x, d, o, f, s), and in addition “i” (for machine instructions). The default is ‘x’ (hexadecimal) initially. The default changes each time you use x.

    u – the unit size. Each time you specify a unit size with x, that size becomes the default unit the next time you use x. (For the ‘s’ and ‘i’ formats, the unit size is ignored and is normally not written.) The unit size is any of following:

    b – Bytes.

    h – Halfwords (two bytes).

    w – Words (four bytes). This is the initial default.

  • addr - the starting display address where you want MDB to begin displaying memory. The addr can be a literal or a symbol name. The default for addr, if not specified, is taken as the value just after the last address examined. However, several other commands also set the default address: info breakpoints (to the address of the last breakpoint listed); info line (to the starting address of a line); and print (if you use it to display a value from memory).