recommend documents to learn RS 485 protocol?

Thread Starter

Gajyamadake

Joined Oct 9, 2019
313
Hi,

I am sure that the 485 protocol would have been used by the many people. There are so many resource available on internet I am looking for good documents. Which document will you recommend to learn this RS 485 protocol?

Any help would be highly appreciated.
 

MaxHeadRoom

Joined Jul 18, 2013
20,658
The electrical characteristics can be found on any manufacturers spec sheet.
Unless you refer to the type of data format, which is totally separate and nothing really to do with the above characteristics. .
For transmission protocol there is Modbus and CANbus for two examples.
Max.
 

nsaspook

Joined Aug 27, 2009
7,283
For strictly RS-485 physical connection questions a few documents you should read.
http://www.bb-elec.com/Learning-Center/All-White-Papers/Serial/Polarities-for-Differential-Pair-Signals-(RS-422-a/Polarities-for-Differential-Pair-Signals(RS-422-an.pdf
https://github.com/nsaspook/vtouch_v2/blob/mbmc/RS-485 Connections FAQ, 2 Wire RS485_RS232 - B&B Electronics.pdf

For general data transmission protocols like Modbus you still need to be exactly equipment specific as data exchange formats are encapsulated into Modbus packets differently.
For a recent project I used this as the base document to design a simple master/slave Modbus PIC18f1320 controller for a Solar Charge Controller.
https://github.com/nsaspook/vtouch_v2/blob/mbmc/ROVER_MODBUS.pdf

This was translated into C state machine code to request only a few of the many possible command possibilities.
C:
/*
 * Driver software Rover Elite charge mode monitor
 * Runs on a PIC18F1320 
 *    nsaspook@nsaspook.com
 * cpu clock 10mhz external
 * Version
 * 1.0 Rover Elite SR485 controller status monitor
 * 1.1 for rev 1.1 PCB
 * 1.2 full CRC for TX and RX
 * 1.3 status led blinker code
 * 1.4 adjust pwm values for new board
 * 1.5 switch to High Voltage chip programming
 * 1.6 convert to xc8 compiler
 * 1.7 sequence mode and error modbus commands
 */

#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <pic18f1320.h>
#include "ibsmon.h"
#include "ihc_vector.h"
#include "crc.h"

#define BusyUSART( ) (!TXSTAbits.TRMT)

int8_t controller_work(void);
void init_ihcmon(void);
uint8_t init_stream_params(void);

uint16_t req_length = 0;
const uint8_t modbus_cc_mode[] = {0x01, 0x03, 0x01, 0x20, 0x00, 0x01},
modbus_cc_error[] = {0x01, 0x03, 0x01, 0x21, 0x00, 0x02},
modbus_cc_clear[] = {0x01, 0x79, 0x00, 0x00, 0x00, 0x01},
modbus_cc_freset[] = {0x01, 0x78, 0x00, 0x00, 0x00, 0x01},
re20a_mode[] = {0x01, 0x03, 0x02, 0x00, 0x02, 0x39, 0x85},
re20a_error[] = {0x01, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x39, 0x85},
re20a_clear[] = {0x01, 0x79, 0x00, 0x00, 0x00, 0x01, 0x5d, 0xc0},
re20a_freset[] = {0x01, 0x78, 0x00, 0x00, 0x00, 0x01, 0x60, 0x00};
https://raw.githubusercontent.com/nsaspook/ihc_mon/re20a/ibsmon.c
 

Papabravo

Joined Feb 24, 2006
13,711
If I have to transfer data from MCU to PC, through RS 485 protocol, do I need to use RS485 Driver IC ?
On the MCU - yes.
For the PC you need an RS485 - USB dongle so you can use a virtual com port. PC's don't have serial ports anymore and they never had one that was RS-485 compatible.
 

MaxHeadRoom

Joined Jul 18, 2013
20,658
For the PC you need an RS485 - USB dongle so you can use a virtual com port. PC's don't have serial ports anymore and they never had one that was RS-485 compatible.
Many PC boards Asus etc have a 9 pin COM port connector on the Mobo in most case, they just do not bring it out anymore.
You can also still get the USB to RS232 convertor.
Max.
 

John P

Joined Oct 14, 2008
1,808
I doubt if anyone would want RS232 these days, unless you need to connect to a piece of legacy equipment. A USB to serial converter is much easier to deal with, and they usually provide 5V from the computer, which gives enough current to operate a processor and a small amount of extra circuitry. But I recently bought a USB to RS-485 converter, and found that it didn't give access to the computer power supply, until I cracked it open and added that feature.
 

nsaspook

Joined Aug 27, 2009
7,283
There is a LOT of legacy devices in commercial and industrial installations that won't be replaced until a plant closes. I always spec hardware serial ports on new PC for industrial applications. Most of the newer embedded PC platforms still have serial headers on the board for out-of-band management.
 

MaxHeadRoom

Joined Jul 18, 2013
20,658
In the area I work in, i.e. CNC and automation equipment, there are still many machines operating dating back to 80's and some maybe older.
Most of which use RS23 for part program/data information.
BTW, a fairly recent HP laptop I purchased with WIN10 has a 9P COM port on the side!. ;)
Max.
 

MrChips

Joined Oct 2, 2009
21,076
What's wrong with MAX485 or SN75176?

RS-485 is the electrical standard. You don't need this unless you really want to test very long cabling and high data rates on a network.

All you really need is to connect two computers.
 
Top