Modbus protocol

28 Sep 2011

Hi,

I have a problem with modbus implementation.

On my last topic, Peter Ampt gave me this link http://mbed.org/users/cam/programs/Modbus/5zdqv

The program works fine. But I have a problem when I execute other function.

In main.cpp, in the for loop , if I call on other function, the modbus protocol doesn't work.

00053     for( ;; )
00054     {
00055         ( void )eMBPoll(  );
00056                 
00057         /* Here we simply count the number of poll cycles. */
00058         usRegInputBuf[0]++;
00059     }

If someone have an idea, help will be appreciate.

Thank you. ;)

28 Sep 2011

Hi Samo,

Do you mean that if you put another function in the forever loop with the (void)eMBPoll() function then it stops working? If so then perhaps the new function is causing the problem. I suggest that you try something simple instead like toggling an LED every time the loop executes and build up from there.

Peter

16 Jun 2015

Hi,

I have the same problem that Samo said. MODBUS works fine, but when a function is added in the loop, communication doesn't work anymore. I was looking for the problem and I think it is time of processing another functions, when I put LED toggle with small time, MODBUS works sometimes and sometimes not.