EasyManuals Logo

Microchip Technology dsPIC33 Family Reference Manual

Microchip Technology dsPIC33
26 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #17 background imageLoading...
Page #17 background image
2006-2019 Microchip Technology Inc. DS30009711C-page 17
I/O Ports with PPS
Example 4-1: Configuring UART1 Input and Output Functions
//*************************************************************
// Unlock Registers
//*************************************************************
__builtin_write_OSCCONL(OSCCON & 0xbf) //clear the bit 6 of OSCCONL to
//unlock Pin Re-map
//******************************************************************
//This code is used when interested in inline assembly. If this code is //
used then the above two lines should not be used for unlocking.
//******************************************************************
/*
asm volatile ( “push w1 \n”
“push w2 \n”
“push w3 \n”
"mov #OSCCON, w1 \n"
"mov #0x46, w2 \n"
"mov #0x57, w3 \n"
"mov.b w2, [w1] \n"
"mov.b w3, [w1] \n"
"bclr OSCCON, #6 \n"
“pop w3 \n”
“pop w2 \n”
“pop w1”);
*/
//************************************************************
// Configure Input Functions
//************************************************************
//***************************
// Assign U1Rx To Pin RP0
//***************************
RPINR18bits.U1RXR = 0; //’0’ represents RP0
//***************************
// Assign U1CTS To Pin RP1
//***************************
RPINR18bits.U1CTSR = 1; //’1’ represents RP1
//************************************************************
// Configure Output Functions
//************************************************************
//***************************
// Assign U1Tx To Pin RP2
//***************************
RPOR1bits.RP2R = 3; //’3’ represents U1TX
//***************************
// Assign U1RTS To Pin RP3
//***************************
RPOR1bits.RP3R = 4; //’4’ represents U1RTS
//************************************************************
// Lock Registers
//************************************************************
__builtin_write_OSCCONL(OSCCON | 0x40) //set the bit 6 of OSCCONL to
//lock Pin Re-map
//******************************************************************
//This code is used when interested in inline assembly. If this code is //
used then the above two lines should not be used for unlocking.
//******************************************************************
/*
asm volatile ( “push w1 \n”
“push w2 \n”
“push w3 \n”
"mov #OSCCON, w1 \n"
"mov #0x46, w2 \n"
"mov #0x57, w3 \n"
"mov.b w2, [w1] \n"
"mov.b w3, [w1] \n"
"bset OSCCON, #6 \n"
“pop w3 \n”
“pop w2 \n”
“pop w1”;
*/

Other manuals for Microchip Technology dsPIC33

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Microchip Technology dsPIC33 and is the answer not in the manual?

Microchip Technology dsPIC33 Specifications

General IconGeneral
BrandMicrochip Technology
ModeldsPIC33
CategoryI/O Systems
LanguageEnglish

Related product manuals