18f6722 PWM2 Pinout?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times
Contact:

18f6722 PWM2 Pinout?

Post by cobra1 »

Hi again,

have had to upgrade to a bigger chip, so thought id go all out and use the 18f6722 loads of pins and memory.

I want to use PWM2, looking at the datasheet this is set by default to RC1.
I would like to use PWM2 using pin RE7, This is also set in the defines but is set as 2a.

#define MX_PWM_TRIS1 trisc
#define MX_PWM_1 2
#define MX_PWM_TRIS2 trisc
#define MX_PWM_2 1
#define MX_PWM_TRIS2a trise
#define MX_PWM_2a 7

#define MX_PWM_TRIS3 trisg
#define MX_PWM_3 0
#define MX_PWM_TRIS4 trisg
#define MX_PWM_4 3
#define MX_PWM_TRIS5 trisg
#define MX_PWM_5 4

Are both outputs active at the same time?? or is there a way of selecting one or the other???

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: 18f6722 PWM2 Pinout?

Post by medelec35 »

Hiya cobra1.

In the configuration menu, you can change which pin PWM2 is to be active on.
If you look at CCP2 Mux, you can select Muxed with RC1 or RE7.
So PWM2 is not active on both pins at the same time
Martin

cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times
Contact:

Re: 18f6722 PWM2 Pinout?

Post by cobra1 »

Hi medelec

Im a bit of a noob at this sort of stuff, although im getting there slowly. I have a few questions.

Where is the configuration menu??
What is CCP2 mux??

How will i select which pin i want the PWM signal to come from??

Cheers

cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times
Contact:

Re: 18f6722 PWM2 Pinout?

Post by cobra1 »

Hi again.

I found the menu you were refering to and also the option to select which pin is output.

Thanks for the help, i didnt even know this menu existed...

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: 18f6722 PWM2 Pinout?

Post by medelec35 »

You welcome.
It is important that the settings in the configuration menu are correct, or your project will not work.
In general terms:
Have watchdog, low voltage programming, background debug and extended CPU disabled.

To keep it more basic you can select HS if crystal for osc is 4MHz or above.
XT if less than 4MHz.
Or you can select internal oscillator.
But you must change the target speed setting to match the crystal speed.

There is an option to run code at a much faster frequency using on board PLL

But don’t worry about PLL for now. When you get use to the more basic functions and want to take it further, we can assist you with that if required.

Have a read here:
http://www.matrixmultimedia.com/mmforum ... =26&t=6936

It may help when you’re a bit stuck.
Martin

Post Reply