flowcode V6 - 18F1330 PWM

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

Moderator: Benj

Post Reply
nicmaes
Posts: 7
Joined: Mon Mar 24, 2014 9:58 pm
Has thanked: 2 times
Been thanked: 1 time

flowcode V6 - 18F1330 PWM

Post by nicmaes »

Dear,
On the PIC 18F1330, it is not possible to use more than one PWM channel.
Normally, there are still two PWM channels useful in flow code. Is there a way to solve this. My hardware is ready, but I'm stuck with the software.
18F1330 is a compact pic with PWM channels. If this does not work in V6,
there are other alternatives? greetings

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: flowcode V6 - 18F1330 PWM

Post by Benj »

Hello,

Flowcode currently only supports CCP type PWM. The PWM on the 18F1330 device is none standard advanced PWM which is currently not supported.

I have put this on the to do list and started to look into the issue. Might be a quick one to solve so please bear with me and we will investigate.

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: flowcode V6 - 18F1330 PWM

Post by Benj »

Hello,

I've investigated this a bit further and thought I was onto something but then found out that these advanced PWM peripherals cannot even be enabled individually. The options are like this.

No PWM
PWM1
PWM0, PWM1
PWM0, PWM1, PWM2, PWM3
PWM0, PWM1, PWM2, PWM3, PWM4, PWM5
All PWM
PWM1, PWM3
All Odd PWM

So for example you cannot use PWM0 on it's own!

Also the PWMs are in pairs so for PWM0 & 1 there is one control duty register!

Therefore making a nice easy to use component like we have for the CCP based PWM is looking very unlikely.

If you want to use these PWM peripherals then I suggest you use C code in Flowcode to set up the necessary registers. I should be able to help with this if needed.

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times

Re: flowcode V6 - 18F1330 PWM

Post by QMESAR »

advanced PWM peripherals cannot even be enabled individually.
@Benj

I am not a 18F1330 user however I use the 2431and 4431 and the 4331 a lot and I use single PWM on this device by setting the OVDCON and OVDCONS registers and by setting the Pins to individual mode
I apologize if i misunderstood your post only say that on the above devices I run single or 4 PWM with 4 IO on the other PWM pins or in the pair modes as decribed in the data sheet,the only problem as you mentioned is that you have only 4 Duty cycle registers I am actually running a small demo on your EB006V9 and EB022 with a PIC18F4431with PWM on only PWM0 and PWM1 is a normal IO pin :D

You will notice below PWM0 is a PWM channel and PWM1 normal IO pin and set low ,PWM4 is also a IO pin and sets the Enable Pin on the L298 driver high and in the C file the duty cycle for PWM0 gets adjusted
Attachments
08.12.jpg
08.12.jpg (115.37 KiB) Viewed 4822 times
08.12.jpg
(276.66 KiB) Downloaded 668 times
Last edited by QMESAR on Mon Dec 08, 2014 10:22 pm, edited 2 times in total.

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times

Re: flowcode V6 - 18F1330 PWM

Post by QMESAR »

Hi Guys
I just had a look at the datasheet of the 18F1330 and it has the same power Control module as the PIC18xx31 and in my opinion it is possible to run individual PWM pins or the pair combinations as for the advanced PWM schemes
the OVDCOND register allows you to achieve the individual pin PWM ,however1- 4 individual with independent Duty cycle same Frequency or 1-8 individual PWM's with 4 different Duty cycles (2 PWM's per Duty cycle register )for the devices with 8 PWM pins and 1-6 and 3 Duty cycles for the 6 PWM pin devices

@nicmaes you can probably just modify my configuration to suit your pins :D

Good luck
Attachments
09.12.jpg
09.12.jpg (88.78 KiB) Viewed 4830 times

nicmaes
Posts: 7
Joined: Mon Mar 24, 2014 9:58 pm
Has thanked: 2 times
Been thanked: 1 time

Re: flowcode V6 - 18F1330 PWM

Post by nicmaes »

Hi. On my current hardware do I need PWM1 and pwm6. PWM0 I will not use. I need only two PWM channels. I took this pic because it only has 18 pins.
16F887 is an alternative but takes a lot of space. The "C" proposals I try soon. The intention is to program this with youth.
I prefer to use no long stretches c language.
Thanks for the comments.
greetings

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times

Re: flowcode V6 - 18F1330 PWM

Post by QMESAR »

nicmaes wrote: I prefer to use no long stretches c language.
Well it is certainly not long stretches of C code it is only 14 lines of Code and not really C code it is mainly setting a value to a Register which FC does as well :D

Post Reply