×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Weird reply from Modbus energy meter controlled by mbed microcontroller

Weird reply from Modbus energy meter controlled by mbed microcontroller

Weird reply from Modbus energy meter controlled by mbed microcontroller

(OP)
I'm using an mbed micro-controller to retrieve register from Integra 1630 energy meter with modbus via a SIPEX SP485CS chip (RS485 level shiftier).
All the component and connection are working correctly.(Double checked) Using the same program with different reigster, i'm able to get good modbus reply from other type of energy meter with modbus.
I always a register of 0x00 instead of good modbus reply. Why am i always getting 0x00???

CODE --> programming

#include "mbed.h" 

Serial RS485(p28,p27);
DigitalOut ho(p26);

int regvalue[9];
int main()
{
    ho = 0;
    while(1) {
        RS485.baud(9600);
        printf("Starting\n");
        ho = 1;
        RS485.putc(0x01);   // slave add
        RS485.putc(0x04);   // function code
        RS485.putc(0x00);   // Hi PDUadd
        RS485.putc(0x48);   // low PDU add
        RS485.putc(0x00);   // Hi N reg 
        RS485.putc(0x02);   // Lo N reg
        RS485.putc(0xf1);   // Hi CRC
        RS485.putc(0xdd);   // Lo CRC
        wait_ms(200);          // Silent interval
        printf("Getting data\n");
        ho = 0;
        for (int count = 0; count < 8; count++) {
            regvalue[count] = RS485.getc(); // Retrieve received register from modbus
            printf("%X - ", regvalue[count]);
        }
        wait_ms(1000);
    }
} 

RE: Weird reply from Modbus energy meter controlled by mbed microcontroller

Now that your problem has been resolved, please Red Flag your post above and ask that it be removed.

One question per issue will be sufficient in future. Thanks.

Mike Halloran
Pembroke Pines, FL, USA

RE: Weird reply from Modbus energy meter controlled by mbed microcontroller

(OP)
The Modbus of the energy meter is not responding as expected even thought the terminal resistor was connected. This is a new problem. I was using ModScan32 as a master device previously. For this post, i'm using an mbed microcontroller as a master device.

RE: Weird reply from Modbus energy meter controlled by mbed microcontroller

You did store scope traces from the HMI that worked, right?
I'd compare them with the same traces for your micro.
Just to verify that the transceivers are equivalent, and the low level code is tickling something, to get started.

Mike Halloran
Pembroke Pines, FL, USA

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources