Modbus C or assembler source code for microcontroller


Thread Starter

Marcos Torres

I am working actually with protocol modbus and microcontroller AT89c52. I would like to communicate this microcontroller through protocol modbus but I need to create the protocol with language c or assembler. I would appreciate if someboby send me it. thanks.

Marcos Enrique
I assume you have looked at the best general location,

Also, if you do not absolutly require C then have you looked at the BASIC cross compiler for the ATMEL 8952, BASCOM BASIC. You can locate that here

They have a MODBUS library that works with the BASIC cross compiler. There may be more available for the AVR than the 8052 series chips.

I'm also working in a communication between one microprocesseur and one automate by modbus rtu protocol. I have been developping software in C but on CCS interface. I can receive and transmit trame. For the moment I'm looking for some piece of information about function treated in Modbus protocole but I can't find it.
My software run without problem but I need to add this part to decode the function send and principally about the different counter.

In other and, I try it with a system to command and I can transmit without problem an adress card, a function wich isn't decode for the moment, until 252 data byte, and calculate the crc code.

If you are interrested please notify me in my email and I will send you the soft If you can help me about the function.

PS my email: [email protected]

Vu Hong Quan


As my understand, MODBUS protocol use 64kB address space, with microprocessor it's problem. I don't know how to map address space.

I usual development my aplication base on OMRON host link protocol with MP 89Cxx serial, it is work well.

Could any body exchange with me some experiences about development standard protocol in MP 89Cxx, please feel free contact me via my email.


Vu Hong Quan
email : [email protected]
I am working on ABB PLC I want to get the values stored in PLCs Holding registers. Can Someone tell me how to give 3.5 Character times in the start of the frame and end of the frame? Even I dont understand how to trigger my frame to the PLC. Please help me out of this problem.

Marcelo Calcia

Hello Marcos... Now I´m trying to communicate a PIC microcontroller with a speed variator ATV28 Telemecanique. I have read some archives about that, but now I have to make the routines for the MODBUS protocol and the CRC cyclical redundancy checking. I appreciate if you can help me with this job. Besides I can give you the information obtained in the future.


Mohammad Arshad


This is arshad. Marcos u simply need to follow the format of modbus. This format u can freely download from net. I have implemented it using assembly language, i will send it u.

i am a new graduated engineer and i am workin on assembly language implementation of modbus too..

may i take a look at your source code?
could you send it to me?

my address is:
[email protected]
Dear sir,

Can U guide me how I can make a device having modbus rtu communication using 8051 microcontroller programming language? Plz write me your ans. Any good site or documents are invited.

Ankit Rana
hi, i am engg. student i am working on usb based project. i want some refrence for transferring data between two microcontrollers i.e. in bteween tusb3200 & AT89C51. plz send req. information at [email protected]
Hi Arshad. Most of the implementations of Modbus are quite large. My application demands a very simple data transfer from a Siemens PLC with Modbus interface to an external display displaying a 16-bit variable. How large do you think the code should be. Can you please send your source code so that I can see how it can be done?

thanks / rgds


my final project is about MODBUS protocol to using a microcontroller,
would you send that assembly language source code to me....
my e-mail: [email protected]

best regards,
Anda Asgara

I am working on modbus protocol using TI 2812. Can anyone send me some sample codes in C? Thanks.
lp_zheng @