Re: Doubt in PWM technique......... help
Hello there,
Hello,
The PORT pins are multiplexed with comparator an voltage reference functions.
The operation of thes pins are selected by control bits in the CMCON.
(Comparator Control register) register and the VRCO (Voltage Reference Control register) register.
When selected as a comparator input, these pins will read as ‘0’s.
So, you need to turn comparators off and enable pins for I/O functions:
CMCON = 0x07;
Port A comparator module:
Unlike the 16F84, the 16F628 Port A pins (A0, A1, A2, A3) default to comparator inputs on power up. The comparator mode control register CMCON controls the comparator input and output multiplexers, and will also turn OFF the onboard comparator module to allow Port A pins to be used as normal I/O-pins.
An external or internal reference can be used depending on the comparator operating mode. The analog signal present on VIN- is compared to the signal at VIN+, and the digital output of the comparator is adjusted as shown below picture.
Best regards,