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

Need to have 2 RS232 Ports

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



Joined: 15 Jan 2009
Posts: 60

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

Need to have 2 RS232 Ports
PostPosted: Sun Feb 28, 2010 9:51 pm     Reply with quote

Hi,

I am using PIC16f877a. I need to connect the microcontroller to the PC and to the GSM.

So that I need to have two RS232 ports in 16f877a.

The normal C6 and C7 pins are working but if I use other pins, its not working.

Is there any procedure to set the two RS 232 ports in 16f877a? Please tell me.

Thanks in advance,

Varadharaj.E
_________________
embedding innovation in engineers
Ttelmah
Guest







PostPosted: Mon Mar 01, 2010 3:00 am     Reply with quote

1) Search the forum. There are an enormous number of threads here about the software UART.

2) Understand the limitations:

The chip has _one_ hardware UART. This is capable of receiving/transmitting, while the chip is doing other things in code.
You can use any other pins you want, for serial comms, but if you do so, this uses a 'Software UART'. This implements only _half duplex_ (it can only send _or_ receive at any time), and will only work if:
On receive, the code is sitting _waiting_ for the data to arrive.
On transmit and receive, basically nothing else is being done at the same time (interrupts disabled...).

Now there are ways of tricking round the first (use an interrupt pin for the RX line, trigger the receive with this, and use the 'sample_early' option for the code, to allow for the delay in getting into the interrupt). There are also ways of programming your own software UART, to implement full duplex (I have in the past posted a serial routine based on a timer interrupt). However you need to do these yourself. The CCS implementation, does not offer this...

Best Wishes
evaradharaj



Joined: 15 Jan 2009
Posts: 60

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

Software UART
PostPosted: Mon Mar 01, 2010 3:34 am     Reply with quote

Thanks for your reply.


Can u please give me any link related to that .. I cant find the software UART. Please tell me..
_________________
embedding innovation in engineers
Ttelmah
Guest







PostPosted: Mon Mar 01, 2010 5:24 am     Reply with quote

Do a search for 'Software RS232 not disturbed by interrupts'. Select to find all keywords.
The routine posted, was for receive only, but the same approach can be be used for transmit, with a second state machine. I have managed 9600bps, full duplex, on a chip with no UART in the past.

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