Step 5: Build, Program and Observe the Output

Last modified by Microchip on 2026/06/26 07:40

Hardware Setup

Connect the PIC32CM LS00 Curiosity Nano+ Touch Evaluation Kit to the host PC using a Type-A male to Micro-B USB cable. Plug the cable into the Micro-B USB (debug USB) port on the evaluation kit.

PIC32CM LS00 Curiosity Nano+ Touch Evaluation Kit connected to host PC

Open the Project Properties, under Connected Hardware Tool section, and then select the PIC32CM LS00 Curiosity Nano+ Touch Evaluation Kit as shown in the accompanying image.

Project Properties window

​​​​​

Then click Apply and Ok.


Building the Project

To build the project, select the Clean and Build Main Project option from the Clean and Build drop-down menu.

Clean and Build menu

Observe that the project has compiled and loaded successfully, as indicated by the BUILD SUCCESSFUL message in the Output window.

BUILD SUCCESSFUL message


Debugging and Observing the Output

Set a breakpoint as shown in the accompanying image.

breakpoint example

Information

Note: Refer to Lab 1 Step 4 for setting a breakpoint and other debugging tips.

Right click on the sram_global variable and click on New Watch... (or use shortcut Ctrl + Shift + F9).

sram_global variable right-clicked

Click Ok in the New Watch window.

New Watch window

Click the Debug Main Project button to debug the project on the PIC32CM LS00 Curiosity Nano+ Touch Evaluation Kit.​​​​

Debug Main Project button

Once the debugging is complete, you can notice the Output window as shown in the accompanying image.

Output window

Go to the Variables window and observe that the address and value of the SRAM variable are displayed.

Variables window

When the Continue button is clicked, the value increments while the SRAM address remains unchanged.

Continue button

Information

Note: Refer to Lab 1 Step 4 for the detailed explanation of the all the options available for debugging.

Go to Window > Debugging > Disassembly to open the disassembly window and visualize the flow of the instructions.

Window drop-down menu

Dissassembly(main) tab

Notice the highlighted parts of the following code:

  • 0x4028A: MOVW R3, #57360
    0x4028E: MOVT R3, #57344

    #57360 and #57344

    The address range for System control space is 0xE000xxxx. From the assembly instructions above for SysTick (where SysTick belongs to System Control Space):

    • (57360)2 = 0xE010
    • (57344)2 = 0xE000

    MOVW R3, #57360 means move wide (loads lower 16 bits of a register 3).

    MOVT R3, #57344 means move top (loads upper 16 bits of a register 3).

    Therefore, the address of the SysTick will be 0xE000E010, which falls within the range for System Control Space (SCS).

  • 0x402A2: MOVW R3, #32884
    0x402A6: MOVT R3, #8192

    #32884 and #8192

    The address range for SRAM is 0x2000xxxx. From the assembly instructions above for SRAM:

    • (32884)= 8074
    • (8192)= 2000.

    MOVW R3, #32884 and MOVT R3, #8192 together form the address 0x20008074, which lies within the SRAM address range.

  • 0x402B8: MOVW R3, #12288
    0x402BC: MOVT R3, #16384

    #12288 and #16384

    The address range for Peripheral (GPIO) is 0x4000xxxx. From the assembly instructions above for SRAM:

    • (12288)= 3000
    • (16384)= 4000

    MOVW R3, #12288 and MOVT R3,  #16384 together produce the address 0x40003000, which falls within the Peripheral address range.

The user LED toggles (switching on and off) when the Continue button is clicked.

PIC32CM LS00 Curiosity Nano+ Touch Evaluation Kit light

Back to Top