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 support@ccsinfo.com

Two RS232 signals on one USART

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



Joined: 09 Nov 2005
Posts: 12

View user's profile Send private message

Two RS232 signals on one USART
PostPosted: Tue Nov 15, 2005 8:25 am     Reply with quote

Since I've had so much luck on the first help I got here, I figured I'd try again.
I've been searching the forums and I've found a few solutions for driving 2 signals on a single USART, but nothing that fits my project exactly. I have one hardware USART on my PIC16F877A, as most of you know.
I've got two incoming signals, and I only need one at a time. Because of this, and because one of my devices is a noisy device (always sending signals uncontrollably), I'd like to be able to ignore that and pay attention to another signal coming in. I thought I could just use a MUX on the signals with a control bit... but these aren't exactly logical values (asynchronous serial), so I'm not positive this solution would work.

Has anyone done this, or can anyone propose another quick solution?
Thanks.
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Tue Nov 15, 2005 8:34 am     Reply with quote

Use the hardware UART and interrupts for your "good" signal. Use a software UART for the dirty signal. Inside your main you would occasionally check the software UART path using "kbhit()". You will also need to study up on the STREAM argument for setting up the UARTs.

If you want both UARTs to be interrupt driven for receive, you can use the IRQ pin as the receive pin for the software UART and write an interrupt handler to deal with inbound data. You will may need to write your own global ISR to deal with priorities.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
NickStout



Joined: 09 Nov 2005
Posts: 12

View user's profile Send private message

PostPosted: Tue Nov 15, 2005 11:24 am     Reply with quote

Hm, I was planning on using the hardware UART for both signals just to avoid setting up the software UART and interrupts. All I really want to do is ignore the incoming data on one line and allow the other to talk.
I misspoke when I said the other data was coming continuously. The data is 8 byte packets, and can be sent every few seconds, but doesn't have to be. All I really want to do is ignore these signals for a bit to look at some other incoming data (which I tell the device to send, so it's triggered) then go back to looking at the first signal.
I'm not sure this is a stream, and I'm pretty sure there's a way to do this without interrupts, but maybe I'm mistaken.
Ttelmah
Guest







PostPosted: Tue Nov 15, 2005 3:46 pm     Reply with quote

You can use a MUX. The serial lines at the processor, are normal logic levels. However you might find it cheaper to use FET bi-lateral switches, rather than normal logic, since then two halves of the same device, can handle both the transmit path, and the receive. If there is any handshaking connection to the other device, you can even operate the 'CTS' line when the device is deselected, to avoid the problems of data loss that otherwise may happen.

Best Wishes
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