I have a project using the PIC12F1572
I am using the PWM component.
The component appears to be setup as an 8bit PWM using TMR2 as the clock source driven by Fosc/4
The PIC12F1572 has a 16bit PWM with associated 16bit timer module using Timer2 is not an option.
The period register is 16bit not 8bit
Am I missing something or is this component setup wrong?
Thanks,
DC
Pic 16bit 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: Pic 16bit PWM
Hi DC,
I'll investigate for you and check there is not a bug in the device definition file.
I'll investigate for you and check there is not a bug in the device definition file.
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: Pic 16bit PWM
Right I think I have a fix for you now.
I've added a new PWM handler in the PIC CAL, updated the chip definition files and updated the PWM component.
First the definition file needs to go in the "Flowcode 7/FCD/PIC" folder.
Next the components need to go in the "Flowcode 7/components" folder.
Finally the CAL C file needs to go in the "Flowcode 7/CAL/PIC" folder.
Start or Restart Flowcode and you should be able to select the appropriate clock source and set the period property with a value up to 65535.
You will need to use the SetDuty10Bit macro to access the full PWM duty cycle range. SetDuty will set the upper 8-bits of the PWM duty register.
Please note that the simulation may not work out the time duration and frequencies correctly at the moment, especially for the alt clock sources LFINTOSC and HFINTOSC.
Let me know how you get on.
I've added a new PWM handler in the PIC CAL, updated the chip definition files and updated the PWM component.
First the definition file needs to go in the "Flowcode 7/FCD/PIC" folder.
Next the components need to go in the "Flowcode 7/components" folder.
Finally the CAL C file needs to go in the "Flowcode 7/CAL/PIC" folder.
Start or Restart Flowcode and you should be able to select the appropriate clock source and set the period property with a value up to 65535.
You will need to use the SetDuty10Bit macro to access the full PWM duty cycle range. SetDuty will set the upper 8-bits of the PWM duty register.
Please note that the simulation may not work out the time duration and frequencies correctly at the moment, especially for the alt clock sources LFINTOSC and HFINTOSC.
Let me know how you get on.
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