NANO with MAX485 get Voltage problem

Hi everyone,
This is my first post on a Arduino Forum,I have a problem.
I want to use nano and max485 read FY-700 Digital Temperature Controller
PV & SV

connections are:

DI to nano Tx
RO to nano Rx
DE to digital pins to nano D3
RE to digital pins to nano D2
A goes to pin (DX +) of the FY700
B goes to pin (DX-) of FY700

FY700 DIGITAL PID CONTROLLER
https://www.fa-taie.com.tw/admin/download_en/file/2015-02-04/54d1b66ec08a5.pdf

rs485-8.ino (1.5 KB)



輸入或貼上代碼
// ModbusMaster
#include <ModbusMaster.h>
#include<SoftwareSerial.h>
// RS485
#define MAX485_DE 3
#define MAX485_RE_NEG 2

// instantiate ModbusMaster object
ModbusMaster node;

SoftwareSerial Serial2(4, 5);//(Rx,Tx)
// RS485
void preTransmission()
{
  digitalWrite(MAX485_RE_NEG, 1);
  digitalWrite(MAX485_DE, 1);
}

// RS485
void postTransmission()
{
  digitalWrite(MAX485_RE_NEG, 0);
  digitalWrite(MAX485_DE, 0);
}

unsigned char cmd[8] = {0x01 ,0x03 ,0x00 ,0x01 ,0x00 ,0x01, 0xD5 ,0xCA} ;  // 
uint16_t au16data[16] = {};                                                                               
void setup()
{
    Serial.begin(9600) ;                                                        //Arduino baud-rate 
    Serial2.begin(9600) ;                                                      //Modbus RTU baud-rate 
    Serial.println("RS485 Test Start …..") ;                           
} 
void loop()
{
    for(int i = 0 ; i <8; i++)
        {
          Serial2.write(cmd[i]) ;                                               
        }
          Serial.println("——Detection start——") ;                
             if (Serial2.available() >0)
             {
                    for(int j = 0 ; j <21; j++)
                    while (Serial2.available() >0)
                {
                  au16data[j] = Serial2.read();
                  Serial.println(au16data[j],HEX) ;
                }
          }
          delay(1000);                                                              
}

You can save a pin in most applications by tying RE & DE together…
If you notice they are opposite polarity, so when the pair is high or low, the chip is ether transmitting OR receiving.

you don't call pre/postTransmission() so i doubt the transmitter gets enabled.

the other thing is you need to wait for transmission to complete before disabling the transmitter. presumably there is a flush() that can be called which won't return until transmission is complete

and post your code using </>

How do the ground pins connect or do they?

there's no need for a ground, just the pair of wires

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.