error in PWM module ECIO40

Forum for problems or queries regarding the Flowcode application and compiler usage.

Moderators: Benj, Mods

Post Reply
wim314
Posts: 12
Joined: Tue Dec 25, 2007 1:51 pm
Location: Belgium
Contact:

error in PWM module ECIO40

Post by wim314 »

To the MatrixMultimedia support engineers,

I think there is an error in the PWM module in Flowcode when using the ECIO40.
I want to use the alternate pin of PWM2, but it refuses to output the PWM signal to the RB3 pin. In both cases (Alternate Pin flag off or on), the PWM signal is routed to pin RC1.
When looking in the datasheet of the 18F4455, the CCP2MX bit of the CONFIG3H register should have been cleared (set to '0') when using the alternate pin configuration. The C-code which is generated by Flowcode always put this value to '1', regardless the flag is set or not.
How can I circumvent this? I want to use the alternate pin for PWM2.
I have tried to force this by adding a block of C-code in Flowcode, with the command
#pragma DATA 0x300005, 0x80
in the hope this will override the settings of the PWM module of Flowcode. It does not work, as Flowcode tells me there is somewhere an error in the C code and hence refuses to compile to ASM.
Can you help me out?

Thanks,Wim

User avatar
Steve
Matrix Staff
Posts: 3422
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: error in PWM module ECIO40

Post by Steve »

Flowcode cannot easily override this config value, so you need to alter this config word manually - i.e. clear it at the same time you enter the other config data.

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: error in PWM module ECIO40

Post by Benj »

Hello

Browse to the Flowcode FCD folder - normally C:/program files/MatrixMultimedia/Flowcode V3/fcd and find the ECIO40P.fcd file. Open this file with a text editor.

Browse to the following section in the code.

Code: Select all

[Config]
0=0x20
1=0x0E
2=0x3E
3=0x1E
4=0x00
5=0x81
6=0x81
7=0x00
8=0x0F
9=0x80
10=0x0F
11=0xA0
12=0x0F
13=0x00
Edit the line beginning "5=" and replace with this.

Code: Select all

5=0x80
Save the file and Restart Flowcode and now RB0 will now be used for PWM channel 2.

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times
Contact:

Re: error in PWM module ECIO40

Post by jadiflow »

To Wim314: The #pragma statement works correctly when you 'connect' an 'AddDefines' component and then put the #pragma's in an AddDefine 'component macro'.

Jan Didden

Post Reply