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

Using hardware EUART2 on a PIC18F46J11 ???

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



Joined: 15 Jun 2009
Posts: 1
Location: Burnaby. B.C.

View user's profile Send private message Visit poster's website

Using hardware EUART2 on a PIC18F46J11 ???
PostPosted: Mon Jun 15, 2009 5:48 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Jun 16, 2009 2:13 pm     Reply with quote

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
PostPosted: Sun Jun 21, 2009 1:37 am     Reply with quote

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







PostPosted: Mon Jun 22, 2009 10:32 am     Reply with quote

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.
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