My device controlling motor using PWM and read data from serial (uart).
Previously I was using 40 pin and now only 14-pin.
It happenned the "RX" and CCP1 (PWM) are on the same pin. RC5, pin 5.
There is another "RX" on RA1, pin 12.
But I didn't manage to make it work.
I'm using mikroC Pro.
By setting TRISA = 1, does this make Pin 12 as an input?
Could anyone help me on this?
Thank you in advance!
Data sheets and other details can be found here:
PIC16F1824 details
Best Answer
Quote from the data sheet:
And for the APFCON0 register:
So setting RXDTSEL to 1 will move the RX to the same pin as RC5
And by setting TRISA to 1 you will be setting all of port A to be output except RA0 which will be input.
Either set it to 2, or set TRISA1 to 1, to set RA1 as an input.
EDIT:
Some other things from the data sheet to note:
... so to use RA1 you have to set ANSEL properly to ensure RA1 is switched to digital input not analog (it defaults to analog IIRC)