I am a bit confused regarding the ArduinoModbus.h library. This library is indicated as a library dependent on the Arduino485.h library.. Which after reading the description, says it is for RS-485 shields like the MKR485.
Now I have never used these shields... is it fine that I want to use the ArduinoModbus with RS232 (using I suppose, what is technically a shield, but really is a PCB that I designed, that the Arduino is simply mounted to. RS232 Transceiver chip = MAX3232MDBREP)?
So am I able to use this? Why would it be specified for RS485 when that just indicates a physical hardware defined protocol? Why would it be dependent on RS-485 when Modbus RTU utilizes RS-232 as well?
Appreciate the help.
My goal is to communicate with an industrial VFD (P/N: GS2-11P0 by Automation Direct) to set output frequency over modbus RTU
That wasn't the question, the device I am talking to (the industrial VFD) can be configured for either RS485 or RS232. I have it configured for RS-232. I am wondering if the library is capable of doing Modbus RTU communications using RS-232, when the library supposedly is dependent on the Arduino485.h library.
And yes, they aren't the same but RS-232 or RS-485 is a physical characteristic which is defined by the hardware, the software shouldn't care (unless that is a characteristic with this library depending on a shield being used which would seem odd to me.). The device I am communicating with can be configured for RS-232, and I am using a RS-232 transceiver. Now lets continue with the original question please.
Ah, ok. Well, as long as there are just the 2 devices, then you should be ok. The RS485 libraries usually want to control the RE & DE signals to switch the direction of the RS485 line driver. That's not relevant on an RS232 link. The RS485 library may insist on knowing what pins RE & DE are connected to. You could tell the library to use a couple of unused pins.
The libraries will use either a hardware UART or a software implementation of a UART. Either way there will be 1 pin for Tx data and 1 pin for Rx data, which you can connect to your MAX232 chip.
That's a great point, I did notice that, the RE & DE pin definitions in this library and I think you're
correct on that. Perhaps just assign the unused pins as you suggest, have it set those pins to make the software happy, as it could be some starting condition to enabling the rest of the code to operate. Ill check that out - attempting a go at the ModbusMaster library was well currently.