PIC18F remappable pins - Page 1
Forum section: electronics / general

author: ricko_uk
author_rank: Super Contributor
timestamp: May 16, 2020, 09:52:33 pm
content: Hi,after almost 20 years I am am using a PIC18 and it now looks very different in terms of flexibility in configuration.Specifically I am looking at the 28-pins part PIC18F26K42T-I/SS. Here's the datasheet:http://ww1.microchip.com/downloads/en/DeviceDoc/PIC18LF26-27-45-46-47-55-56-57K42-Data-Sheet-40001919E.pdfIt looks like the digital pins are remappable. What is not clear is:1) whether I can remap ANY digital pin to be the input/output to ANY peripheral (say SPI) input/output?2) on page 9 and 10 there is no SDO signal listed under the SPI column. I assume that is a typo? Or some other reason?3) finally and MOST IMPORTANT, I need to be sure I can remap the SPI pins as follows (2 different ways for 2 different applications:PCB A PCB B OPTIONAL PCB CSCK RA5 RC5 RB5SDO RA6 RC6 RB6SDI RA7 RC7 RB7SS ANY ANY ANYAre all of those combinations (or at least A and B) possible?Many thanks

author: WattsThat
author_rank: Frequent Contributor
timestamp: May 16, 2020, 10:54:53 pm
content: Duplicate post.https://www.eevblog.com/forum/projects/pic18f-pps-remappable-pins/

author: itdontgo
author_rank: Regular Contributor
timestamp: May 17, 2020, 12:13:44 pm
content: First time I did this I glanced at the datasheet, knocked up a PCB, excitedly built it and then realised you can't map a pin anywhere you have to stick to one or two ports.Shameful

author: NorthGuy
author_rank: Super Contributor
timestamp: May 17, 2020, 05:22:43 pm
content: Quote from: ricko_uk on May 16, 2020, 09:52:33 pmNo. There are groups. If you have different modules of the same kind, they are usually assigned to different groups. So, it's more or less flexible, but not universal. It's better to assign everything before making boards.Quote from: ricko_uk on May 16, 2020, 09:52:33 pmMuxes have one output and many inputs.To route peripheral outputs, you have registers for every package pin. You write numbers to these registers. Each peripoheral output has its own number. The number determines which peripheral output will be selected for the given package pin. You do this with SDO and SCK (for master).To route peripheral inputs, you have registers for every peripheral input. You write numbers to these registers. Each package pin has its own number. The number determines which package pin will be selected for the given peripheral input. You do this with SDI, SCK (for slave), and SS.So, there are different tables - one for inputs and one for outputs. SDO will only be in the output table, SCK will be in both, SDI and SS will be in input tables.Note that SCK is bidirectional, so it is found in both input and output tables.Quote from: ricko_uk on May 16, 2020, 09:52:33 pmI'm sure you can look it up in the datasheet by yourself.

author: ricko_uk
author_rank: Super Contributor
timestamp: May 17, 2020, 06:03:12 pm
content: Thank you NorthGuy for the detailed explanation!

author: JPortici
author_rank: Super Contributor
timestamp: May 17, 2020, 06:07:19 pm
content: Quote from: itdontgo on May 17, 2020, 12:13:44 pmyour fault for not reading the datasheet. Luckily sometimes you can get around it, once or twice i used the CLC module to pass through some peripheral outputs to other ports