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.

[SOLVED] PIC32 and PIC18 communication using UART

Status
Not open for further replies.

nick703

Advanced Member level 1
Joined
Oct 17, 2011
Messages
422
Helped
21
Reputation
44
Reaction score
22
Trophy points
1,298
Location
surat
Activity points
3,987
I have a PIC32MX795F512L and PIC18F4431 . and i have to communication using UART. So My question is that required both side MX232 level shifter? because PIC32MX795F512L is 3.3 v and PIC18F4431 is
5 v signal. or i have required only 1 MX232 to communicate both side?

Basically my application is Windows Form based Application Send and Receive Command between

PC TO PIC32MX795F512L .

and when Specific command received for PIC32MX795F512L some task I have transfer another command to

PIC32MX795F512L to PIC18F4431 . so i have to communication PC TO PIC and PIC TO PIC.
 

From the PC you certainly need a level shifter, the MAX232 or MAX3232 come to mind. RS232 levels from a PC are typically +12V to -12V so far too high for any PIC but note the levels are inverted too.

You might be able to use a direct connection between the PICs, although not ideal, the 3.3V signal should be recognized as logic levels by the 5V device and to drop the voltage in the other direction you can use a resitive divider, for example 1K in series and 1.5K to ground on the 3.3V side. If long distances are involved, certainly look at using line drivers and receivers but for short distances it will almost certainly work without special interfaces.

Brian.
 
Considering that both microcontrollers are certainly mounted at different PCBs and also have different TTL levels, yes, you need to convert to RS-232 or even to RS-485 depending on the distance between these boards; Anyway in order to communicate with the PC, the standard interface available at most PCs is the RS232.
 
Last edited:

If input pin of pic32 is 5v tolerant, just connect directly. Will work. If not, make a simple devider. TX 3.3V -> RX 5.0V can be used without converters.
 
Hi,

I'd say it depends on distance, cabling, power supplies, data rate...

Klaus
 

Ok Now i am able to connect PIC to PIC and PIC to PC communication using UART.

Now I have Frequency Driver and is communication using PC directly. so in frequency Driver has a MAX232 ic to connect directly PC. But now i want to control using PIC micro controller . and so i don't remove frequency driver MAX232. then how to interface using pic microcontroller?

Is that i required MAX232 in my side also?
if yes then i have to invert TX and RX ?
If no then other solution please.
 

You basically have to simulate the PC port by adding a MAX232 (or MAX3232 if it's the 3.3V device driving it) to convert the PIC voltages so they match those from the PC.

RS232 transmit levels are inverted by the MAX232, a logic high becomes -12V and a logic low becomes +12V with respect to ground. The opposite happens when the device converts RS232 back to logic levels. So you can connect UART to UART directly -or- you can connect both to the MAX drivers/receivers, because they invert when sending and again when receiving, the signal effectively is 'the right way up' again. No need to invert the signals yourself.

Brian.
 

Hi,

could you explain "Frequency driver".
I rather think you are talking about a "level shifter".

Klaus
 

I think the "Frequency driver" is a module or some equipment currently driven through RS232 from a PC, they want to drive it from a PIC instead so it needs to have a level shifter to emulate the PC serial port.

Brian.
 

Yes Right. so How can i doing communication of PIC to Frequency Driver Module which has a inbuilt MX232 and communication perfectly via PC serial port.
 

If the only way the frequency shifter has to communicate is through RS232 signals then, as has been stated above, you need another RS232 to logic converter (such as the MAX(3)232) which will interface to the PIC's UART pins.
Try using a pencil and paper to draw out what you are trying to do. Label the lines coming from each device with the type of signal it has and then make sure that each line between two devices has the same label at each end: if not then you need to add something that will do the translation for you.
Doing this is only hard when you don't take the time to do the thinking and design work first.
Susan
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top