# [SOLVED]Multiple Serial Port using PIC16F77A Problem??

Status
Not open for further replies.

#### xpress_embedo

I want to use two Serial Ports in a Single Controller.. Thats why i choose PIC16F877A having one Serial Port...

I read the CCS Help topics??

How can I use two or more RS-232 ports on one PIC®?

And Just Copy Paste its Code and program my Controller.. but it is neither working on hardware nor on proteus...
Pls help

Here is My Code

Code:
#include<16f877a.h>

#use delay(clock = 20000000)
#fuses HS,NOWDT,NOPROTECT,NOBROWNOUT

#use RS232(BAUD=9600, XMIT=PIN_C6, RCV=PIN_C7, STREAM=COM_A)
#use RS232(BAUD=9600, XMIT=PIN_C4, RCV=PIN_C5 , STREAM=COM_B)

void main()
{
char c;
fprintf(COM_A,"Online-A\n\r");
fprintf(COM_B,"Online-B\n\r");
while(TRUE)
{
c = fgetc(COM_A);
fputc(c, COM_A);
fputc(c, COM_B);
}
}

Online A and Online B are Coming properly but when i type character in COM_A Nothing happens...

fgetc is not working

Pls help

#### paulfjujo

hello

you have only one Hardware UART on 16F877 !
so you can use this one
but for the second you have to use a Software uart
by using , for example B0 and B1
BO for receiving with interrupt on edge for the start bit..
see software uart bit bang on the web...

or use a PIC with 2 Hardware UART..
new one can have up to 4 uarts !

#### xpress_embedo

hello

you have only one Hardware UART on 16F877 !
so you can use this one
but for the second you have to use a Software uart
by using , for example B0 and B1
BO for receiving with interrupt on edge for the start bit..
see software uart bit bang on the web...

or use a PIC with 2 Hardware UART..
new one can have up to 4 uarts !

I am using CCS PIC-C Compiler... which is having in-built functions for Software UART....
and i am operating both uart as software uart in the above code...

- - - Updated - - -

Got solution Problem Solved

#### bigdogguru

What was the issue?

Please post the solution so that others may benefit.

BigDog

Status
Not open for further replies.