0
\$\begingroup\$

I am trying to read values from a meter (WDM303FDWA1) through an ATmega32. The communication to the meter has to be done with the RS-485 Modbus protocol.

I would like to know what IC I have to use to connect the ATmega32 and meter, and sample codes for the Modbus RS-485 protocol.

I am trying to communicate over only one meter and its Server ID is 1, Baud rate could be anything (default is 9600).

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

The WDM303FDWA1 uses RS485 as the line interface connection and this means you need to interface the Atmega to an RS485 chip such as a MAX485. Here is a link to Maxim's offerings on that device and here's the chip: -

enter image description here

  • RO is received data out from the 485 and connects to your Atmega
  • RE (bar) is read enable driven from your Atmega - it defines data direction along with DE
  • DE - tie this to RE (above) and you have one pin that controls direction of data on the 485 line.
  • DI - this connects to the data output line designated for your Atmega.
  • A & B are the 485 line connections

If you look on page 8 of this document it details all the codes you need to send to talk to the device. It appears that you must send the "password" first followed by a function code, then the specific address of the data you want to read. The pdf file has that data.

As for the format of what comes back I can't help you with that - the document doesn't go into too much detail on this but, it does appear to be between 1 word and 3 words.

Neither can I help you with samples of modbus codes for use in the Atmega.

\$\endgroup\$
1
  • \$\begingroup\$ The samples would all just be normal UART usage anyways. There's plenty of examples of that already. \$\endgroup\$ Commented Jan 11, 2014 at 9:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.