Previous in Forum: PLC or DDC Wi-fi Communication   Next in Forum: Electronics Security Systems
Close
Close
Close
16 comments
Rate Comments: Nested
Active Contributor

Join Date: Apr 2007
Posts: 11

Serial Communication between PIC16F84A's

05/09/2007 11:05 AM

What if you need to communicate two microcontrollers like this models which has no predefined serial communication support like I2C or RS232? Or what if you need extra serial communication points as your current ones are busy & already being used?

I tried programming a time divisioning and cycle counting protocol for two PIC16F84A's. For the each code you predefine, you give a different period of logic signal. Like: For code#1 , 5 miliseconds, #2, 10 miliseconds, etc etc... Then other pics starts counting within a period of (for example:) 100 microseconds, this means, when that 5 miliseconds start, pic will divide that 5 miliseconds to 100 microseconds, and will have a number counter and it will be kept in registers, for example, while doing this, in my example, for 5 ms switching (transmitting pic), 100 microseconds counted 45 times, i defined a number between 35 and 55, which will be the equivalent of 5 ms predefined code in receiving pic, i define 10 numbers back and forward as extra, to protect communication from errors, you can use higher frequency clock signals for pics up to their limits told in datasheets, and use lower time periods down to minimum of one step operating time of microcontroller at that point to be able to send more codes and recieve, also can change programme based on this to have a continous communication. It's up to your algorithm.

Here is the link to the package of my example containing Proteus ISIS design and simulation, Picbasic, hex, asm files of program

http://rapidshare.com/files/30364431/yeni_seri_protokol.zip.html

and here is the video of the example posted on youtube

http://www.youtube.com/watch?v=MTlymy2PYIs

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: Serial Communication between PIC16F84A's

05/09/2007 11:36 AM

So what you're saying is that you toggle a signal in onr device that allows a counter in the other device to count to the value of the data you want to send? That's a clever idea if I'm reading you right.

Register to Reply
Active Contributor

Join Date: Apr 2007
Posts: 11
#2

Re: Serial Communication between PIC16F84A's

05/09/2007 12:11 PM

exactly, this asynchron transmission would work well for simple automation and control systems.

now i think of making a clock shared synchron transmission for models which has no support for serial communication. I think i will give the same clock signal from one source to both one's inputs, a sycnhronization algorithm will b based on this clock signal, this one would work well for continous data transmission with a decent bandwidth,

note that timings should be optimized and fixed, and error tolerations should be too as the crystals these pics use are affected and can give different clock signals. I havent used compensated crystals for microcontrollers yet and have no experience of it. But i suppose, they would give the best performance for timings of every microcontroller.

Register to Reply
Active Contributor

Join Date: Apr 2007
Posts: 11
#3

Re: Serial Communication between PIC16F84A's

05/09/2007 12:24 PM

Actually this sistem is similar to the dialing system of old phones. U know, u put ur finger in ring and rotate. I don't know if this Dial Pulse system is still used, i mean recognised by phone centrals in all countries. That system works in miliseconds. In this one, you can use microseconds. Easy and simple with microcontroller technology and basic programming language.

Register to Reply
Guru

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

Re: Serial Communication between PIC16F84A's

05/10/2007 12:33 AM

You can emulate a UART in software and send and receive serial data over any standard I/O pin. Sometimes this is called "bit banging". It takes about 40 bytes of code or so to do both a send and receive function. I have used these on all variety of PIC's down to the 8 pin models and used baud rates up to 9600 with a 4 mHz ceramic resonator. You have to be pretty close to standard frequency to ensure compliance with other UART's since the format is asynchronous but there is adequate margin for variance so it doesn't have to be perfect. If you do the code right all you have to do is change a constant to use different clock frequencies. I think there may also be example code on the Microchip website for doing this. The advantage of this is you can also set up a command structure to send ascii codes and strings so it is very versatile.

__________________
The hardest thing to overcome, is not knowing that you don't know.
Register to Reply
Anonymous Poster
#5

Re: Serial Communication between PIC16F84A's

05/10/2007 2:32 AM

it's me, saidakkas, i have hurry and dnt have time for logging on,

I didnt know it, it sounds really cool. I'm a student, studying telecom, so i worked on this as base of my future project, i mean programming a communication. Could you give me some more information about this serial communication you told about?

Register to Reply
Guru

Join Date: Dec 2005
Location: Etats Unis
Posts: 1871
Good Answers: 45
#6
In reply to #5

Re: Serial Communication between PIC16F84A's

05/10/2007 3:23 AM

Microchip application note AN593 is available on line.

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1999&ty=&dty=§ion=&NextRow=&ssUserText=an593

__________________
The hardest thing to overcome, is not knowing that you don't know.
Register to Reply
Active Contributor

