Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example sketch for half-duplex RS485 #66

Merged
merged 2 commits into from Sep 11, 2016
Merged

Conversation

@kintel
Copy link
Contributor

@kintel kintel commented Sep 11, 2016

Follow-up to #44.

Note: This has not yet been tested on actual hardware, but feel free to review code in the meantime.

TODO:

  • Style fixes
  • Test on actual hardware
RS485_HalfDuplex.pde - example using ModbusMaster library
This example is tested against an EPSolar LS2024B solar charge controller.
See here for protocol specs: http://www.solar-elektro.cz/data/dokumenty/1733_modbus_protocol.pdf

This comment has been minimized.

@4-20ma

4-20ma Sep 11, 2016
Owner

style: wrap @ 78 (ref. AV Rule 41)


// Modbus slave ID 1
node.begin(1, Serial);
// Hook up callbacks allowing us to configure the RS485 transceiver correctly

This comment has been minimized.

@4-20ma

4-20ma Sep 11, 2016
Owner

style: wrap @ 78 (ref. AV Rule 41) or shorten the comment

Serial.print("Vload: ");
Serial.println(node.getResponseBuffer(0xC0)/100.0f);
Serial.print("Pload: ");
Serial.println((node.getResponseBuffer(0x0D) + node.getResponseBuffer(0x0E) << 16)/100.0f);

This comment has been minimized.

@4-20ma

4-20ma Sep 11, 2016
Owner

style: wrap @ 78 (ref. AV Rule 41)


// Read 16 registers starting at 0x3100)
result = node.readInputRegisters(0x3100, 16);
if (result == node.ku8MBSuccess) {

This comment has been minimized.

@4-20ma

4-20ma Sep 11, 2016
Owner

style: brace alignment (ref. AV Rule 60)

@4-20ma
Copy link
Owner

@4-20ma 4-20ma commented Sep 11, 2016

@kintel thanks for the half-duplex example. Looks pretty good. I've annotated a few lines with minor style issues (line length, brace position). Ready to merge after updates.

@4-20ma 4-20ma merged commit f032345 into 4-20ma:master Sep 11, 2016
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@4-20ma
Copy link
Owner

@4-20ma 4-20ma commented Sep 11, 2016

LGTM. I'm going to merge this so I can finish adjusting license text. Open a separate issue/PR if the hardware test reveals a bug.

@4-20ma 4-20ma changed the title Added half duplex RS485 example Add example sketch for half-duplex RS485 Sep 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.