Datasheet
Specific Debug Functions: 8- and 16-Bit Devices
2013 Microchip Technology Inc. DS52085A-page 63
6.5 APPLICATION IN/OUT
The Application In/Out window allows you to interact with a running application using
the Application Input/Output feature supported on some devices. Using this feature,
data may be sent serially to and from the target application and, during runtime, over
the same PGC/PGD lines used for debugging. Data written to the APPOUT register will
be displayed to the window, while user input will be sent to the target application and
available in the APPIN register.
To use the Application In/Out window:
• Use the device-specific header file when building your application to use the
macros assigned in the header (per Example 6-6.)
• In the future, the 16-bit device library will have printf() and scanf() functions
for use with the Application In/Out feature, as referenced in the “16-Bit
Debug-Support Library” chapter of the 16-Bit Language Tools Libraries
(DS51456) document.
EXAMPLE 6-6: APPLICATION IN/OUT MACRO USAGE
The following application code reads the application input register and writes out a pad-
ded value of the input to the application output register.
// include file
#include <p33Exxxx.h>
// set up config bits
_FWDT( FWDTEN_OFF )
// initialize variables
unsigned int val;
int i;
unsigned int oval;
int main(void)
{
while(1)
{
if(APPSbits.APIFUL) // APPI is full?
{
val = _APPIN; // Read User Input
for(i=0; i<4; i++)
{
while(APPSbits.AROFUL); // APPO is full?
oval = val&0xFF;
if(oval < 0x20)
oval = 0x20;
oval |= 0x20202000;
_APPO = oval; // Send to MPLAB X IDE
val >>= 8;
}
}
}
}
Note: This window is only available for devices that support the application in/out
function used with the MPLAB REAL ICE in-circuit emulator or MPLAB ICD
3 in-circuit debugger. For details, see online help, “Device and Feature Sup-
port”.