Hello I want to generate PWM using ECCP of PIC16F1939 microcontroller. The two pins are supposed to generate waveforms alternately. ( I used pulse steering function of the ECCP module. For sometime the pulses are steered to one pin and for sometime to the other pin. ) The pins sometimes generate the waveform I desire perfectly. But sometimes only one pin generates the waveform and the other shows random noise and a voltage of about 1 to 3 volts.
The pins used are RE1 (P3B) and RB5 (P3A) of ECCP3 module. I have turned comparators off. I have also used APFCON register. I cannot post whole program. Here is some part of initialisation :
Have you checked the erratas for the micro in question? When I download the manual, immediately after, the erratas follow.
In all micros I looked at, comparators appear mentioned. Have you also verified what other functions those pins are involved with?
Make sure you initialize just the minimum necessary to verify how the EECP works. When a new piece of code is added you could eventually detect the offending setting.
Have you checked the erratas for the micro in question? When I download the manual, immediately after, the erratas follow.
In all micros I looked at, comparators appear mentioned. Have you also verified what other functions those pins are involved with?
Make sure you initialize just the minimum necessary to verify how the EECP works. When a new piece of code is added you could eventually detect the offending setting.
bit 7 CCPxASE: CCPx Auto-Shutdown Event Status bit
1 = A shutdown event has occurred; CCPx outputs are in shutdown state
0 = CCPx outputs are operating
bit 6-4 CCxPAS<2:0>: CCPx Auto-Shutdown Source Select bits
000 = Auto-shutdown is disabled
001 = Comparator C1 output low(1)
010 = Comparator C2 output low(1)
011 = Either Comparator C1 or C2 low(1)
100 = VIL on INT pin
101 = VIL on INT pin or Comparator C1 low(1)
110 = VIL on INT pin or Comparator C2 low(1)
111 = VIL on INT pin or Comparator C1 or Comparator C2 low(1)
bit 3-2 PSSxAC<1:0>: Pins PxA and PxC Shutdown State Control bits
00 = Drive pins PxA and PxC to ‘0’
01 = Drive pins PxA and PxC to ‘1’
1x = Pins PxA and PxC tri-state
bit 1-0 PSSxBD<1:0>: Pins PxB and PxD Shutdown State Control bits
00 = Drive pins PxB and PxD to ‘0’
01 = Drive pins PxB and PxD to ‘1’
1x = Pins PxB and PxD tri-state Note 1: If CxSYNC is enabled, the shutdown will be delayed by Timer1
I have configured CCPxAS register too as-
CCP3AS= 0b01000000
I have tested this when there's Logic 0 on INT Pin all pwm pins are in shutdown mode.
In shuddown mode also the "affected" pin shows random voltage.