Function |
|
Enter the debug mode |
Purpose |
|
IQRF OS directly supports debugging and testing. It is possible to stop the application wherever you need and display internal values (variables, RAM registers, EEPROM etc.) and then continue later on. |
Syntax |
|
void debug() |
Parameters |
|
– |
Return value |
|
– |
Output values |
|
OS directly returns no value but supports using W (PIC accumulator) to identify which of the debug points is currently active. |
Preconditions |
|
• Debug should be used with a corresponding development kit (e.g. CK-USB-04x) and the IQRF IDE development environment. • To avoid possible HW collision with respect to user application, debug operates only under the following conditions: • Pins C5 to C8 or Q6 to Q9 are initialized for SPI Slave (C8 or Q8 out, the others in) by OS. But after a possible subsequent change in direction of these pins (through manipulation with corresponding TRIS registers) by the user, the user must recover them before using debug. • The Check Mode function is enabled in IQRF IDE. Otherwise, no communication on these pins is initiated by debug tools even though TR is in debug mode until the Check Mode is enabled. • SPI need not be enabled by enableSPI • Timer6 is not automatically stopped and user interrupt is not automatically disabled in debug. • When entering debug, the application must not have enabled interrupt from any of user peripherals. • Debug must not be used within the user interrupt routine. |
Remarks |
|
The number of debug instances is unlimited. The application is running until a debug function is encountered. Then the program is stopped and the module is switched to the debug mode allowing IQRF IDE to display values. The module stays in the debug mode until the user selects the Skip Breakpoint button. Then the application program continues running until another debug function is encounteterd and so on. See IQRF IDE Help and Example E04-EEPROM. |
Side effects |
|
• Watchdog is cleared while in Debug mode • param2, memoryOffsetTo, memoryOffsetFrom, and memoryLimit are modified and not displayed in the IQRF IDE Watch window. • Register W is modified. |
See also |
|
|
Example 1 |
|
if (compareBufferINFO2RF(4)) W = 1; // Match else W = 2; // Mismatch debug(); // Skip Breakpoint 1 or 2 will be displayed here according the result |
Example 2 |
|
// Similar as Example 1 but utilizing macro breakpoint. // See header file IQRF-macros.h. if (compareBufferINFO2RF(4)) { breakpoint(1); // Match } else { breakpoint(2); // Mismatch } // Skip Breakpoint 1 or 2 will be displayed here according the result |