MODBUS RTU code for STM32F103 through Keil uVision 4

S

Thread Starter

Saurabh

Hi All,

I am working on ARM's (STM32F103VB MCU) implementation with MODBUS RTU enabled energy metre though MODBUS protocol.

In my PCB there is ADM485 half duplex IC and I am working in Keil uVision IDE in C language.

In my project, I have to read the holding registers/input registers and preset mulple registers of energy metres for various parameters at
Baud Rate:9600
Start Bit: 1 Bit
Parity: No
Stop Bit: 1 Bit


I have figured out that first I have to make My microcontroller in master mode by changing the ADM485 IC in sending mode first.
Then I have to send the command byte wise.
Then I have to change the ADM485 IC in receiving mode.
The response will come in hex through USART handler.
But I am unable to figure out how to implement this i.e a proper path which I should follow..


Could anybody please guide me or can send me some code to start with?? It would be surely helpful..

Thanks in advance...
 
Top