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] max485 interfacing as transmitter and reciever

Status
Not open for further replies.

kalyaniupen

Junior Member level 2
Joined
Jul 25, 2014
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,468
I am new to MAX485 interfacing.My project is TTL-max485 level at transmiter side and max485-TTL at reciver side.please let me know how the connections are made to achieve level conversion and what will be the output voltages at transmitter side and reciever side.Is one max ic is ok for transmittr and reciever if so what are the hardware connections?
 

Hi,

Please first read the max485 datasheet.

Feed TxD to DI and RO to RxD.
RE may always be active.
DE needs to be activated with any port pin before you want to send data, and deactivated after the last bit is sent.

Klaus
 

You should read these cairfully in ic data sheet.

ABSOLUTE MAXIMUM RATINGS
Supply Voltage (VCC).............................................................12V
Control Input Voltage (RE, DE)...................-0.5V to (VCC + 0.5V)
Driver Input Voltage (DI).............................-0.5V to (VCC + 0.5V)
Driver Output Voltage (A, B)...................................-8V to +12.5V
Receiver Input Voltage (A, B).................................-8V to +12.5V
Receiver Output Voltage (RO).....................-0.5V to (VCC +0.5V)

circuit
https://obrazki.elektroda.pl/7550810800_1456815511.png
 

Hi,

I recommend to keep on the "recommendend operation values" this is how the device is designed to operate.

The absolute maximum ratings are the extreme limits. Crossing them - even for a microsecond - may harm your device. This may be in imediate destroying the device, but it can also be a long time effect or increased leakage currents or similar.

Klaus
 

my doubt is only one max485ic is sufficient for transmitter and reciever
 

Hi,

Because of what?
* Drive strength? --> don't worry
* Half duplex? --> if you need full duplex, then use a full duplex device (same datasheet).

Klaus
 

thanks for your suggestions.My project is involved with 2 max485 ics and 2 8051 ics and dipswitches at transmitter side.MY aim is when I ON a switch connected at P1 of transmitter side,the reciever should recieve and display it on P2(0x01)
when I OFF a switch connected at P1 of transmitter side, the reciever should recieve and display it onP2(0x00).So that i a can understand that my transmitter and reciever are working properly.At the same time the voltages across A and B should vary like:
when switch=1 -----A=+5v,B=0v
switch=0-----A=0v,B=5v please show me a way to make this possible
 

Hi,

your descriptin is not clear to me...

--> a schematic or even a simple draft tells more than a lot of words.

How many wires are between the two devices? And what are their functions?
Are the two devices master and slave or do they have equal rights?
Where are the DIP siwtches connected to?

Read about bus arbitration and bus collision detect.

Klaus
 

Hi,

your descriptin is not clear to me...

--> a schematic or even a simple draft tells more than a lot of words.

How many wires are between the two devices? And what are their functions?
Are the two devices master and slave or do they have equal rights?
Where are the DIP siwtches connected to?

Read about bus arbitration and bus collision detect.

Klaus

these are my connections
 

Attachments

  • MAX.pdf
    104.7 KB · Views: 106

The circuit which I'm using for RS485 communication is attached here. I'm using SP485 IC for Rs485 communication & I tested it upto 3.5KV signal surge & its working fine. MAX 485 also good. You can find lot of RS485 transceiver in market. SN75175 is very low cost & get damaged with EMI surge area. If you are using it in a high surge area, you must to have TVS protection diodes.
 

Attachments

  • RS485.JPG
    RS485.JPG
    66.4 KB · Views: 1,141

Sorry for disturbing you.If i ONswitch in transmitter------A and B voltages must be +5v and 0v at the output of transmitter.
These A and B of transmitter are fed to A and B of reciever--------------output of should be +5v.

If i OFF switch in transmitter----A and B voltages must be 0v and+5v at the output of transmitter.
These A and B of transmitter are fed to A and B of reciever--------------output of should be 0v.

here transmitter is master and reciever is slave. MY code for transmitter and reciever are

#include <REGX51.H>


void main()
{
char sig; // signal to be transmitted.

TMOD=0x20; // selecting Timer 1, with mode 8bit auto reload.
TH1=0xFD; // setting baud rate = 9600
SCON=0x50; // setting the 8bit Control reg which control the SBUF with RC5
TR1=1; // starting the timer
P1=0x00;
while(1) // this point onwards the code is sending 0x55 all the time
{
sig=P1;
if((sig==0x00)||(sig==0x01))
{
SBUF=sig;
while(TI==0);
TI=0;
}
}
}
reciever
#include <AT89X51.H>
#define d P2

