pic to pic communication using uart

Thread Starter

franklin75

Joined Jun 11, 2016
14
Hi! i am interested in communication so in current days i am studying uart but have a some problems and questions about uart.Basicly i want to communicate with two pic using uart.Example:first pic have a button and led and second pic have a button and led,when you push the first pic's button the led blink(which is the second pic's ) and when you push the second pic's button the led blink(which is the first pic's).The project is so basicly but i want to understand this subject .please send me a some suggestions.thanks for your helps.
 

Papabravo

Joined Feb 24, 2006
21,226
UART is an acronym for Universal Asynchronous Receiver Transmitter. It is a hardware device that sends and receives characters. The characters are normally 8 bits in length and are encapsulated or "framed" by a START bit and a STOP bit. The receiver and transmitter need to have clocks that are close in frequency but do not have to be exactly the same. The characters may arrive at any time either singaly or in bursts. In order for the transmissions to be meaningful bot side must agree on what things mean. Assigning meaning to groups of characters is called "defining a protocol".

What else would you like to know?
 

dannyf

Joined Sep 13, 2015
2,197
The project is so basicly
this is kind like your i2c project in that your difficulties stem from your lack of what you are trying to do, and how the devices work (not how you think they work).

I would say that you should read the datasheet as much as you can and then start coding a master and then a slave.
 

jpanhalt

Joined Jan 18, 2008
11,087
I echo the comments about providing more information. Serial (i.e., RS232 type) communication between PICs is quite easy.

Do you plan to use hardware or software?
What programming language?

If you are open to using Assembly language for software driven communication, I can share some code that was shared with me several years ago. If you plan to use hardware, then the best resources for that are the applicable datasheets. Once you get through setting the registers, it runs smoothly. There are tables and online aids for calculating the registers to set baud rate.

John
 

NorthGuy

Joined Jun 28, 2014
611
UART signaling between PICs is on TTL level. PC requires RS232 levels, so if you want to talk to PC you will need an RS232 converter, such as MAX232, and also COM port on the PC, or some sort of USB converter. Setting up these things is more complicated than talking between PICs on TTL level.

Start from single PIC, connect RX and TX pins together. Now you have the PIC talking to itself - you can send something, then receive it back.

Going to two PICs is as simple as reconnecting them with 2 wires TX-to-RX.

It's much simpler than I2C :)
 

MaxHeadRoom

Joined Jul 18, 2013
28,697
UART signaling between PICs is on TTL level. PC requires RS232 levels, so if you want to talk to PC you will need an RS232 converter, such as MAX232, and also COM port on the PC, or some sort of USB converter. Setting up these things is more complicated than talking between PICs on TTL level.
Nothing complicated IMO?, it requires no extra programming and it makes debugging easier with a PC RS232 program to test.
Max.
 

Thread Starter

franklin75

Joined Jun 11, 2016
14
I echo the comments about providing more information. Serial (i.e., RS232 type) communication between PICs is quite easy.

Do you plan to use hardware or software?
What programming language?

If you are open to using Assembly language for software driven communication, I can share some code that was shared with me several years ago. If you plan to use hardware, then the best resources for that are the applicable datasheets. Once you get through setting the registers, it runs smoothly. There are tables and online aids for calculating the registers to set baud rate.

John
i am using c language.can you send me a same code for i2c,uart and spi?
 

dannyf

Joined Sep 13, 2015
2,197
can you send me a same code for i2c,uart and spi?
I really hope that you realize that anyone doing that is hurting you. The best help you can get now is to read the datasheets and read the compiler manuals so YOU can develop good understanding of how the devices and your tools work.
 

Thread Starter

franklin75

Joined Jun 11, 2016
14
I really hope that you realize that anyone doing that is hurting you. The best help you can get now is to read the datasheets and read the compiler manuals so YOU can develop good understanding of how the devices and your tools work.
my englishs is very bad sometimes i do not understand you but thank you for your suggestion.
 
Top