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

PIC18f27J13 UART2

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



Joined: 12 Mar 2011
Posts: 20

View user's profile Send private message

PIC18f27J13 UART2
PostPosted: Fri Mar 25, 2011 11:15 am     Reply with quote

HI

This is working fine:

Code:
#use rs232(baud=9600,  parity=N, bits=8, ERRORS, UART1, STREAM = COM1 )


but this i can't put to work:

Code:
#use rs232(baud=9600, xmit=PIN_C5,rcv=PIN_C4, parity=N, bits=8, ERRORS, UART2, STREAM = COM2 )


I already tried, insted of
Code:
xmit=PIN_C5,rcv=PIN_C4
,

Code:
#pin_select U2TX=PIN_C5
#pin_select U2RX=PIN_C4


Can you help me?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Mar 25, 2011 2:45 pm     Reply with quote

Always post your compiler version if you have a problem where some
compiler feature doesn't work.
dyeatman



Joined: 06 Sep 2003
Posts: 1937
Location: Norman, OK

View user's profile Send private message

PostPosted: Fri Mar 25, 2011 4:22 pm     Reply with quote

You have UART2 and pin specifications in the same statement.
Code:

#use rs232(baud=9600, xmit=PIN_C5,rcv=PIN_C4, parity=N, bits=8, ERRORS, UART2, STREAM = COM2 )

Since the chip is remappable I would take the UART2 out of the statement.
In any case you should normally not use the UART2 and the pin definitions
in the same statement. That may be causing a conflict of some kind.
_________________
Google and Forum Search are some of your best tools!!!!
Besugo



Joined: 12 Mar 2011
Posts: 20

View user's profile Send private message

PostPosted: Sat Mar 26, 2011 1:54 am     Reply with quote

Wouldn't that make it a software UART instead of an hardware UART?
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Sat Mar 26, 2011 8:08 am     Reply with quote

dyeatman wrote:
You have UART2 and pin specifications in the same statement.
Code:

#use rs232(baud=9600, xmit=PIN_C5,rcv=PIN_C4, parity=N, bits=8, ERRORS, UART2, STREAM = COM2 )

Since the chip is remappable I would take the UART2 out of the statement.
In any case you should normally not use the UART2 and the pin definitions
in the same statement. That may be causing a conflict of some kind.


actually, it's the other way.

He wants to keep UART2, but take out the PIN statements. And then keep the #pin_select declarations.

-ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
Besugo



Joined: 12 Mar 2011
Posts: 20

View user's profile Send private message

PostPosted: Sat Mar 26, 2011 1:44 pm     Reply with quote

Yeah, I've done that but i cant remap pins to the ports i want!
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Sat Mar 26, 2011 1:57 pm     Reply with quote

Besugo wrote:
Yeah, I've done that but i cant remap pins to the ports i want!


I don't think you understand...

You use #pin_select to remap the ports.
You use #use rs232 (UART2, stream=somename) to tell the compiler where output to somename goes.

I recently used this in something for the 46j11 and it looked something like this:

Code:

#pin_select U2TX=PIN_D6
#pin_select U2RX=PIN_D7
#use rs232 (UART2, STREAM=GPS, BAUD=4800, PARITY=N, BITS=8, ERRORS)


And there you go. It works like a charm.

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
Besugo



Joined: 12 Mar 2011
Posts: 20

View user's profile Send private message

PostPosted: Sat Mar 26, 2011 2:48 pm     Reply with quote

Thanks very much for your replies, i've done just that with no success, but now that I know you've had success, i'll look into it again.
Besugo



Joined: 12 Mar 2011
Posts: 20

View user's profile Send private message

PostPosted: Mon Mar 28, 2011 7:00 am     Reply with quote

What am I doing wrong??

Code:
#fuses HS,NODEBUG,NOXINST,NOPROTECT,NOWDT,NOCLOCKOUT,NOIOL1WAY,NOWPCFG,NOWPFP
   #use delay(internal=8MHz)

   #pin_select RX2=PIN_C5
   #pin_select TX2=PIN_C4

   #use rs232(baud=9600, parity=N, bits=8, ERRORS, UART1, STREAM = COM1 )
   #use rs232(baud=9600, parity=N, bits=8, UART2, ERRORS, STREAM=COM2 )


UART1 works, UART2 doesn't!

Thanks
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Mon Mar 28, 2011 9:52 am     Reply with quote

I would check the assembly to make sure CCS's database has the pinselect registers set correctly.

Send your .LST output file to CCS and let them know it doesn't seem that the database for the 18F27j13 is correct.
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
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