31.01.2013 Views

mplab c18 c compiler getting started - Computer & Information Science

mplab c18 c compiler getting started - Computer & Information Science

mplab c18 c compiler getting started - Computer & Information Science

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

MPLAB ® C18 C Compiler Getting Started<br />

4.3.4 Test Program 2<br />

Like in the first program, the simulator in MPLAB IDE will be used to test this code.<br />

Make sure that the simulator is enabled. The project may need to be built again if the<br />

simulator was not already selected.<br />

To test the code, the state of the pins on PORTB must be monitored. In MPLAB IDE,<br />

there are a two ways to do this.<br />

4.3.4.1 USING THE MOUSE OVER VARIABLE<br />

After the project is successfully built, use the mouse to place the text editor cursor over<br />

a variable name in the editor window to show the current value of that variable. Before<br />

this program is run, a mouse over PORTB should show its value of zero (see<br />

Figure 4-6):<br />

FIGURE 4-6: MOUSE OVER PORTB BEFORE PROGRAM EXECUTION<br />

Click the Run icon (or select Debug>Run), then click the Halt icon and do the mouse<br />

over again. The value should now be 0x5A (Figure 4-7):<br />

FIGURE 4-7: MOUSE OVER PORTB AFTER PROGRAM EXECUTION<br />

DS51295F-page 46 © 2005 Microchip Technology Inc.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!