Giter Club home page Giter Club logo

Comments (12)

4-20ma avatar 4-20ma commented on August 16, 2024
  1. OK
  2. OK
  3. This looks correct; you'll initialize the Serial port using the standard Arduino syntax specifying baud rate, size, parity, and stop bit(s). Device is address #1 on the RS485 network.
  4. Modbus holding registers are 16-bit. Page 57 of the manual referenced in #2 above indicates "In the transfer of individual data values, it treats two registers as an object with the starting address (e.g., 3900) considered as the object name." Your code looks correct to read 2 consecutive registers starting at 3913 for the current average. You'll need to assemble these unsigned 16-bit values into an unsigned 32-bit value and convert to float. This spreadsheet appears to do what you desire.

from modbusmaster.

vindhyachaltakniki avatar vindhyachaltakniki commented on August 16, 2024
  1. I have interfaced EM-6433 using arduino over Rs485. Rs485 IC used is SN75HVD08.
  2. EM-6433 settings are slave id:1 & baud:19200, even parity & 1 stop
    Confirmed it aftr turing on meter & go to its settings table.
  3. Case 1: If I permanently pull down N_RE pin & pull up DE pin of SN75HVD08, then when I used the attached code I always receive 0xE2 in return from device ie ku8MBResponseTimedOut. In code ignore the code which ouput high & low the RE & DE pin. This is used in case 2. In this case, this is commented out.
  4. Case2: Since this SN75HVD08 is half duplex so I connected RE & DE pins to arduino as in attached circuit. Also I have modified ModbusMaster.cpp file in line 728 & 729, where I added code to disable Tx & enable rx from IC. When I use this code I receive error 0x02 in result, which is ku8MBIllegalDataAddress.
    What am I doing wrong here. I also interchanged A & B pins to slave device EM-6433 + & -. But no correct result obtained.

5.All ckt diagram and code is here: https://drive.google.com/open?id=0B-jbeBk3wfkWaWo1ek5ISUxoTzA

from modbusmaster.

4-20ma avatar 4-20ma commented on August 16, 2024

I don't see anything obvious, but I'm not familiar with your device. Here's how I would proceed: start with as small a working example as possible and build upon that.

  1. Get one of the examples working with your device. Remove any extraneous code and start from as basic a setup as possible. This ensures your baud rate, parity, stop are correctly applied.
  2. Build upon the example by adding layers of complexity (LCD display, etc).

Do you use a logic analyzer such as a Saleae Logic or similar unit? This will help you decode the signal to ensure it's being sent/received correctly. Note that I don't have any relationship with Saleae, other than as a satisfied customer.

from modbusmaster.

vindhyachaltakniki avatar vindhyachaltakniki commented on August 16, 2024

Hi

  1. SN75HVD08 has Rx & Tx enable pins. I have shorted them, & in the code I keep this pin high, which means keep on transmitting any data.
    In the code snippet below I added a line which brings pins low. This means now receive. Below is code which i have edited in your library:

if (_postTransmission)
{
_postTransmission();
}

digitalWrite(2, LOW);

// loop until we run out of time or bytes, or an error occurs
u32StartTime = millis();
while (u8BytesLeft && !u8MBStatus)
{
if (_serial->available())
{
#if MODBUSMASTER_DEBUG
digitalWrite(MODBUSMASTER_DEBUG_PIN_A, true);
#endif
u8ModbusADU[u8ModbusADUSize++] = _serial->read();
u8BytesLeft--;
#if MODBUSMASTER_DEBUG
digitalWrite(MODBUSMASTER_DEBUG_PIN_A, false);
#endif
}

  1. As soon as receive is done again bring the pin to high, this way I am able to get correct data.
    Is it ok?

  2. Second, I am reading mutliple slave devices in a line. How to send each slave id. Do I have to evrytime initialize like this:

    node.begin(slave_id, Serial1);
    delay(100);
    digitalWrite(r_enable, HIGH); /* rx enable /
    result = node.readHoldingRegisters(address - 1U , 2U);
    digitalWrite(r_enable, HIGH); /
    rx enable */

from modbusmaster.

4-20ma avatar 4-20ma commented on August 16, 2024

To read multiple devices, you'll instantiate each one as a separate object:

...
ModbusMaster device1;
ModbusMaster device2;
...
Serial.begin(19200);
device1.begin(1, Serial);
device2.begin(2, Serial);
...

from modbusmaster.

sachinsinghal9 avatar sachinsinghal9 commented on August 16, 2024

Hi VindhyaChaltakniki,

I am also working on the same project, that is to query a EM6400 multifunction meter for different parameters using an arduino module, i wanted to know if you got the results properly. I am using the same library that you are using, however i am using Max485 ic as a RS485 to TTL Converter, and in Max485 it automatically switches between Transmission and Recieve Modes. So you may use that for it if you are still stuck with it, I wanted to know is your slave working with a Software such as MODSCAN as a master?? My EM6400 is responding well with this software but with the arduino , it is giving an exception of timeout, what can be the problem?

from modbusmaster.

emtantra avatar emtantra commented on August 16, 2024

Hello ,
i'm trying to read veritech MFM using this library, but im getting response 0xF2 that timeout . i tried using halfdyplex example still im not finding output. and i wanted to read input registers of MFM.
im using software serial instead of hardware is that the problem ?

here is my code
void loop()
{
static uint32_t i;
uint8_t j, result;
uint16_t data[6];

result = node.readInputRegisters(53, 2);
Serial.println(result);
// do something with data if read is successful
if (result == node.ku8MBSuccess)
{
for (j = 0; j < 6; j++)
{
data[j] = node.getResponseBuffer(j);
}

Serial.print(data[0]);
Serial.print(data[1]);
Serial.print(data[2]);
Serial.println(data[3]);
delay(1000);
}
}

can please explain two parameters of this function - result = node.readInputRegisters(53, 2);
1st parm i understood that its add of reg what about second parm? is that the pointer to store output?

thank you

from modbusmaster.

gau999 avatar gau999 commented on August 16, 2024

Hello sir,
i'm also trying with EM6436 energy meter from Schneider

can you please provide me the code which you have written for em6433

from modbusmaster.

slowpoison4 avatar slowpoison4 commented on August 16, 2024

@sachinsinghal9 Hi! Doing A similar project with EM1200. Were you able to find a solution? CAn you share me the details?

from modbusmaster.

kprakash811 avatar kprakash811 commented on August 16, 2024

@gau999 did u find the solution

from modbusmaster.

sthiruppathi avatar sthiruppathi commented on August 16, 2024

Hello All, did you find the solution?
could you please share the ideas?
by
thiruppathi
[email protected]

from modbusmaster.

sthiruppathi avatar sthiruppathi commented on August 16, 2024

@gau999 @kprakash811 did u find the solution?

from modbusmaster.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.