It does not matter if CCP2 is steered to RB6 or RA7, results still the same.
When CCP2 is steered to RB6 I can see a PWM with a duty of 5%.
Adjusting voltage on AN0, PWM1 varies as expected.
PWM2 stays at 5% or disappears altogether for the higher duty values.
Eb006 not able to program yet, used a different programmer.
Is there a quick fix please as this is an very important job, and under a lot of pressure to complete asap.
I have included a Very watered down flowchart for testing.
Using internal osc at 8MHz
Thank you.
16F1827 PWM Channel 2 not working.
Moderator: Benj
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
16F1827 PWM Channel 2 not working.
- Attachments
-
- PWM_Duty_Test.fcf
- (7 KiB) Downloaded 398 times
Martin
- 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: 16F1827 PWM Channel 2 not working.
Hi Medelec,
Me and Sean have spent a bit of time on this now and so far we cannot see why the second PWM channel is misbehaving. I will carry on and see if I can resolve the problem for you, I'll post back on how I get on.
Me and Sean have spent a bit of time on this now and so far we cannot see why the second PWM channel is misbehaving. I will carry on and see if I can resolve the problem for you, I'll post back on how I 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
- 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: 16F1827 PWM Channel 2 not working.
Hi Medelec,
I dont think your going to like this.
I take it you are programming the chip from PICkit?
If you move the programming jumper from the ICD2 setting back to the USB setting then the PWM signal for CCP2 should then appear on the I/O port. When the jumper is in the ICD2 position the D-type port is disconnected for pins RB6 and RB7.
Could this be the problem? After moving the jumper back to USB here both PWM channels seem to be working fine on the code you supplied.
I dont think your going to like this.
I take it you are programming the chip from PICkit?
If you move the programming jumper from the ICD2 setting back to the USB setting then the PWM signal for CCP2 should then appear on the I/O port. When the jumper is in the ICD2 position the D-type port is disconnected for pins RB6 and RB7.
Could this be the problem? After moving the jumper back to USB here both PWM channels seem to be working fine on the code you supplied.
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
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: 16F1827 PWM Channel 2 not working.
Benj wrote: If you move the programming jumper from the ICD2 setting back to the USB setting then the PWM signal for CCP2 should then appear on the I/O port. When the jumper is in the ICD2 position the D-type port is disconnected for pins RB6 and RB7.
Could this be the problem?
The chip is mounted on a separate PCB (Not using EB006 programmer at all for this one.), and just using ICSP to program chip. Programmer is then disconnected. Chip then runs via 5V regulator + decoupling caps. I can PM you the circuit if required.medelec35 wrote:It does not matter if CCP2 is steered to RB6 or RA7, results still the same
No not using pickit. I am using ASIX presto.
With that arrangement if both channels work for you, could will be using different FCD or other files?
Would you mind posting a working hex file please so I can program chip with it and perhaps I can compare the two hex files?
Attached is my hex file
- Attachments
-
- PWM_Duty_Test.hex
- (2.5 KiB) Downloaded 391 times
Martin
- 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: 16F1827 PWM Channel 2 not working.
Hi Medelec,
Yes here is the hex file I used. All it does is increment a variable every 5ms and output the variable to the CCP1 and CCP2, RB0 and RB6. When the count gets to 98 the variable is reset back to 0.
I have also had a go with the hex file you sent and this also seems to be running fine on the EB006 hardware.
Yes here is the hex file I used. All it does is increment a variable every 5ms and output the variable to the CCP1 and CCP2, RB0 and RB6. When the count gets to 98 the variable is reset back to 0.
I have also had a go with the hex file you sent and this also seems to be running fine on the EB006 hardware.
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: 16F1827 PWM Channel 2 not working.
Hello again,
Right I have just recompiled using the HiTech compiler instead of the BoostC one and i've hit the problem you are having. seems very odd that changing the compiler would have this much of an effect. I'll carry on and see where I get.
Testing again with the HiTech compiler I have got it all working. But I didnt change anything. Here is my FCF and Hex files that seem to be working correctly using the HiTech compiler.
Right I have just recompiled using the HiTech compiler instead of the BoostC one and i've hit the problem you are having. seems very odd that changing the compiler would have this much of an effect. I'll carry on and see where I get.
Testing again with the HiTech compiler I have got it all working. But I didnt change anything. Here is my FCF and Hex files that seem to be working correctly using the HiTech compiler.
- Attachments
-
- PWM_Duty_Test.hex
- (1.6 KiB) Downloaded 400 times
-
- PWM_Duty_Test.fcf
- (7.5 KiB) Downloaded 427 times
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