Hello,
I have a doubt related to PWM of the PIC18F2331 family. They have 6 or 8 channels in hardware, but FC9 only permit 2 channels.
Please you could consider to include more channels for this PIC family. It should be very useful for ACIM control technics & algorithms, we need to use 6 PWM channels at minimum for control the motors.
Thanks a lot.
PIC18F2331 pwm
-
- Posts: 22
- http://meble-kuchenne.info.pl
- Joined: Wed Aug 10, 2022 1:42 am
- Location: Mexico
- Has thanked: 2 times
- Been thanked: 7 times
- p.erasmus
- Posts: 434
- Joined: Thu Dec 03, 2020 12:01 pm
- Location: Russia / Россия
- Has thanked: 104 times
- Been thanked: 88 times
Re: PIC18F2331 pwm
Hi,
The FC PWM Component supports the Standard CCP module(PWM) of the chip this particular chip has only two CCP modules the reason you can only select 2 PWM signals.
The 2331 chip has a specific module for Driving PMSM Motors (Brushless or Induction for example) which is called the MCPWM module which contains on this chip PWM0 - PWM5 this module allows you to run various Motorcontrol of Switch mode Power Supply circuitry ,however due to its many available configurations makes it hard to make a component that can serve all the different configurations,Matrix has in the past indicated that they will not do this ,however may be they will be willing now. We have been using a C code icon and with the help of the Datasheet configure the MCPWM module in FC for our needs.
As you will see below to the left is the 2 channel CCP module and on the Right the 6 channel MCPWM module
Regards Peter - QME Electronics
-
- Matrix Staff
- Posts: 1465
- Joined: Sat Dec 05, 2020 10:32 am
- Has thanked: 204 times
- Been thanked: 347 times
Re: PIC18F2331 pwm
It is simple to integrate a few lines of C code within Flowcode to control the more advanced and esoteric functions of the more complicated microcontrollers.
Some of these modules have many features and it is difficult to cover all possibilities with a component.
Some of these modules have many features and it is difficult to cover all possibilities with a component.
-
- Posts: 22
- Joined: Wed Aug 10, 2022 1:42 am
- Location: Mexico
- Has thanked: 2 times
- Been thanked: 7 times
Re: PIC18F2331 pwm
Hi guys,
p.erasmus thanks a lot for the CCP module explanation, now is clear for me why many of micro-controllers (PICs) have one or two PWM channels only. For PIC more specific hardware, like MCPWM in PIC18F2331, I need to deal with C code to explode all characteristics as mention by Steve-Matrix.
My interest in MCPWM module is to use in AICM control. I'll try to do with C code
Best regards,
KikeRico
p.erasmus thanks a lot for the CCP module explanation, now is clear for me why many of micro-controllers (PICs) have one or two PWM channels only. For PIC more specific hardware, like MCPWM in PIC18F2331, I need to deal with C code to explode all characteristics as mention by Steve-Matrix.
My interest in MCPWM module is to use in AICM control. I'll try to do with C code

Best regards,
KikeRico
-
- Matrix Staff
- Posts: 1924
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 501 times
- Been thanked: 684 times
Re: PIC18F2331 pwm
Hello,
A simple way to control a brushless DC motor in Flowcode is to use the Servo Motor controller component and connect this to a brushless ESC. If you want to connect the brushless motor directly to the microcontroller then this is a bit more tricky. We will soon be looking into field oriented control for brushless motors but at the moment you might be better off using several of the H-bridge components or even driving the outputs yourself using output pins and a timer interrupt.
A simple way to control a brushless DC motor in Flowcode is to use the Servo Motor controller component and connect this to a brushless ESC. If you want to connect the brushless motor directly to the microcontroller then this is a bit more tricky. We will soon be looking into field oriented control for brushless motors but at the moment you might be better off using several of the H-bridge components or even driving the outputs yourself using output pins and a timer interrupt.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel