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
flowcode V6 - 18F1330 PWM
Moderator: Benj
- 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
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- 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
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- QMESAR
- 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
@Benjadvanced PWM peripherals cannot even be enabled individually.
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
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 (115.37 KiB) Viewed 4841 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.
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
- QMESAR
- 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
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
Good luck
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
Good luck
- Attachments
-
- 09.12.jpg (88.78 KiB) Viewed 4849 times
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
Re: flowcode V6 - 18F1330 PWM
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
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
- QMESAR
- 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
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 wellnicmaes wrote: I prefer to use no long stretches c language.
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR