Page 1 of 1

PWM alternative PIN on PIC18

Posted: Sat Oct 10, 2009 3:17 pm
by JG1
FlowcodeV4 and Proteus files
Flowcode.zip
Hello
I have a problem on using "alternative pin" with CCP2 PWM on PIC18F4455 (pin 36). The simulation with Flowcode (V4) is OK but it doesn't work on my hardware and with Proteus.
On using normal PIN (pin 16) there is no problem.
It seems that the problem is the same with other PIC's 18F.
Files are attached to verify this.

Thanks on advance

Re: PWM alternative PIN on PIC18

Posted: Sat Oct 10, 2009 3:23 pm
by JG1
Sorry but the files are not accessible in the previous topic

Re: PWM alternative PIN on PIC18

Posted: Mon Oct 12, 2009 2:59 pm
by Benj
Hello

As well as setting the alternative PWM pin in the PWM component properties you also have to use the use alt PWM pin in the chip's configuration to allow the alternative pin to be enabled.
config.JPG
config.JPG (84.5 KiB) Viewed 9158 times
Let me know if you are still having problems and I will look into this for you.

Re: PWM alternative PIN on PIC18

Posted: Tue Oct 13, 2009 3:38 am
by JG1
Hello

Thank you Benj for your help.
The problem is solved with PIC18F4455, but normally I use an ECIO circuit and for this "object" the parameters are not accessible, so it's impossible to configure like your indications.
Have you a solution for ECIO ?

Best regards

Re: PWM alternative PIN on PIC18

Posted: Tue Oct 13, 2009 8:42 am
by Benj
Hello

Ok to change the ECIO config presets you can go into the Flowcode v4/FCD/ECIO40.FCD file using a text editor and edit the following lines.

This is the default configuration.

[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

This is the configuration for the alternate CCP pin.

[Config]
0=0x20
1=0x0E
2=0x3E
3=0x1E
4=0x00
5=0x80
6=0x81
7=0x00
8=0x0F
9=0x80
10=0x0F
11=0xA0
12=0x0F
13=0x00

After you have edited the file be sure to restart Flowcode to load the changes.

Re: PWM alternative PIN on PIC18

Posted: Thu Oct 15, 2009 8:17 am
by JG1
Hello Benj

Unfortunately your solution doesn't work (the "RB3" pin still remains at 1L)
I done several tries : particularly with CCP2 alternative pin checked or not

Best regards

Re: PWM alternative PIN on PIC18

Posted: Sun Oct 18, 2009 8:54 am
by JG1
Hello Benj

I am sorry to insist but I need help.
I have created a circuit, based on ECIO40 and using "RB3" for PWM, wich is diffused in 32 schools and I was convinced they were no problems.

Thanks a lot in advance

Best regards

JG1

Re: PWM alternative PIN on PIC18

Posted: Mon Oct 19, 2009 8:27 am
by Benj
Hello

Ok I have just given this a go here and it seems that you are right and the PWM is locked to RC1. Do you have a timer interrupt free that you could use for generating a bit banged PWM or do you need it to be hardware PWM driven?

If you do need it to be RB3 then do you have a pickit programmer or similar that you could use to reflash the ECIO firmware?

Re: PWM alternative PIN on PIC18

Posted: Mon Oct 19, 2009 4:03 pm
by JG1
Hello Benj

Thank for your reply.

My problem is that we are using ECIO base board (EB061) + ECIO40 circuits + Eblocks in a group of schools and it is important for us to remain in the standard version of firmware.
As well, for our different applications, we need to use sometimes RC1, sometimes RB3. Apart of that we may use a free timer interrupt (other than TMR0) : so please send me a "bit banged PWM", I don't see how it looks.

Thanks in advance

Best regards

Re: PWM alternative PIN on PIC18

Posted: Mon Oct 19, 2009 4:17 pm
by Benj
Hello

Ok you are probably best off staying with the default configuration settings then and bit banging the PWM for the RB3 signal.

There is a good example of bit banged PWM available from our Flowcode examples packs and also from this article.

http://www.matrixmultimedia.com/mmforum ... =26&t=6732

Let me know if you need any further help.

Re: PWM alternative PIN on PIC18

Posted: Mon May 03, 2010 4:48 pm
by JG1
Hello Benj or Steve

I come to you again after a few monthes because I really need a solution to the problem of the dysfunction of the alternative pin on CCP2 with ECIO40.
Is it possible for you to modify the file "PIC_PWM.ocx" or "ECIO-40.fcd" or other....
I recall that I speak on behalf of 32 schools and that we use Flowcode with secondary school pupils : it's important for us that the macro PWM and its dialog box work correctly (without using a device as "bit banged PWM").
I add that we bougth several hundreds of "kits ECIO" we have chosen for their simplicity of implementation and I hope you can find a simple solution.

Thanks in advance

Best regards from France

Re: PWM alternative PIN on PIC18

Posted: Tue May 04, 2010 11:16 am
by Benj
Hello,

We have found a workaround for this problem for you.

Simply download the attached file and inside you will find a couple of files.

Copy the ECIOprog.exe file into your "Flowcode v4\Tools\ECIOprog" folder

Copy the fcd file into your "Flowcode v4\FCD" folder

Then start Flowcode and choose the "ECIO-40_Alt_PWM2.fcd" as your target.

Download any program to the ECIO, it can be a blank program if you like, this will configure the ECIO for use with the alternate PWM pin.

Then go back to your old program that uses the default ECIO40 FCD and your program will now correctly use the alternative CCP2 pin by default. You will have to remember to configure the PWM component appropriatley so that the port direction register is configured correctly.

If you ever need to switch back to RC1 as CCP2 then you will have to modify the "ECIO-40_Alt_PWM2.fcd" FCD file.

Do this by finding the following line in the [config] section.

5=0x80

and change to

5=0x81

Once you have done this perform another simple program using the modded FCD file and your ECIO will be restored to factory settings.

Let me know if you have any problems.

Re: PWM alternative PIN on PIC18

Posted: Wed May 05, 2010 6:54 am
by JG1
Hello Benj

Your quick response provides a satisfactory solution to my problem.
It's a little annoying to still be obliged to change the .fcd file to come back but it's not difficult.

Thank you very well.

Best regards

Re: PWM alternative PIN on PIC18

Posted: Wed May 05, 2010 7:23 am
by Steve
You can create another additional FCD file (perhaps called "ECIO-40_PWM2_RC1.fcd"). This will be an exact copy of the "ECIO-40_Alt_PWM2.fcd" file but with 5=0x81 instead of 5=0x80. This will make the transition easier.