Page 1 of 1

dsPIC33 - RS232 Module + Peripherial Pin Select

Posted: Wed Feb 06, 2013 10:26 pm
by ronaldlijs
Hello all,

I am using Flowcode 5 to program mostly dsPIC devices (30 and 33 series) and I'm trying to use the the RS232 module to make 2 of these communicate between each other in the simplest of ways.

The dsPIC I'm using is a dsPIC33EP512GP806 with a great feature called Peripheral Pin Select which essentially allows one to configure most pins to act as specific I/O pins. Below a more thorough description of this feature.

Anyway, my question is simple: for the RS232 module in Flowcode (in hardware mode), how do I configure the specific pins I want to act as UART1 TX and RX? I assume it's a bit of C code stuck to the start of the program, but I am just assuming... don't know what exactly either.

Thanks for your help...
Ronald

PERIPHERAL PIN SELECT
A major challenge in general-purpose devices is providing the largest possible set of peripheral features while minimizing the conflict of features on I/O pins. The challenge is even greater on low pin-count devices. In an application where more than one peripheral needs to be assigned to a single pin, inconvenient workarounds in application code or a complete redesign may be the only option.
Peripheral pin select configuration provides an alternative to these choices by enabling peripheral set selection and their placement on a wide range of I/O pins. By increasing the pinout options available on a particular device, users can better tailor the microcontroller to their entire application, rather than trimming the application to fit the device.
The peripheral pin select configuration feature operates over a fixed subset of digital I/O pins. Users may independently map the input and/or output of most digital peripherals to any one of these I/O pins. Peripheral pin select is performed in software and generally does not require the device to be reprogrammed. Hardware safeguards are included that prevent accidental or spurious changes to the peripheral mapping once it has been established."

Re: dsPIC33 - RS232 Module + Peripherial Pin Select

Posted: Wed Feb 06, 2013 11:42 pm
by kersing
You will need to add a C-code block to your program (before using the RS232 macro's).

If you want to set UART1 RX to pin RP97 and UART1 TX to pin RP80 use:

Code: Select all

RPINR18bits.U1RXR = 0b1001111;
RPOR4bits.RP80R = 0b000001;
To find this, for the input side, locate the function you want to configure (UART1 RX - on page 238 of the data sheet) to determine the name of the register to set. Then locate the code for the pin you want to use in table 11-2 on page 213.
For the output locate the pin you want to use, search the data sheet for the output register and bits within the register for that pin (REGISTER 11-48 on page 263). Then use table 11-3 to find the function you want to assign (UART1 TX - U1TX).

Re: dsPIC33 - RS232 Module + Peripherial Pin Select

Posted: Thu Feb 07, 2013 7:20 am
by ronaldlijs
Thanks Jac,

This is of great help.

Ronald