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

multi usart usart full duplex

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







multi usart usart full duplex
PostPosted: Tue Jan 06, 2009 8:08 pm     Reply with quote

Hello, I have a question. I have read lots of forum pages but I am not really sure of that;

I want to use serial communication and I am using pic16f877a.

Code:
#USE RS232(BAUD=9600, XMIT=PIN_B0, RCV=PIN_B1, STREAM=one)
#USE RS232(BAUD=9600, XMIT=PIN_C6, RCV=PIN_C7, STREAM=two)


Well the first rs232 statement enables software rs232 and the second one enables hardware rs232.
The hardware rs232 said to be full duplex(You can send and receive at the same time this I understand from full duplex)
Now using the statements above will it be possible that reveive and send from stream two(simultaneously) when I am also sending data from stream one?

Does pic16f877a do this job or should I use another pic or I^2C chips that does this job? If there is a pic that does this job which one is it? Is it the pic that has 2 usart interface or 2 uart interface (or more than two)

I use icd2 and I have picdem2 demo board. I program the pic with this. But if I need another type of pic should I have to buy another programmer?

Please help
Thanks.
bkamen



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

View user's profile Send private message

PostPosted: Tue Jan 06, 2009 10:54 pm     Reply with quote

If you want true full duplex, you'll want to use a PIC with 2 UART's on-board OR use some form of high speed hardware xfer mechanism between them.

Software UART != high speed when other critical processes are to be considered.

(so yes, SPI might be nice or I2C --- SPI would be better. It's faster and there's no wasted bandwidth over addressing headers)


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



Joined: 04 May 2004
Posts: 47
Location: UK

View user's profile Send private message

multi usart usart full duplex
PostPosted: Wed Jan 07, 2009 7:48 am     Reply with quote

Just to add to the comments Ben has made, I would be very cautious when using a software serial port in your firmware. If you start to use interrupts such as timers or hardware serial you will find the software serial port timings start to fail. If your design requires two serial ports and the PIC only has one, try looking at adding something like a MAX3100 to your design.

HTH

Andy
guest1
Guest







PostPosted: Thu Jan 08, 2009 5:34 am     Reply with quote

if i want to use chip with 2 UARTs, what would be your choice?
Someone from 18F XXX
guest1
Guest







PostPosted: Thu Jan 08, 2009 5:50 am     Reply with quote

if i want to use chip with 2 UARTs, what would be your choice?
Some from 18F XXX
asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

Re: multi usart usart full duplex
PostPosted: Thu Jan 08, 2009 7:43 am     Reply with quote

andyfraser wrote:
Just to add to the comments Ben has made, I would be very cautious when using a software serial port in your firmware. If you start to use interrupts such as timers or hardware serial you will find the software serial port timings start to fail. If your design requires two serial ports and the PIC only has one, try looking at adding something like a MAX3100 to your design.

HTH

Andy


This is an extreme view. It comes down to the quality of the driver. A PIC18F class processor running at 40MHz is capable of reliably running hardware and software UARTs full duplex concurrently at 115200 baud.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
adanali
Guest







two serial sw ports
PostPosted: Wed Jan 21, 2009 1:17 pm     Reply with quote

Hi everybody,

I am using Pic 16F877A and I have the following code:
Code:

#include "16F877A.H'
#use delay(clock=4000000)
#USE RS232(BAUD=9600, XMIT=PIN_B1, RCV=PIN_B0, STREAM=COM_A)
#USE RS232(BAUD=9600, XMIT=PIN_B2, RCV=PIN_B3, STREAM=COM_B)

void main() {
char b,c;
fprintf(COM_A,"Online\n\r");

while(TRUE) {

if(kbhit(COM_A)){
  b = getc(COM_A);
 putc(b, COM_A);
}

  if(kbhit(COM_B)){
   c= getc(COM_B);
   putc(c, COM_B);
 }
 if(!kbhit(COM_A) && !kbhit(COM_B))
 delay_us(10);
 
}
while(1);

}

The problem is I have defined two sw serial ports on pic. When I turn on the power the pic automatically sends different characters to the pc. I don't know why.
Help Please. I have tried several pics but it did the same thing.
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