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 CCS Technical Support

How to properly declare UART on PIC24FJ

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



Joined: 13 Apr 2011
Posts: 417

View user's profile Send private message

How to properly declare UART on PIC24FJ
PostPosted: Thu Apr 25, 2019 6:54 am     Reply with quote

Device is PIC24FJ1024GB610
CCS V5.078

I'm trying to port a currently working code from PIC18F to PIC24FJ and can't figure out how to properly declare the UARTs

I'm using this code on PIC18F67J50

Code:
#use rs232(UART1,stream=GSM,NOINIT)
#use rs232(UART2,stream=GPS,NOINIT)


But in PIC24FJ doesn't work.
Can be something related to PPS? (Peripheral Pin Select)
_________________
Electric Blue
temtronic



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

View user's profile Send private message

PostPosted: Thu Apr 25, 2019 7:07 am     Reply with quote

don't use that PIC but have seen a lot of posts.....
hint..
NEED to declare the PPS stuff BEFORE the UARTs....
try 'searching' , there's posts here about it....even a 'sticky' !
Jay
E_Blue



Joined: 13 Apr 2011
Posts: 417

View user's profile Send private message

PostPosted: Thu Apr 25, 2019 7:13 am     Reply with quote

Yes, I added the following code and works ok.

Code:
#pin_select U1TX=PIN_B6
#pin_select U1RX=PIN_B7

#pin_select U2TX=PIN_B0
#pin_select U2RX=PIN_B1


Now I'm must to port a lot of #asm code to C.

There is more than 100 #asm #endasm in the code, this is going to take some time. Confused
_________________
Electric Blue
Ttelmah



Joined: 11 Mar 2010
Posts: 19537

View user's profile Send private message

PostPosted: Thu Apr 25, 2019 8:46 am     Reply with quote

Yes. What does the ASM actually 'do'?. 90% of ASM can be done instead with
#byte and #bit and C code. The only stuff that can't, is going to be radically
different on a PIC24 (different instruction set...).
jeremiah



Joined: 20 Jul 2010
Posts: 1353

View user's profile Send private message

PostPosted: Thu Apr 25, 2019 8:03 pm     Reply with quote

E_Blue wrote:
Yes, I added the following code and works ok.

Code:
#pin_select U1TX=PIN_B6
#pin_select U1RX=PIN_B7

#pin_select U2TX=PIN_B0
#pin_select U2RX=PIN_B1



Quick note. If I remember correctly we use this chip on our dev board (or a close relative if not). You only have to specify PPS for Uarts 1,2,3, and 4. Uart 5 and Uart6 are hard pinned and won't need PPS.
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