Hello,
I have a R5F10Y47 (using CC-RL compiler and CS+ for CC). Is it possible for me to repurpose a pin at runtime?
For example, pin 12 of the MCU can be used as: analog pin for A/D Converter, rise/fall edge detection, and GPIO. Is it possible to reconfigure them at runtime? How can I do that (e.g., maybe modify PMC03 so I can switch between ADC and GPIO)?
Thanks for your time and help!
Yes, this is possible if you change the port registers accordingly to serve another alternate function. Please refer to table 4-5 at
www.renesas.com/.../rl78g10-users-manual-hardware
Follow-up question: so if my PIOR2 = 1, PMC0 = 0, PMn = 1, then P03 is simultaneously GPIO and INTP1? In that case I would need to make sure that the EGP/N need to be 0 to prevent edge detection from triggering interrupts?
No, not simultaneously. Every pin can have only one function: GPIO or INTP1 or analog etc.
Making sure I understand: so in my above example P03 will be INTP1? If I clear PIOR2 later at runtime then P03 will become GPIO?
If PIOR2 = 0, INTP1 will be served by P00 and P03 can be used for other functions.