Attaching SCL

This section creates a simple simulator debug session in MPLAB X and then executes the SCL program created in the last section.

  • Open MPLAB X and create a simple, non-terminating, PIC18F4620 project using the simulator as the debug tool. Here is a likely program:

  • int main(int argc, char** argv) {
       while (1);
    }

  • Create a watch on the ADRESH register and observe that its value is 0x00.

  • Debug run the program.

  • Open the stimulus window from the MPLAB X main menu
  • Window -> Simulator -> Stimulus

  • In the Stimulus window, click the Attach SCL File button (second from top on left hand side), and browse to the mySCL.scl file created in the first step.
  • Click the Open button. At this point the mySCL.scl program will be executed.
  • Return to the Watches window and observer that ADRESH is now 0xBB!
  • Congratulations, you have just executed your first SCL program which injected a value to an SFR while during simulator execution!