Arduino Forum

Using Arduino => Programming Questions => Topic started by: control123 on Jun 10, 2011, 07:24 am

Title: Some mini problems with code (modbus).
Post by: control123 on Jun 10, 2011, 07:24 am

I have some problems with my code, here it is:

#include <AFMotor.h>
#include <ModbusSlave.h> 
AF_Stepper motor(48, 2);

void setup() {
  init_mb_slave(9600, 'n', 0); 

void loop() {
   start_mb_slave(MB_SLAVE, regs, MB_REGS);
      motor.step(regs[MB_REG0], FORWARD, SINGLE);

I use modbus rtu protocol and controll stepper motor. When i write to MB_REG = 1 then my modbus communication writes "Time out" "Time out" and doing steps what i wrote in to MB_REG0 addresses. :) so where can be a problem that modbus communication timed outs?

Thanks for all :)