View previous topic :: View next topic |
Author |
Message |
thaynes
Joined: 15 Jun 2009 Posts: 1 Location: Burnaby. B.C.
|
Using hardware EUART2 on a PIC18F46J11 ??? |
Posted: Mon Jun 15, 2009 5:48 pm |
|
|
I tried this:
Code: | #use rs232(UART2,baud=9600,bits=8,parity=N,xmit=PIN_C4,rcv=PIN_C5,ERRORS,stream=COM_2) |
This only gives me a software UART (of course with no UART interrupts, and it's timing is disrupted by other interrupts).
With the PCWH compiler, is there a way to activate hardware EUART2 and control the mapping to the remappable I/O pins of the PIC18F46J11? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jun 16, 2009 2:13 pm |
|
|
I don't have this PIC, so I can't test this in hardware, but I think the
following program has a better chance to work than your code.
It uses the #Pin_Select feature as described in the CCS readme.txt file
that's in the c:\Program Files\Picc directory.
Code: | #include <18F46J11.h>
#fuses HS,NOWDT
#use delay(clock=20000000)
#PIN_SELECT U2TX=PIN_C4
#PIN_SELECT U2RX=PIN_C5
#use rs232(UART2, baud=9600, ERRORS)
//====================================
void main()
{
char c;
putc(0x55);
c = getc();
while(1);
} |
|
|
|
NutcAyse2 Guest
|
Dual HW UART |
Posted: Sun Jun 21, 2009 1:37 am |
|
|
How can you output to the two HW uarts separately? The setup I'm looking for will be something like this:
Computer<--RS232-->[UART1]<>Server<>[UART2]<--RS232-->Client
Thanx |
|
|
Steve H. Guest
|
|
Posted: Mon Jun 22, 2009 10:32 am |
|
|
Nut case: You keep the uarts separate using 'Streams' - in your two users232 statements you name each stream - then you use this stream name with all the IO functions - the compiler looks at the stream name and decided which UART to pipe the data to.
Look up 'Streams' in the manual.
HTH - Steve H. |
|
|
|