Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,7 @@ void setup() {

// Initialize the RS-485 interface with a baud rate of 115200 and specific timings,
// the timings define the preamble and postamble durations for RS-485 communication
MachineControl_RS485Comm.begin(115200, 0, 500);
MachineControl_RS485Comm.begin(115200, SERIAL_8N1, 0, 500);

// Set the RS-485 interface in receive mode initially
MachineControl_RS485Comm.receive();
Expand Down Expand Up @@ -1170,7 +1170,7 @@ In this example sketch, a message is periodically sent over the RS-485 interface

The example sketch uses the following functions from the `Arduino_PortentaMachineControl` library for RS-485 communication. Here is an explanation of the functions:

- `MachineControl_RS485Comm.begin(baud, pre, post)`: Initializes the RS-485 module with specified baud rate and timing settings.
- `MachineControl_RS485Comm.begin(baud, config, pre, post)`: Initializes the RS-485 module with specified baud rate, serial_config and timing settings.
- `MachineControl_RS485Comm.receive()`: Puts the module in receive mode.
- `MachineControl_RS485Comm.noReceive()`: Disables receive mode for transmission.
- `MachineControl_RS485Comm.beginTransmission()`: Prepares the module to start transmitting data.
Expand Down Expand Up @@ -1216,7 +1216,7 @@ void setup() {

// Initialize the RS-485 interface with specific settings,
// specify baud rate, preamble and postamble times for RS-485 communication
MachineControl_RS485Comm.begin(115200, 0, 500);
MachineControl_RS485Comm.begin(115200, SERIAL_8N1, 0, 500);

// Enable full duplex mode and 120 Ohm termination resistors
MachineControl_RS485Comm.setFullDuplex(true);
Expand Down Expand Up @@ -1311,7 +1311,7 @@ void setup() {
// Wait for serial port to connect (necessary for boards with native USB)
//while (!Serial);
// Initialize RS-485 communication with specified baud rate and delays
MachineControl_RS485Comm.begin(baudrate, preDelay, postDelay);
MachineControl_RS485Comm.begin(baudrate, SERIAL_8N1, preDelay, postDelay);

MachineControl_RS485Comm.setFullDuplex(true);

Expand Down Expand Up @@ -1398,7 +1398,7 @@ void setup() {
Serial.println("- Modbus RTU Server");

// Set RS485 transmission delays as per Modbus specification
MachineControl_RS485Comm.begin(baudrate, preDelay, postDelay);
MachineControl_RS485Comm.begin(baudrate, SERIAL_8N1, preDelay, postDelay);

// Enable full duplex mode and 120 Ohm termination resistors
MachineControl_RS485Comm.setFullDuplex(true);
Expand Down Expand Up @@ -1637,7 +1637,7 @@ void setup() {
Serial.begin(9600);

// Initialize RS-485 communication with specified baud rate and delays
MachineControl_RS485Comm.begin(baudrate, preDelay, postDelay);
MachineControl_RS485Comm.begin(baudrate, SERIAL_8N1, preDelay, postDelay);

// Short delay to ensure RS-485 communication is stable
delay(2500);
Expand Down