Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
modbus [2011/11/07 16:39]
jap
modbus [2011/11/07 16:41]
jap
Line 41: Line 41:
 Source code of mbtest.c: Source code of mbtest.c:
  
-<code>+<file>
 #include <​stdio.h>​ #include <​stdio.h>​
 #include <​modbus.h>​ #include <​modbus.h>​
Line 57: Line 57:
 { {
   modbus_t *ctx;   modbus_t *ctx;
-  uint16_t tab_reg[32];+  uint16_t tab_reg[MB_REG_BASE+MB_REG_COUNT];
   int n, i;   int n, i;
   int errno = 0;   int errno = 0;
Line 78: Line 78:
     return -1;     return -1;
   }   }
-  /* +
-  if ( modbus_rtu_set_serial_mode(ctx,​ MODBUS_RTU_RS485) ) +
-    { +
-      fprintf(stderr,​ +
-       "​Failed to set modbus mode\n"​);​ +
-      errno = -1; +
-      //      goto fail; +
-    } +
-  */+
   if ( modbus_set_slave(ctx,​ MB_SLAVE_ADDRESS) )   if ( modbus_set_slave(ctx,​ MB_SLAVE_ADDRESS) )
     {     {
Line 127: Line 119:
   return errno;   return errno;
 } }
-</code>+</file>
  
modbus.txt · Last modified: 2011/11/07 16:41 by jap
Recent changes RSS feed CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki