I am new to modbus and I have to program a lpcxpresso baseboard as a master to collect readings from a powermeter using RS485 Modbus protocol.
I am familiar with the protocol (about the PDU ADU frame, function codes, master-slave) through reading of specifications from modbus.org. However I have difficulties in the implementation when writing the code in C.
So my questions are:
- Do I have to open connection, set the baud rate, etc when I am starting the connection?
- I am thinking to send the frame as byte. Is this correct? or are there any other ways to do it?
- Does the data send have to be in hexadecimal, or binary or integer?
- CRC generation and checking.
I will really appreciate all kind of help and assistance :) Sorry if the questions are not very specific or too basic