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???
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
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
RE: Weird reply from Modbus energy meter controlled by mbed microcontroller
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