Continue to Site

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.

rs232 bewtween 2-microcontroller

Status
Not open for further replies.

tusemo

Advanced Member level 4
Joined
May 28, 2012
Messages
109
Helped
23
Reputation
48
Reaction score
22
Trophy points
1,298
Location
Turkey
Activity points
1,841
Is it possible to communicate between 2-pics (which have different clock frequency) by using rs232 port, any code example of pic ccs c complier ?
 

Yes it is possible.
Use the UART module of each microcontroller. Connect the RX of one microcontroller to the TX of the other and vice versa.

Make sure you use the same baud rate and other settings.
 

Can I use one as pic transmitter (4Mhz) and 3-pics (1843200 Hz ) as receiver ?
 

Why do you want to use 1843200 Hz? Why can't you use 2 MHz?
 

Yes you can. You can send the data to all the receivers, which can all be assigned different IDs or addresses. The transmitter first sends the ID/address and then the data. So, the receiver can check if the data has been sent for it or not. You can also use a third pin for something like chip select. But this would require an additional pin for each receiver.

There's no problem with the 2 PICs running off different clock frequencies. Just make sure they use the same UART configuration.
 

The Clock rates of the individual MCU do not matter*.
You just have to select the same Baud Rate.

The CCS C compiler has easy settings where you can just use the "printf" command to send data over the RS232.
Just make sure that your settings in both the transmitter and the receiver are the same.

*Actually the clock rate of the MCU does impact since it causes a small error in the baud rate during transmit/receive. This is mentioned in the Data Sheet of the MCU. But this error is quite small and can be ignored.

Just search the CCS forums for sample programs using RS232. While CCS C is a simple compiler, it takes up a lot of memory, so be careful about that.
 

Is there any mistake with this configuration ? Because I cant communicate ?
3pic communication - eda.png

- - - Updated - - -

I have tried to find 2Mhz but couldnt so I have used 1843200Hz crystal. The my purpose is driving servo motors with cpp modules the 50Hz pwm-frequency can obtained by that clock frequency.
 

You have to use 1 extra pin for Chip Select. i.e., for selecting the slave. Do you want to send the same data from master to all the 3 slaves?
You also have to pull MCLR pin high by connecting it to Vcc/Vdd through a 10K resistor.
 

Yes I want to send the same information to all pics I will arrange the selection by software, by the way if I would use extra selection pin, should I connect the pins directly or should I add a resistor to between pins?
 

No need for resistor. You can connect it directly if both master and slaves operate at the same voltage levels i.e., 5v or 3.3v
If you are sending the same data to all the slaves then you don't need a chip select pin.
 

But this configuration is not working, I am using same software (just changing clock ) for pic to pic communication, but not valid for pic to 3-pics communication, any comment that made me crazy :)

- - - Updated - - -

Dear internetuser2k12 , for my configuration should I remove the resistors, the thing I am afraid about is the resistors have a little capacitance-behaviour at high frequency may they are blocking the communication ??
 

can u able to do communicate between two controller or not.........
 

Yes I can do it for two microcontroller.
 

You don't need resistors. You can connect directly. Maybe the Tx pin of master not able to drive three pins of slaves.
 

In case of the master's pin cant drive 3-slave-pin adding resistor will solve the problem ??
 

What should I do, can you tell me?, should I use buffer ?
 

Try using a 10k pullup on Tx line of master. Are you simulating just in Proteus or are you testing on hardware? Zip and post your Proteus file and project files.
 

dont use the resistor between the tx and rx pin of the microcontroller because the input pin RX remains always at Vcc try to connect directly and see....

because the tx pin is not driving the microncontroller..............
 

Ok I will design my circuit and realize and test then I will share the knowledge here.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top