CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

PIC24FJ64GA002 selectable peripheral pins

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
martind1983



Joined: 22 Mar 2013
Posts: 16

View user's profile Send private message

PIC24FJ64GA002 selectable peripheral pins
PostPosted: Tue Apr 02, 2013 5:17 am     Reply with quote

Hi.

I have question.
I want to use PIC24FJ64GA002 16 bit PIC which has any selectable inputs for peripherals . Simply told, you can use some of peripheral I/O's with any selectable hardware pin on MCU.
I want to know, are there any functions in CCS PCD compiler for this purpose? I think, that some directives like #USE SPI solve it with options like ENABLE=PIN, SDI=PIN, but there is only one I know.
What external interrupts and other? Are there any functions for this purpose? While I didn't find there any option for this purpose of selecting pins to peripheral. So when somebody else who already used or is still using 16bit PIC MCU's could help me. I would be very thankful.

Thanks Martin.
alan



Joined: 12 Nov 2012
Posts: 357
Location: South Africa

View user's profile Send private message

PostPosted: Tue Apr 02, 2013 5:44 am     Reply with quote

See the #pin_select in CCS manual
temtronic



Joined: 01 Jul 2010
Posts: 9161
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Apr 02, 2013 6:02 am     Reply with quote

as well, open the processor header file to see what is allowed !

and consult the processor datasheet, as not all pins can be all things !!!
martind1983



Joined: 22 Mar 2013
Posts: 16

View user's profile Send private message

PostPosted: Tue Apr 02, 2013 6:17 am     Reply with quote

temtronic wrote:
as well, open the processor header file to see what is allowed !

and consult the processor datasheet, as not all pins can be all things !!!


I have already seen datasheet and header file. It was the reason I asked questions about this topic here. I could find any standard information about it.
martind1983



Joined: 22 Mar 2013
Posts: 16

View user's profile Send private message

PostPosted: Tue Apr 02, 2013 6:20 am     Reply with quote

alan wrote:
See the #pin_select in CCS manual


Thanks for your hint. It is it. It helped Very Happy
Ttelmah



Joined: 11 Mar 2010
Posts: 19326

View user's profile Send private message

PostPosted: Tue Apr 02, 2013 7:15 am     Reply with quote

As a general comment, I find the most reliable way is to keep it simple.

The RS232 serial command (for instance), has an option to tell it to use the hardware UART. So use the select to say 'what pins this uses', and then use the serial command in this form. The same with SPI. So for the UART:
Code:

//Now setup the UART pins
#pin_select TX2=PIN_C0
#pin_select RX2=PIN_C1 //Select pins for UART2

#use rs232 (baud=9600,parity=N,UART2,bits=8,errors)
//Tell the compiler you want to use the hardware UART2.

The problem is that if you try to do it with the #use RS232 or #use SPI, you would need to look in the assembler to find out if it is genuinely using the SPI/UART, rather than doing a software emulation. Unfortunately some compilers get the mapping right, and other don't. By directly saying 'I want UART2 TX/RX on these pins', and then 'I want to talk to UART2', you know what is going on....

I feel it is safer, and it seems to keep working through compiler versions....

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group