View previous topic :: View next topic |
Author |
Message |
12Lapointep
Joined: 04 Aug 2015 Posts: 16 Location: United States
|
|
Posted: Wed Aug 05, 2015 11:11 am |
|
|
Certain PICs microcontrollers have remappable I/O pins for peripheral devices but it is not clearly indicated in the datasheet. For example, the PIC18F67J94 has four groups of remappable pins so for example U1TX is assigned to one group of RPP whereas U1RX is assigned to another group of RPP.
Be careful of what you are using as RPP because I made the mistake in the past and it is no fun to add jumpers on the PCB. |
|
|
40inD
Joined: 30 Jul 2007 Posts: 112 Location: Moscow, Russia
|
|
Posted: Thu Jun 02, 2016 8:26 am |
|
|
Hi!
I try to select pin for CCP2 to PIN_B3 for 18F25K22. I write
Code: | #pin_select CCP2=PIN_B3 |
but compiler says "Invalid Pin ID" |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1353
|
|
Posted: Thu Jun 02, 2016 4:38 pm |
|
|
40inD wrote: | Hi!
I try to select pin for CCP2 to PIN_B3 for 18F25K22. I write
Code: | #pin_select CCP2=PIN_B3 |
but comiler says "Invalid Pin ID" |
I don't have that PIC, but normally pin_select is for "Peripheral Pin Select" which I didn't see a section for in the data sheet. Perhaps take a look at section 10.3.3 for a description of how to change the pins? |
|
|
40inD
Joined: 30 Jul 2007 Posts: 112 Location: Moscow, Russia
|
|
Posted: Fri Jun 03, 2016 12:15 am |
|
|
From datasheet:
Quote: | 14.1.1 CCP PIN CONFIGURATION
In Capture mode, the CCPx pin should be configured
as an input by setting the associated TRIS control bit.
Some CCPx outputs are multiplexed on a couple of
pins. Table 14-2 shows the CCP output pin
multiplexing. Selection of the output pin is determined
by the CCPxMX bits in Configuration register 3H
(CONFIG3H). |
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Fri Jun 03, 2016 1:19 am |
|
|
OK.
Deep breath....
#PIN_SELECT, is only used on chips that have 'PPS' (peripheral pin select). hence the name.
There are three basic 'types' of PIC (ignoring the 'families' like 12,16,18 etc.), when it comes to 'pins'.
The first (original) had fixed pins only. No re-mapping.
Then some PIC's came along with _fuse multiplexing_. On these a few specific peripherals could be moved between two or three locations, controlled by fuses.
Then you have chips with PPS.
Your chip does not have PPS. It has fuse multiplexing (the key is that the 'configuration register', is the fuses.....).
Your PIC only allows the pins to be changed by fuses. So can't be changed actually inside the code.
Key is then to look at the header file for the PIC. On ones with PPS, the peripheral names that can be changed are listed, together with the pins they can be mapped to. On yours you have no PPS entries, but instead you have the following fuses:
TIMER3B5,TIMER3C0 //Selects the pin Timer3 is multiplexed to
CCP2B3,CCP2C1
CCP3C6,CCP3B5
CCP2C0,CCP2B5 //controls CCP2 and CCP3 multiplexing
So you need the fuse CCP2B3 |
|
|
40inD
Joined: 30 Jul 2007 Posts: 112 Location: Moscow, Russia
|
|
Posted: Fri Jun 03, 2016 1:39 am |
|
|
Thanks! |
|
|
|