Join Date: Apr 2007
Posts: 11
#7

Re: Serial Communication between PIC16F84A's

05/10/2007 7:46 AM

ty,

Register to Reply
Guru
Engineering Fields - Electrical Engineering - New Member

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

Re: Serial Communication between PIC16F84A's

05/10/2007 10:28 AM

You can also get all the serial communication you need using a single line if you Manchester encode your data - basically just XOR the data with the clock. On the receive end, you use a transition (high to low or low to high, depending on your implementation) to trigger a timer set to 3/4 of your bit period, and sample the data at that point.

Register to Reply
Active Contributor

Join Date: Apr 2007
Posts: 11
#9

Re: Serial Communication between PIC16F84A's

05/10/2007 11:23 AM

sounds that there are a lot of different ways of serial communication, and more can b found,

using a gate with clock would never come to my mind,

Register to Reply
Guru
Engineering Fields - Electrical Engineering - New Member

Join Date: Sep 2006
Location: El Lago, Texas, USA
Posts: 2639
Good Answers: 65
#10
In reply to #9

Re: Serial Communication between PIC16F84A's

05/10/2007 11:26 AM

It's common in fiber optic communication and military systems.

Register to Reply
Anonymous Poster
#11

Re: Serial Communication between PIC16F84A's

06/13/2008 1:29 AM

Hi!, I'm new in all of this, PIC programming, I'm studing and I'm doing a projet with PIC and communication between them, I'm driving crazy because I can't find any docummentation to do this, so you did and I'd like to know a bit of it, have you the schematic of PIC16F84 connection's? what did you transmit between PICs? in my projet I have to transmit data to move two ServoMotors, I have all doc. to move the servos but I do not know how to transmit between PICs, please help me about it, when I finish the projet I'd like to share my projet with you and everybody. Help me please, Thanks, Victor

Register to Reply
Anonymous Poster
#12

Re: Serial Communication between PIC16F84A's

06/13/2008 1:33 AM

By the way your link to youtube is not working, and I'd like to see it. Thanks, Victor

Register to Reply
Active Contributor

Join Date: Apr 2007
Posts: 11
#13
In reply to #12

Re: Serial Communication between PIC16F84A's

06/13/2008 3:11 AM

I deleted the video on youtube sometime ago. http://rapidshare.com/files/122093468/yeni_seri_protokol.zip.html Here are the files you need. I suggest you use these only to understand the basics of this communication, so have a look at picbasic pro files. ASM files possible too, but if you were at a level to understand assembler language n knew how to use it, you wouldn't need asking help. Anyway, what i'll say about using assembler is, don't use it yet, you have to recompile transmitter or receiever.pbp, I don't remember which one, I accidently compiled one of them for something else than PIC16F84. By the way, first re-read carefully what I wrote while starting this topic, then try to understand what s written in pbp file, this way would be easier for you to learn.

Register to Reply
Anonymous Poster
#14
In reply to #13

Re: Serial Communication between PIC16F84A's

06/17/2008 12:51 AM

Hi, I will try to understand the codes, it's look like you connected an LCD to the PIC, have you the connections, schematic of your the circuit? have you the electronics parts list? I'd like to try the same circuit. Thanks. Sorry if I bother you.

Register to Reply
Active Contributor

Join Date: Apr 2007
Posts: 11
#15
In reply to #14

Re: Serial Communication between PIC16F84A's

06/17/2008 1:31 AM

There's scheme of it amongst the files I uploade. It can be opened in Proteus ISIS, it was prepared in version 6 of it, Proteus 6... Now what you need is Proteus 6 demo I guess. Proteus is not installed on my computer now, or else I'd give you screenshot of scheme.

Register to Reply
Anonymous Poster
#16
In reply to #15

Re: Serial Communication between PIC16F84A's

11/17/2009 10:40 PM

hi im a student and im making a project which is a serial communication of two pic16f84a , i need to transmit a binary codes from one pic to othe pic.. example: im using the RB0 pin of pic as output for the 1st pic then i want to transmit a binary code which is 1010001 to the 2nd pic and then if the 2nd pic recieves that binary it will compare the binary wich is installed to it , then if they are the same, the servo motor wich is connected to the 2nd pic will rotate, and then if the binary codes are not the same nothings will happen,, my question is , how can i do the program of that using picbasic pro? pls help me to my project,, here is my email add.. lemzkeey_18@yahoo.com.ph

Register to Reply
Register to Reply 16 comments
Copy to Clipboard

Users who posted comments:

Anonymous Poster (5); bhankiii (3); rcapper (2); saidakkas (6)

Previous in Forum: PLC or DDC Wi-fi Communication   Next in Forum: Electronics Security Systems

Advertisement