|
|
View previous topic :: View next topic |
Author |
Message |
Besugo
Joined: 12 Mar 2011 Posts: 20
|
PIC18f27J13 UART2 |
Posted: Fri Mar 25, 2011 11:15 am |
|
|
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
|
|
Posted: Fri Mar 25, 2011 2:45 pm |
|
|
Always post your compiler version if you have a problem where some
compiler feature doesn't work. |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1933 Location: Norman, OK
|
|
Posted: Fri Mar 25, 2011 4:22 pm |
|
|
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
|
|
Posted: Sat Mar 26, 2011 1:54 am |
|
|
Wouldn't that make it a software UART instead of an hardware UART? |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Sat Mar 26, 2011 8:08 am |
|
|
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
|
|
Posted: Sat Mar 26, 2011 1:44 pm |
|
|
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
|
|
Posted: Sat Mar 26, 2011 1:57 pm |
|
|
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
|
|
Posted: Sat Mar 26, 2011 2:48 pm |
|
|
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
|
|
Posted: Mon Mar 28, 2011 7:00 am |
|
|
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
|
|
Posted: Mon Mar 28, 2011 9:52 am |
|
|
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 |
|
|
|
|
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
|