![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
evaradharaj
Joined: 15 Jan 2009 Posts: 60
|
Need to have 2 RS232 Ports |
Posted: Sun Feb 28, 2010 9:51 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Mon Mar 01, 2010 3:00 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
evaradharaj
Joined: 15 Jan 2009 Posts: 60
|
Software UART |
Posted: Mon Mar 01, 2010 3:34 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Mon Mar 01, 2010 5:24 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|