CMB27 / ModbusRTUSlave

This is an Arduino library that implements the slave/server logic of the Modbus RTU protocol.
MIT License
58 stars 14 forks source link

Driver control #7

Closed Fluxanode closed 1 year ago

Fluxanode commented 1 year ago

What pins are used for transmit enable and receive enable?
Also what are the UNO pins for TX RX?

CMB27 commented 1 year ago

On a half duplex RS-485 transceiver, the transmitter/driver is enabled when its enable pin is high. The receiver is enabled when its enable pin is low. This library is always either transmitting or receiving, so these pins on the transceiver can be connected together. The pin on the Arduino used to control them is specified by you in the library constructor: [ModbusRTUSlave()](https://github.com/CMB27/ModbusRTUSlave/wiki/ModbusRTUSlave()).

On the Arduino UNO, if you are using HardwareSerial, RX is pin 0, and TX is pin 1, as can be found on the Arduino UNO pinout sheet. If you are using SoftwareSerial, you specify the pins you want to use in its constructor: SoftwareSerial().

Fluxanode commented 1 year ago

Can the serial port be changed? Can I use Serial1 or other on a teensy board with multiple serial ports? Is that changeable?

CMB27 commented 1 year ago

Yes, any Stream object can be used. I am not familiar with the Teensy, but it is likely that its Serial1 is a Stream object and can be used.

In future, please use the Discussion tab for this type of question. The Issues tab is primarily for bug reporting. Also please read over the pages in the wiki tab, there is a lot of detail in there on how to use this library.