Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

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 ?
 

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
Can I use one as pic transmitter (4Mhz) and 3-pics (1843200 Hz ) as receiver ?
 

Joined
Jul 25, 2012
Messages
1,192
Helped
170
Reputation
340
Reaction score
161
Trophy points
1,343
Activity points
0
Why do you want to use 1843200 Hz? Why can't you use 2 MHz?
 

Tahmid

Advanced Member level 5
Joined
Jun 17, 2008
Messages
4,758
Helped
1,791
Reputation
3,574
Reaction score
1,650
Trophy points
1,393
Location
Silicon Valley, California, USA (from Dhaka, Bangl
Activity points
30,545
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.
 

nitishn5

Full Member level 5
Joined
Mar 27, 2011
Messages
308
Helped
79
Reputation
158
Reaction score
79
Trophy points
1,308
Location
Bangalore, India, India
Activity points
3,361
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.
 

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 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.
 

Joined
Jul 25, 2012
Messages
1,192
Helped
170
Reputation
340
Reaction score
161
Trophy points
1,343
Activity points
0
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.
 

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
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?
 

Joined
Jul 25, 2012
Messages
1,192
Helped
170
Reputation
340
Reaction score
161
Trophy points
1,343
Activity points
0
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.
 

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
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 ??
 

jjeevan007

Full Member level 5
Joined
Apr 13, 2012
Messages
311
Helped
44
Reputation
88
Reaction score
43
Trophy points
1,308
Location
bangalore
Activity points
2,781
can u able to do communicate between two controller or not.........
 

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
Yes I can do it for two microcontroller.
 

Joined
Jul 25, 2012
Messages
1,192
Helped
170
Reputation
340
Reaction score
161
Trophy points
1,343
Activity points
0
You don't need resistors. You can connect directly. Maybe the Tx pin of master not able to drive three pins of slaves.
 

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
In case of the master's pin cant drive 3-slave-pin adding resistor will solve the problem ??
 

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
What should I do, can you tell me?, should I use buffer ?
 

Joined
Jul 25, 2012
Messages
1,192
Helped
170
Reputation
340
Reaction score
161
Trophy points
1,343
Activity points
0
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.
 

jjeevan007

Full Member level 5
Joined
Apr 13, 2012
Messages
311
Helped
44
Reputation
88
Reaction score
43
Trophy points
1,308
Location
bangalore
Activity points
2,781
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..............
 

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
Ok I will design my circuit and realize and test then I will share the knowledge here.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top