configure remapping on 33FJ64

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
Mathy
Posts: 333
Joined: Mon Oct 05, 2009 2:39 pm
Has thanked: 30 times
Been thanked: 33 times

configure remapping on 33FJ64

Post by Mathy »

Hello :)

I'm trying to use more than 2 PWM on the dsPIC32FJ64.

I made some change to the PIC16BIT_PWM.c file but I don't understand how work the remapping settings.

For example, in the generated c file you have :

//configure remapping
RPOR0 = (RPOR0 & 0xFF00) | 0x0012; //Assign PWM OC1 - RP0 / PORTB0
RPOR0 = (RPOR0 & 0x00FF) | 0x1300; //Assign PWM OC2 - RP1 / PORTB1

How can I assign PORTB2 and PORTB3 for OC3 & OC4 ?

Thank you for your help :)

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: configure remapping on 33FJ64

Post by Benj »

Hello,

What is the full part number of the device so I can check the OC2 and OC3 values.

Probably something like this if OC3 is 0x14 and OC4 is 0x15.

RPOR1 = (RPOR1 & 0xFF00) | 0x0014; //Assign PWM OC3 - RP2 / PORTB2
RPOR1 = (RPOR1 & 0x00FF) | 0x1500; //Assign PWM OC4 - RP3 / PORTB3

Mathy
Posts: 333
Joined: Mon Oct 05, 2009 2:39 pm
Has thanked: 30 times
Been thanked: 33 times

Re: configure remapping on 33FJ64

Post by Mathy »

Hello :)

Thank you for answering.

The full part number is 33FJ64MC802.
I tried with the code you gave me but without success.

I attached the .c file to see what I'm doing wrong.

Is the FCD file need to be changed ?

Thank you again :)
Attachments
PIC16BIT_PWM.c
(7.34 KiB) Downloaded 273 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: configure remapping on 33FJ64

Post by Benj »

Hello,

Right I have had a look at the datasheet and the code I gave to you should be correct for remapping the extra PWM pins to RB2 and 3. I've also had a look through your PWM code and this also looks to be correct. The FCD I have is correctly listing 4 PWM channels so the code should be working. Does the code compile correctly for you?

Mathy
Posts: 333
Joined: Mon Oct 05, 2009 2:39 pm
Has thanked: 30 times
Been thanked: 33 times

Re: configure remapping on 33FJ64

Post by Mathy »

Hello,

Yes the code compile correctly.

I can generate the .hex file but I have only the two PWM channel active. The third and fourth are inactive.

Post Reply