Great work, I am using Your Sketch on a Mega for my Home Automation and it works fine, Thank You for that.
But now I wanted to port it to a DUE, because the Mega is running out of Speed.
I have problems compiling Your Sketch on my DUE causing a HardwareSerial error.
Working on a MAC Version 10.11.2, Arduino 1.65 gives this error:
Arduino:` 1.6.5 (Mac OS X), Platine: "Arduino Due (Programming Port)"
ModbusSensor.cpp: In member function 'void modbusMaster::begin(uint16_t, uint8_t)':
ModbusSensor.cpp:205: error: no matching function for call to 'HardwareSerial::begin(uint16_t&, uint8_t&)'
(__hwSerial).begin(baudrate, byteFormat);
^
ModbusSensor.cpp:205:42: note: candidate is:
In file included from /Users/abe/Library/Arduino15/packages/arduino/hardware/sam/1.6.7/cores/arduino/Arduino.h:195:0,
from ModbusSensor.h:16,
from ModbusSensor.cpp:25:
/Users/abe/Library/Arduino15/packages/arduino/hardware/sam/1.6.7/cores/arduino/HardwareSerial.h:29:18: note: virtual void HardwareSerial::begin(long unsigned int)
virtual void begin(unsigned long);
^
/Users/abe/Library/Arduino15/packages/arduino/hardware/sam/1.6.7/cores/arduino/HardwareSerial.h:29:18: note: candidate expects 1 argument, 2 provided
ModbusSensor.cpp: In member function 'boolean modbusMaster::available()':
ModbusSensor.cpp:251: error: 'class HardwareSerial' has no member named 'availableForWrite'
if ((__hwSerial).availableForWrite() == SERIAL_TX_BUFFER_SIZE - 1) { //TX buffer empty
^
ModbusSensor.cpp:251: error: 'SERIAL_TX_BUFFER_SIZE' was not declared in this scope
if ((*_hwSerial).availableForWrite() == SERIAL_TX_BUFFER_SIZE - 1) { //TX buffer empty
^
no matching function for call to 'HardwareSerial::begin(uint16_t&, uint8_t&)'
Then I found this Thread in the Arduino Forum:
http://forum.arduino.cc/index.php?topic=142753.0
I changed "HardwareSerial" to "USARTClass" in Your ModbusSensor.cpp( one time ) and in ModbusSensor.h ( two times ).
But now I get this error:
Arduino: 1.6.5 (Mac OS X), Platine: "Arduino Due (Programming Port)"
ModbusSensor.cpp: In member function 'void modbusMaster::begin(uint16_t, uint8_t)':
ModbusSensor.cpp:205: error: call of overloaded 'begin(uint16_t&, uint8_t&)' is ambiguous
(__hwSerial).begin(baudrate, byteFormat);
^
ModbusSensor.cpp:205:42: note: candidates are:
In file included from /Users/abe/Library/Arduino15/packages/arduino/hardware/sam/1.6.7/variants/arduino_due_x/variant.h:39:0,
from /Users/abe/Library/Arduino15/packages/arduino/hardware/sam/1.6.7/cores/arduino/Arduino.h:201,
from ModbusSensor.h:16,
from ModbusSensor.cpp:25:
/Users/abe/Library/Arduino15/packages/arduino/hardware/sam/1.6.7/cores/arduino/USARTClass.h:111:10: note: void USARTClass::begin(uint32_t, USARTClass::USARTModes)
void begin(const uint32_t dwBaudRate, const USARTModes config);
^
/Users/abe/Library/Arduino15/packages/arduino/hardware/sam/1.6.7/cores/arduino/USARTClass.h:111:10: note: no known conversion for argument 2 from 'uint8_t {aka unsigned char}' to 'USARTClass::USARTModes'
/Users/abe/Library/Arduino15/packages/arduino/hardware/sam/1.6.7/cores/arduino/USARTClass.h:112:10: note: void USARTClass::begin(uint32_t, UARTClass::UARTModes)
void begin(const uint32_t dwBaudRate, const UARTModes config);
^
/Users/abe/Library/Arduino15/packages/arduino/hardware/sam/1.6.7/cores/arduino/USARTClass.h:112:10: note: no known conversion for argument 2 from 'uint8_t {aka unsigned char}' to 'UARTClass::UARTModes'
ModbusSensor.cpp: In member function 'boolean modbusMaster::available()':
ModbusSensor.cpp:251: error: 'SERIAL_TX_BUFFER_SIZE' was not declared in this scope
if ((__hwSerial).availableForWrite() == SERIAL_TX_BUFFER_SIZE - 1) { //TX buffer empty
^
call of overloaded 'begin(uint16_t&, uint8_t&)' is ambiguous
Will You please help me porting Your great work to an Arduino DUE?
Great work, I am using Your Sketch on a Mega for my Home Automation and it works fine, Thank You for that.
But now I wanted to port it to a DUE, because the Mega is running out of Speed.
I have problems compiling Your Sketch on my DUE causing a HardwareSerial error.
Working on a MAC Version 10.11.2, Arduino 1.65 gives this error:
Arduino:` 1.6.5 (Mac OS X), Platine: "Arduino Due (Programming Port)"
ModbusSensor.cpp: In member function 'void modbusMaster::begin(uint16_t, uint8_t)':
ModbusSensor.cpp:205: error: no matching function for call to 'HardwareSerial::begin(uint16_t&, uint8_t&)'
(__hwSerial).begin(baudrate, byteFormat);
^
ModbusSensor.cpp:205:42: note: candidate is:
In file included from /Users/abe/Library/Arduino15/packages/arduino/hardware/sam/1.6.7/cores/arduino/Arduino.h:195:0,
from ModbusSensor.h:16,
from ModbusSensor.cpp:25:
/Users/abe/Library/Arduino15/packages/arduino/hardware/sam/1.6.7/cores/arduino/HardwareSerial.h:29:18: note: virtual void HardwareSerial::begin(long unsigned int)
virtual void begin(unsigned long);
^
/Users/abe/Library/Arduino15/packages/arduino/hardware/sam/1.6.7/cores/arduino/HardwareSerial.h:29:18: note: candidate expects 1 argument, 2 provided
ModbusSensor.cpp: In member function 'boolean modbusMaster::available()':
ModbusSensor.cpp:251: error: 'class HardwareSerial' has no member named 'availableForWrite'
if ((__hwSerial).availableForWrite() == SERIAL_TX_BUFFER_SIZE - 1) { //TX buffer empty
^
ModbusSensor.cpp:251: error: 'SERIAL_TX_BUFFER_SIZE' was not declared in this scope
if ((*_hwSerial).availableForWrite() == SERIAL_TX_BUFFER_SIZE - 1) { //TX buffer empty
^
no matching function for call to 'HardwareSerial::begin(uint16_t&, uint8_t&)'
Then I found this Thread in the Arduino Forum:
http://forum.arduino.cc/index.php?topic=142753.0
I changed "HardwareSerial" to "USARTClass" in Your ModbusSensor.cpp( one time ) and in ModbusSensor.h ( two times ).
But now I get this error:
ModbusSensor.cpp: In member function 'void modbusMaster::begin(uint16_t, uint8_t)':
ModbusSensor.cpp:205: error: call of overloaded 'begin(uint16_t&, uint8_t&)' is ambiguous
(__hwSerial).begin(baudrate, byteFormat);
^
ModbusSensor.cpp:205:42: note: candidates are:
In file included from /Users/abe/Library/Arduino15/packages/arduino/hardware/sam/1.6.7/variants/arduino_due_x/variant.h:39:0,
from /Users/abe/Library/Arduino15/packages/arduino/hardware/sam/1.6.7/cores/arduino/Arduino.h:201,
from ModbusSensor.h:16,
from ModbusSensor.cpp:25:
/Users/abe/Library/Arduino15/packages/arduino/hardware/sam/1.6.7/cores/arduino/USARTClass.h:111:10: note: void USARTClass::begin(uint32_t, USARTClass::USARTModes)
void begin(const uint32_t dwBaudRate, const USARTModes config);
^
/Users/abe/Library/Arduino15/packages/arduino/hardware/sam/1.6.7/cores/arduino/USARTClass.h:111:10: note: no known conversion for argument 2 from 'uint8_t {aka unsigned char}' to 'USARTClass::USARTModes'
/Users/abe/Library/Arduino15/packages/arduino/hardware/sam/1.6.7/cores/arduino/USARTClass.h:112:10: note: void USARTClass::begin(uint32_t, UARTClass::UARTModes)
void begin(const uint32_t dwBaudRate, const UARTModes config);
^
/Users/abe/Library/Arduino15/packages/arduino/hardware/sam/1.6.7/cores/arduino/USARTClass.h:112:10: note: no known conversion for argument 2 from 'uint8_t {aka unsigned char}' to 'UARTClass::UARTModes'
ModbusSensor.cpp: In member function 'boolean modbusMaster::available()':
ModbusSensor.cpp:251: error: 'SERIAL_TX_BUFFER_SIZE' was not declared in this scope
if ((__hwSerial).availableForWrite() == SERIAL_TX_BUFFER_SIZE - 1) { //TX buffer empty
^
call of overloaded 'begin(uint16_t&, uint8_t&)' is ambiguous
Will You please help me porting Your great work to an Arduino DUE?