Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed
Fork of ICE by
Diff: src/ModbusMaster/ModbusMaster.cpp
- Revision:
- 54:ec1b03064bbd
- Parent:
- 49:0456ee2271be
- Child:
- 57:5f18ae91c7c7
--- a/src/ModbusMaster/ModbusMaster.cpp	Tue Sep 13 19:28:04 2016 +0000
+++ b/src/ModbusMaster/ModbusMaster.cpp	Tue Sep 13 21:39:11 2016 +0000
@@ -24,6 +24,13 @@
     logInfo("%s ModbusMaster has started...", __func__);
     bool status;
     MbedJSONValue json_value;
+    
+    modbus_init(MB_BAUD_RATE);
+    osDelay(500);
+    DigitalOut flu_power(PA_11);
+    flu_power = 0; // provide power to the modbus
+    printf("MODBUS INITIALIZED\r\n");
+    
 
     while( true ) {
 
@@ -77,6 +84,11 @@
                         status = ReadModbus_32bit_float( &float_value, iter->second.order );
                         if( status == true ) {
                             ModbusRegisterMap[iter->first].float_value = float_value;
+                            logInfo("Modbus Tag:%s value=%2.2f", iter->first.c_str(), float_value );
+                        }
+                        else
+                        {
+                            logInfo("Modbus Read Failed, tag=%s", iter->first.c_str() );
                         }
                         break;
                     case TYPE_32BIT_INT:
    