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.

Microcontroller with RS 485

Status
Not open for further replies.

engr_joni_ee

Advanced Member level 3
Joined
Nov 3, 2018
Messages
726
Helped
2
Reputation
4
Reaction score
4
Trophy points
18
Activity points
6,042
Hi, I normally work with RS 232 in PIC 16F/18F Microchip Microcontroller and MCP 2221 which is USB-UART chip, but RS 232 has maximum data rate limit up to 1 Mbps. Recently I have heard about some PIC Microcontrollers having RS 485 which is differential and can support up to 10 Mbps.

I have two basic questions.

1- It is possible to configure and generate the code for RS 485 in MPLAB MCC GUI ?
2- Is there exist RS 485 to USB chip that I can use on the development board instead of FDTI cable ?
3- Any recommended PIC Microcontroller with RS 485 ?
 

Hi,

I´ve never seen a microcontroler with RS232 nor with RS485. (But maybe there are)
Both are voltage level standards (PHY) for serial communication.
Both are usually used with a UART. UART is a standard interface for serial communication and usually included in microcontrollers.
In opposite to RS422 the RS485 may be used as half duplex communication over one signal pair. Even in multidrop bus.

1) when you do one pair signaling for TX and one pair for RX you don´t need to modofy code at all.
2) There is no USB-to RS232 chip, there is no USB-RS485 chip (At least I never heard of it). But you may buy such modules or cables. Just do an internet search.
3) see above

You could speed up to get information by simple internet search on your own.

Klaus
 

In addition, whatever baud rate you want to use over RS-232 or RS-485 physics, it must be supported by your microcontroller. PIC16/18, even the most recent chips with up to 48 MHz core clock speed are rather linited in this regard.

You can e.g. use FTDI RS485 cable, or any adapter available on the market.

1629457705309.png


It supports baud rates up to 3 MBaud, setting above quasi standard 922 kBaud requires however special action on the PC side.
 

That's right. Many Microcontrollers have UART module. How to implement the full duplex RS-485 protocol in Microcontroller ?
 

Now I am getting it.

The Tx of UART inside Microcontroller will drive TXD+/TXD-. Similarly the Rx of UART will drive RXD+/ RXD-. Then I should look for UART to RS 485 driver IC, for example MAX22502E.
 
Last edited:

Hi,

did you read FvM´s post?

now you select a 100MBaud transceiver. Not very useful, I think.
Expensive, but it should work.

Do internet search. There ar many thousands of example circuits, application notes, even videos.
Every RSxxx Ic manufactorer provides interactive selection tools. Especially for you ... and for free.



Klaus
 
But also note that RS485 is a two wire system, the TX+/- and RX+/- are the same wires so you have to implement some method in software or hardware of switching data direction. If you want the UART TX to send over a high speed pair and the UART RX to receive at high speed simultaneously, consider using RS422 instead. RS422 works full duplex like the UART does.

Brian.
 

Hi, I just want to clear something on my side. I understand that UART is a communication protocol while RS 232, RS 422 and RS 485 are physical standards that deals with the electrical signal and voltage levels. There are driver IC for each standards. The length of wire on these standards is limited by the data rate. UART module in Microcontroller can drive all these standards through their driver IC on the development board.
 

Hi,

Now I several times told you to do internet search first.

I ask myself...Did you follow my recommendation or not?
--> If you did: You can give a link to the document where you found "UART is a communication protocol"
--> If you did not: It´s high time to do so!

Klaus
 

Hello!

You can give a link to the document where you found "UART is a communication protocol"

As soon as you search on the net, you will find UART associated with protocol, and this is not
necessarily by newbies as the analog devices link below shows.
That's a matter of definition. So even if the terms are not adequate, I somewhat understand what
this article is about. I often use the word "kilogram" for a force, and I might be seen as a heretic
from the purists of physics. Kilogram somewhat "talks" to me, not newton. But I of course use
newtons for calculations.

That said, I agree with you that some more net search would bring quite a few implementation examples.
@joniengr:
- Buy a RS 422 chip
- Wire microcontroller TX to one input, which will transform TX to a pair TX+ / TX- which goes to external
communicating hardware
- Wire microcontroller RX to one output, the input being RX+ / RX- coming from external communicating
hardware.
At some point you may have to add 100 ohms loads somewhere between +/-.
Doing this, you can probably run at full speed of your µC, but this may depend on the cable length.

NB: I haven't touched that kind of hardware for a while, so try to search the net for actual schematics.
And come back when you have done your homework. No problem if it doesn't work at that point,
we are here to help. I mean: no problem if you have at least tried something.

Dora.
 
Hi,
As soon as you search on the net, you will find UART associated with protocol,
I know this. But this is not the problem. (If interested we may discuss this in a new thread)

I did not write whether UART is a PROTOCOL or not.
My idea was to leave the question open in the hope that the OP finds out on his own what is the definition for a UART and what is the definition of a PROTOCOL.

From my previous posts - I think I´m known for not spoonfeeding. I try to help people to help themselves.
This should result in a benefit for the future. A true long lasting help for the member.

The more effort a member shows - when he/she refers to datasheets and internet pages - the more effort I give back.

But if a member seems (yes, "seems", because we don´t get any information in the posts) not even spend the time for a "hey Alexa: what is a UART?"
or an internet search for "UART definition" or "wikipedia UART"..
...then he/she just wants others to do the work for him/her.

Klaus
 

Hi,

[...]
From my previous posts - I think I´m known for not spoonfeeding. I try to help people to help themselves.

Klaus
Well, there are many ways to approach teaching. I'm the opposite, known for spoonfeeding.
Sometimes it can initiate a spark necessary to get the guy started. Especially on a large spectrum
of people with different abilities. In Japanese, there is an expression for people who understand
quickly: you explain 1 and he understands 10. But unfortunately, there are also people to whom
you explain 10 and who don't understand 1. A few mails to get them started, and if they don't
then forget it.

Dora.
 
Hi,

Yes, a different approach. Nothing against it.

I wonder:
Some hobbyists seem to think we professionals know everything from mind.
They think we don't need to do internet search, forum search, reading datasheets, visiting semiconductor manufacturer's internet pages..?
But it's exactly the other way round: We do all this every day. And we don't complain about it, we just do it.
We all did start at zero. We all have almost identical access to datasheets...and it's the same effort. I don't ask for something special.

Klaus
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top