Problem on 24FJ256GA106 and PWM

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
Contact:

Problem on 24FJ256GA106 and PWM

Post by Mathy »

Hi !

I have troubles when compiling on Flowcode 4 for dsPIC with an 24FJ256GA106 and PWM macro.
Is it possible to have a look at this ?

Thank you for your help :)
Attachments
PWM test.fcf_pic16
(5.5 KiB) Downloaded 319 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: Problem on 24FJ256GA106 and PWM

Post by Benj »

Hello,

I think if you add this C code to the defines section of the supplementary code window available from the project options window then it should fix the issue.

Code: Select all

#define OC1CON OC1CON1
#define OC2CON OC2CON1

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

Re: Problem on 24FJ256GA106 and PWM

Post by Mathy »

Yeah, it compiles well !

Thank you for the tip. I don't know if it works in the real life because I don't have my bord yet but I will post here as soon as I can.

Bye :)

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: Problem on 24FJ256GA106 and PWM

Post by Benj »

Ok no problem, let me know how you get on.

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

Re: Problem on 24FJ256GA106 and PWM

Post by Mathy »

Hello and best wishes for this new year :)

I think there is still a problem.
The program compile well but I can't see anything on the right pin.

I want to have my PWM on RP2/RD8 pin so I added this line in your pwm.c file :

RPOR1bits.RP2R = 0x12;

Nothing nothing nothing...

Do you have any idea ?

Thank you
Last edited by Mathy on Wed Jan 09, 2013 9:17 am, edited 1 time in total.

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

Re: Problem on 24FJ256GA106 and PWM

Post by Mathy »

Is it possible to the MM staff to have a look quickly on that ?

I'm blocked on my SPI accelerometer in flowcode 5 for PIC and now with PWM functionality with flowcode 4 for Dspic.

All my electronic board are already manufactured by Eurocircuits and now I have to load the program but it is impossible due to flowcode bugsssss

If you tell me that it is my problem and sort this out, OK. But if I could use some features of the software I purchased, it would be better.

Thank you for understanding.

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: Problem on 24FJ256GA106 and PWM

Post by LeighM »

Hi

You need to set it to 12 hex,, i.e. 0x12 or 18 decimal.

Regards,
Leigh

Code: Select all

RPOR1bits.RP2R = 0x12;

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

Re: Problem on 24FJ256GA106 and PWM

Post by Mathy »

Hi,

Thank you for your tips but I already edit my post because of this stupid mistake :oops:

But, no way, even if I set the right value, nothing happen :(

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

Re: Problem on 24FJ256GA106 and PWM

Post by Mathy »

Hello,

Just for information, I think there is really a bug with Flowcode and the 24FJ256GA106 ( I don't know if other 16bit PIC MCU are concerned ).
Because writing completely the PWM function in C and including it in my Flowcode program and it works like a charm !

So problem solved for me.

I have to see now what is going wrong with your accelerometer component in SPI mode with Flowcode 5 for 8bit PIC.

Have a nice day.

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: Problem on 24FJ256GA106 and PWM

Post by Benj »

Hello,

I see you are using PWM channel 3 which in the latest release I think should default to pin RP20 or 0x14.

Can you check this pin to see if PWM is working there as your setting could be being overridden by the Flowcode FCD and CAL setup.

It should be possible to change the default PWM pin by editing the FCD file and changing these lines of code in the [defines].

Code: Select all

Define139=#define MX_PWM_1_RP_OC 0x0012

Code: Select all

Define149=#define MX_PWM_3_RP_OC 0x0014
To what ever RP pin you require.

Post Reply