Previous in Forum: ohm convert to 4-20ma   Next in Forum: Screw it up , Push it in, Pull it out, Throw it away foam audio earplugs
Close
Close
Close
9 comments
Rate Comments: Nested
Participant

Join Date: May 2008
Location: lahore , pakistan
Posts: 4

communication between PIC16F84A and PIC 16F877A

05/28/2008 10:43 AM

i want to send data from pic16f877a to pic16f84a , using portb of both , i have just make connection between both them directly , without using any extra thing. but i can't succeed in getting my desired result. what i do , do i need anything else between their connection . or what? please reply also fast...

Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.
Guru
Engineering Fields - Electrical Engineering - New Member

Join Date: Sep 2006
Location: El Lago, Texas, USA
Posts: 2639
Good Answers: 65
#1

Re: communication between PIC16F84A and PIC 16F877A

05/28/2008 11:45 AM

If these are serial ports, make sure you cross the wires - the data out of one goes to the data in of the other, etc.

Register to Reply
Guru
Popular Science - Weaponology - New Member United Kingdom - Member - New Member

Join Date: May 2007
Location: Harlow England
Posts: 16512
Good Answers: 670
#2

Re: communication between PIC16F84A and PIC 16F877A

05/28/2008 6:09 PM

I don't know details of the chips you mention...so maybe this won't help...
Do you want bi-directional communication or just one way?

If just one way....start simply by connecting an output pin of one micro to the input pin of the other.(maybe via 100 ohms or so, I say why later).. This is simple low speed stuff I'm talking about, clocking at a mere 8MHz Zilog Z86 series microcontrollers.

Set the output pin high and check you can read it on the input pin. Then test the low state, then start sending pulse trains and see if you can catch them either by using interrupts..or just dumbly checking the input pin in a loop and looking for changes.

You can make up your own communication protocol or use some existing standard.There are plenty of ways to do it, you can sync on a start pulse and then check the level at fixed time increments or whatever.

I have designs with 2 micros communication burst of data to eachother, I try to keep it simple with a Tx and Rx pin on eack micro permanently connected (as small series resistor is a handy point to hang a scope and helps prevent any switch on conficts before the ports are configured.

I hope this makes sense ...

Del

__________________
health warning: These posts may contain traces of nut.
Register to Reply
Anonymous Poster
#7
In reply to #2

Re: communication between PIC16F84A and PIC 16F877A

06/06/2008 11:12 AM

thanks to all , i succeed in making communication between the two. by just connecting 10k resistor between the two and giving it 5 volts, mean using it as pull up . also input pins were initially set to 1. anyways thanks to all

Register to Reply
Guru

Join Date: Dec 2005
Location: Etats Unis
Posts: 1871
Good Answers: 45
#3

Re: communication between PIC16F84A and PIC 16F877A

05/29/2008 3:42 AM

If you are to transfer data reliably you must devise a means of handshaking between the two processors. You can use some of the lines to signal back and forth by pulling them up or down with resistors and defining an idle state where the device requesting to send pulls one line to the active state and then monitors the other line for the ready response. Then you make the data available for a predefined period and the receiving processor must read the data during that period. Then you return to the idle state.

It would be easier if you can dedicate some extra lines just for handshaking. Then you don't have to double duty some of the data lines which of course slows down your maximum data rate, if that matters to you.

__________________
The hardest thing to overcome, is not knowing that you don't know.
Register to Reply
Power-User
Hobbies - CNC - New Member Hobbies - Musician - New Member

Join Date: Jan 2007
Location: South Africa Johannesburg
Posts: 187
Good Answers: 3
#4

Re: communication between PIC16F84A and PIC 16F877A

05/29/2008 5:07 AM

mmmm...know the devices well. Question time: Half duplex? who's the slave and master or are they changing? If F877 master config portb output to trisb in bank1 and F84a input. 100 ohm carbon between then is also ok. A basic 8 bit wide bus? How fast must the data rate be? make sure both PIC's are running same voltage. You would have to sync the clocks at fast rates as you are not using the USART peripheral which would be tx to rx and vice versa(just another method) Check your MCLR!!!! can cause problems and turn that funny watchdog off. Check your config bits are set to the same ie MCLR and BODEN. Start off with a basic slow routine get some LED's to turn on and off first then build on that...eg

MOVLW OFFH

MOVWF PORTB

CALL TIMER ;SIMPLE 1 SEC TIMER ROUTINE

CLRF PORTB

All outputs on port b should go on for one second( LED's are useful)

To read them in:

MOVF PORTB,W

MOVWF TEMP ;STORED VALUE ON PORT

You will have to put this in a routine with a quite tight loop as to "catch" the change on port b then use TEMP value to decide on what you want to do in another routine.

Sorry about assembler code but its the one i use most

This is very basic, hope it gives you some idea

__________________
Think and move like an electron
Register to Reply
Member

Join Date: May 2008
Posts: 6
#5

Re: communication between PIC16F84A and PIC 16F877A

05/29/2008 9:24 AM

Normally most engineer will use the UART to communicate. This I had done it before in a project that transfer between 2 processor, but not your PIC16F877a and PIC16F84a. The idea will be the same. Make sure you must link the RX to TX.

Another way which I going to us for my current project is using the I2C signal. It will tranfer data between 2 processor. One of the processor had to be master for the clocking of the serial data.

Other way which a single direction is using the SPI signal. This only send one way like to a display.

Good Luck.

Register to Reply
Power-User
Canada - Member - BC Born, Alberta Raised, Quebec (poutine) crazed... Engineering Fields - Aerospace Engineering - An airplane is just a bunch of beams... Hobbies - Model Rocketry - Had fun as a kid...fun stuff Hobbies - CNC - dreaming of cutting Engineering Fields - Control Engineering - PID ME!

Join Date: Aug 2006
Location: Montreal, CANADA
Posts: 368
Good Answers: 10
#6

Re: communication between PIC16F84A and PIC 16F877A

05/30/2008 7:06 AM

I'm starting a project where I need to daisychain a bunch of boards together and decided on the CAN bus protocol. You can do it with software or just buy some of the CAN controllers that deal the nitty gritty details. I got mine from sample.microship.com for testing and then will buy the 50 I need later once everything is working.

__________________
kkjensen
Register to Reply
Anonymous Poster
#8

Re: communication between PIC16F84A and PIC 16F877A

06/14/2009 1:41 PM

uff!

i think u should go to a nearly mental hospital as soon as possible,

(just kidding)

Register to Reply
Anonymous Poster
#9
In reply to #8

Re: communication between PIC16F84A and PIC 16F877A

06/14/2009 1:48 PM

actually tayyeb i love u!

Register to Reply
Register to Reply 9 comments
Copy to Clipboard

Users who posted comments:

Anonymous Poster (3); bhankiii (1); ChawCS (1); kkjensen (1); madness (1); rcapper (1); user-deleted-1105 (1)

Previous in Forum: ohm convert to 4-20ma   Next in Forum: Screw it up , Push it in, Pull it out, Throw it away foam audio earplugs

Advertisement