Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Multiple Serial Port using PIC16F77A Problem??

Status
Not open for further replies.

xpress_embedo

Advanced Member level 4
Joined
Jul 5, 2011
Messages
1,165
Helped
161
Reputation
396
Reaction score
191
Trophy points
1,353
Location
India
Activity points
10,577
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
Thanks in Advance
 

paulfjujo

Advanced Member level 4
Joined
Jun 9, 2008
Messages
1,449
Helped
293
Reputation
586
Reaction score
278
Trophy points
1,363
Location
France 01800
Activity points
10,225
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

Advanced Member level 4
Joined
Jul 5, 2011
Messages
1,165
Helped
161
Reputation
396
Reaction score
191
Trophy points
1,353
Location
India
Activity points
10,577
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

:)
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top