void main()
{
char rxdata; // this variable recieves data

/*TMOD=0x20; // selecting Timer 1, with mode 8bit auto reload.
TH1=0xFD; // setting baud rate = 9600
SCON=0x50;
TR1=1;*/
/*while(1)
{
while(RI==0); // this line will wait for the data to come
rxdata=SBUF; // as soon as the data is recieved its tranferred to a variable so that the next variable doesnt overwrite the data just receieved
RI=0; // clearing the flag.

if(rxdata==0x00)
d=0x00;
else if(rxdata==0x01)
d=0x01;
}}

I executed this code and variation is seen on RO of slave side(reciever) that is
when i transmit 0x00--the output of RO on reciever is 0.68v
when i transmit 0x01--the output of RO on reciever is 1.10v(this have to be +5v but showing 1.10 on multimeter)IF there are any mistakes in my code please suggest me
 

these are my connections

Since you have fixed voltages on the DE and RE pins, you can only transfer data in one direction, from the left 8051 to the right one.
The VCC pin on the MAX485's should be connected to the supply voltage on the corresponding 8051. You should not use a separate supply for both MAX485's as in your figure.
Both units should have a common ground, but the 5V supplies for both sides can be separate.

A complete RS485 connection consists of "A", "B" and ground. If ground is not in the same cable, the units should have a common ground arrangement in some other way.
The communication will often work if the grounds are free-floating relative to each other, but that is a very bad practice.

In your configuration, the 8051 software needs no knowledge of RS485. It will work as if you connected the "tx" pin on the left 8051 directly to the "rx" pin on the right 8051.

If you measure the voltage with a multimeter, you will see an average voltage. 0.68V and 1.10V can be correct when you transmit 0x00 and 0x01. You should use an oscilloscope instead for debugging.
 

Hi,

switching ON and OFF sounds liken enable/disable soemthing. Please use the terms High and LOW or 0 and 1

So. your direction is from left to right.
Tx = DI = 1 --> RO = Rx = 1

****
some issues with your draft:
* A and B wires need to be twisted pair with wave impedance of about 120 Ohms. And they need to be properly terminated.
* Generally: Don´t leave inputs floating: On the left side RE is high, so RO is high impedance, Rx is floating. Always. Use a pullup here.
* With RE connected to VCC you can never receive data on the left side.
* There is no need to wire VCC from left side to right side. But it is not wrong, also.

Klaus
 

Thanks for your response.What you said is correct and i am not able to understand "There is no need to wire VCC from left side to right side.But it is wrong also".What does this mean? Whether i have change my hardware connections to achieve

Tx = DI = 1 --> RO = Rx = 1
Tx = DI = 0 --> RO = Rx = 0.
 

Hi,

when i transmit 0x00--the output of RO on reciever is 0.68v
when i transmit 0x01--the output of RO on reciever is 1.10v
RO = low should be close to 0V. I expect less than 0.3V
RO = high should be higher then 2V. I exoect more than 3.5V.

But it is wrong also".What does this mean?
I wrote " But it is not wrong also."
--> You don't need to change VCC connection in your hardware.

*****
For testing only:
Disconnect RO from the microcontroller (on the right side) and measure the voltage levels again.
Additionally measure VCC on the right side.

If you are not satisfied with the RS485 communication:
* left side: drive Tx with "1"
* measure: A, B, DI, VCC on the left side
* measure: A, B, RO, VCC on the right side

* left side: drive Tx with "0"
* measure: A, B, DI, VCC on the left side
* measure: A, B, RO, VCC on the right side

***
Do you use the termination? Please update your schematic.

Klaus
 

I executed this code and variation is seen on RO of slave side(reciever) that is
when i transmit 0x00--the output of RO on reciever is 0.68v
when i transmit 0x01--the output of RO on reciever is 1.10v(this have to be +5v but showing 1.10 on multimeter)IF there are any mistakes in my code please suggest me

RO = low should be close to 0V. I expect less than 0.3V
RO = high should be higher then 2V. I exoect more than 3.5V.

I think the voltages were measured when the software was running, so 0x00 and 0x01 are the bytes that are sent repeatedly.
With 0x00 the line is only high during the stop bit and in the idle time between bytes. With no idle time and 8 data bits, the voltage measured with a multimeter should be about 1/10 of VCC.
With 0x01 one additional bit is high, so without idle time the voltage should be about 1/5 of VCC.
 

can you help me with another code and schematic using max485 which level converters ttl-max485 and max485-ttl

- - - Updated - - -

if any variation in inputs of dip switches will be there any variation on output of max485(AandB outputs)?

- - - Updated - - -

how to check whether transmitter and reciever are working properly using leds
 

Attachments

  • MAX1.pdf
    108.5 KB · Views: 139

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top