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

16f877a microcontroller serial communication with 16f877a

 
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

16f877a microcontroller serial communication with 16f877a
PostPosted: Sun Feb 14, 2010 11:10 pm     Reply with quote

Hi,

I have interfaced the PIC16f877A microcontroller with another PIC16f877a microcontroller. In Proteus simulation it is working fine with putc and getc commands.

But, in real time it is not communicating properly. Means, no character in the receiver or some other.

I think, the problem is with the baud rate. I am using 3.5795MHz crystal oscillator in both microcontrollers.

What is the matching baudrate for that crystals oscillator? If i use 4 MHz as my crystal frequency and what is the standard baud rate? Is there any baudrate calculator for PIC microcontroller?


Thanks and regards,

Varadharaj.E
_________________
embedding innovation in engineers
PCM programmer



Joined: 06 Sep 2003
Posts: 18030

View user's profile Send private message

PostPosted: Sun Feb 14, 2010 11:20 pm     Reply with quote

You can use the PicBaud program to tell if it's possible to use a desired
baud rate. Download it from this page. Unzip it and put it on your desktop:
http://www.micromagicsystems.com/#/picbaud/4523812801
This web page takes a few seconds to load, and it plays a sound.
evaradharaj



Joined: 15 Jan 2009
Posts: 60

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

thanks
PostPosted: Mon Feb 15, 2010 4:06 am     Reply with quote

thank you Sir,



I have downlaoded it and checked it... I have a doubt that if i give 3.5795 MHz to the clock and baud rate is 9000. Then it is showing 3.27% error. Is it acceptable? how many % of error is tolerable for 16f877a.

Once again thanks for the link.. Smile
_________________
embedding innovation in engineers
Ttelmah
Guest







PostPosted: Mon Feb 15, 2010 4:43 am     Reply with quote

Why on earth run at 9000bps?.
However you should have no error at all between your devices. Since both use the same crystal, both will have exactly the same error in the local frequency being generated, and the error _between the devices_ will be zero.

3.27%, is 'upper end' of acceptable error on the link, however would normally be 'acceptable', but you should not have any error at all with just these two devices.

Your problem is from something else.

How are the devices powered?. How is the connection made between them?. Remember that there needs to be a ground connection as well as the signals. How long is the connection?.

Best Wishes
evaradharaj



Joined: 15 Jan 2009
Posts: 60

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

Re: PIC to PIC communication
PostPosted: Mon Feb 15, 2010 11:52 pm     Reply with quote

Both are having separate power supplies. Because one is transmitter another one is receiver. The distance between transmitter and receiver is about 1/2 feet.

The same code is working in Proteus. But in real time some different symbol or no character is displaying !!!

Please can you find out what is the problem.
_________________
embedding innovation in engineers
Gabriel



Joined: 03 Aug 2009
Posts: 711
Location: Panama

View user's profile Send private message

PostPosted: Tue Feb 16, 2010 2:10 pm     Reply with quote

ignore my post, Ttelmah posted the same before... i didnt see it.

[edit]
"Are you sharing a common ground? Maybe you forgot that since you're using 2 power supplies. Tx and Rx line alone won't cut it"
_________________
CCS PCM 4.135 - PIC: 16F886, 88', 876' 877A
CCS PCH 5.012 - PIC: 18F97j60
evaradharaj



Joined: 15 Jan 2009
Posts: 60

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

common ground
PostPosted: Tue Feb 16, 2010 11:27 pm     Reply with quote

There is no need of giving common ground.

Because it is a communication link. I tried it with 89c51. It has worked perfectly. No need for common ground.

Now I am trying with wired communication. After that I'll go for wireless.
_________________
embedding innovation in engineers
Gabriel



Joined: 03 Aug 2009
Posts: 711
Location: Panama

View user's profile Send private message

PostPosted: Thu Feb 18, 2010 4:11 pm     Reply with quote

You need a common ground.... a ground line.

Check the RS232 standard. Minimun requirement for Tx/RX is 3 cables.... on of them is the GND.

A signal is electricity (voltage) .. and a bit of current... a signal needs to be referenced to something.... thus the common ground....
else the machine receiving or sending... can't tell the diference between high or low.... current won't flow.... signal doesn't get there.

Put a third line... a ground line.... and it will work.
_________________
CCS PCM 4.135 - PIC: 16F886, 88', 876' 877A
CCS PCH 5.012 - PIC: 18F97j60
evaradharaj



Joined: 15 Jan 2009
Posts: 60

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

Common Ground
PostPosted: Thu Feb 18, 2010 9:14 pm     Reply with quote

If it is a wireless communication for about 100 mts.

How can I put the common ground. I tried with 8051 microcontroller without common ground its working fine.
_________________
embedding innovation in engineers
arunb



Joined: 08 Sep 2003
Posts: 483
Location: India

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

RE:
PostPosted: Thu Feb 18, 2010 10:52 pm     Reply with quote

Could post a schematic ??
evaradharaj



Joined: 15 Jan 2009
Posts: 60

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

scematic
PostPosted: Fri Feb 19, 2010 12:48 am     Reply with quote

I will copy that bu tomo
_________________
embedding innovation in engineers
Gabriel



Joined: 03 Aug 2009
Posts: 711
Location: Panama

View user's profile Send private message

PostPosted: Sun Feb 21, 2010 4:53 pm     Reply with quote

What wireless link are you using?

Do your pics talk to each other and does the code work when having a
a real wired connection?


Does the link have preset baud rates? you might have a conflict between the pic and the link if your forcing the pic to 9000 and the link is running 9600.

Why not just use a 20mhz crystal and a 9600 baud rate?
I always use that and it never fails. Don't worry to much about the error rate on the signal for now.... just get it working first...stick to standards.
_________________
CCS PCM 4.135 - PIC: 16F886, 88', 876' 877A
CCS PCH 5.012 - PIC: 18F97j60
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