Modbus
Moderator: Benj
-
- Posts: 94
- Joined: Wed Jan 16, 2013 11:37 am
- Has thanked: 56 times
- Been thanked: 16 times
- Contact:
Re: Modbus
Good afternoon Benj and the others guys.
I would like to know how is the progress of the creation of block Modbus RTU master and slave.
Benj, I also I have a Modbus RTU slave devices if you need to do some test run, I can lend it to you if needed.
A greeting and thanks
I would like to know how is the progress of the creation of block Modbus RTU master and slave.
Benj, I also I have a Modbus RTU slave devices if you need to do some test run, I can lend it to you if needed.
A greeting and thanks
-
- Posts: 31
- Joined: Wed May 02, 2012 5:49 pm
- Has thanked: 3 times
- Been thanked: 7 times
- Contact:
Re: Modbus
Hello
Here is code for working MODBUS slave. This program works well with industrial touchpanel and MODBUS RTU protocol. Touchpanel is sending commands as Master and PIC answer as a slave. The Command 16(write multiple int) is not so finished yet (because i haveny needed that so far.) The MODBUS part starts on MAIN routine after RS232 receives string (MODBUS commands)
I hope this helps:)
Modbus slave address = 1
Coils are stored on array COIL[] unfortunately Coils must be set to byte datatype to have data array.
and integer are stored on byte array Databyte[] where high byte of integer is Databyte[n] and low byte Databyte[n+1]
Here is code for working MODBUS slave. This program works well with industrial touchpanel and MODBUS RTU protocol. Touchpanel is sending commands as Master and PIC answer as a slave. The Command 16(write multiple int) is not so finished yet (because i haveny needed that so far.) The MODBUS part starts on MAIN routine after RS232 receives string (MODBUS commands)
I hope this helps:)
Modbus slave address = 1
Coils are stored on array COIL[] unfortunately Coils must be set to byte datatype to have data array.
and integer are stored on byte array Databyte[] where high byte of integer is Databyte[n] and low byte Databyte[n+1]
- Attachments
-
- Working Modbus slave.fcf
- (123.2 KiB) Downloaded 921 times
Re: Modbus
May i know how about the write function so that we able to change the slave address? How do i search a reference on how to program a modbus tcp server&client or modbus rtu master&client ?
- Steve001
- Valued Contributor
- Posts: 1189
- Joined: Wed Dec 31, 2008 3:37 pm
- Has thanked: 460 times
- Been thanked: 523 times
- Contact:
Re: Modbus
Afternoon guys,
is there any news on a V6 Modbus slave component ?
regards
Steve
Edit
sorry forgot about the post above
is there any news on a V6 Modbus slave component ?
regards
Steve
Edit
sorry forgot about the post above
Success always occurs in private and failure in full view.
- Steve001
- Valued Contributor
- Posts: 1189
- Joined: Wed Dec 31, 2008 3:37 pm
- Has thanked: 460 times
- Been thanked: 523 times
- Contact:
Re: Modbus
Hello Zadah
do you have a copy of the code without the motor control and other bits ? I.E down to basic grass roots level
I am trying to work out what you have done any why with the code
regards
steve
do you have a copy of the code without the motor control and other bits ? I.E down to basic grass roots level
I am trying to work out what you have done any why with the code
regards
steve
Success always occurs in private and failure in full view.
-
- Posts: 31
- Joined: Wed May 02, 2012 5:49 pm
- Has thanked: 3 times
- Been thanked: 7 times
- Contact:
Re: Modbus
Hello Steve
I tried to keed to MODBUS code quite simple... First the RSR232 component resceives the MASTER command starting with slave adress (1), which after comes the command 1,3,5,6 or 16. After that the program checks if the crc is ok and if it is OK program executes command + calculates reply CRC.
I tried to keed to MODBUS code quite simple... First the RSR232 component resceives the MASTER command starting with slave adress (1), which after comes the command 1,3,5,6 or 16. After that the program checks if the crc is ok and if it is OK program executes command + calculates reply CRC.
-
- Posts: 12
- Joined: Sun Nov 09, 2014 5:53 pm
- Location: Oman/India
- Has thanked: 5 times
- Been thanked: 2 times
- Contact:
Re: Modbus
Hello Zadah,
Thanks for the work you have done to develop the modbus slave. I am quite interested since I am doing a project that will need one like this. I need to capture few input registers starting from 30100 to 30120 on an RS485 interface. I will have to build this from scratch. The flowcode program when opened was in Finnish and couldn't follow the flowchart much since I can understand only english.
I was not able to find a similar topic elsewhere in the forum and there is no modbus slave component available yet.
How can I contact you to further discuss ?
Thanks in advance
RTJNair
Thanks for the work you have done to develop the modbus slave. I am quite interested since I am doing a project that will need one like this. I need to capture few input registers starting from 30100 to 30120 on an RS485 interface. I will have to build this from scratch. The flowcode program when opened was in Finnish and couldn't follow the flowchart much since I can understand only english.
I was not able to find a similar topic elsewhere in the forum and there is no modbus slave component available yet.
How can I contact you to further discuss ?
Thanks in advance
RTJNair
-
- Posts: 94
- Joined: Wed Jan 16, 2013 11:37 am
- Has thanked: 56 times
- Been thanked: 16 times
- Contact:
Re: Modbus
Hi guys.
I resumed my project modbus slave and I want to know if a Modbus Slave component is possible.
I tried the Modbus master and I am making progress but my team should be a slave.
Someone has made new test with these components ??
Thank you very much.
I resumed my project modbus slave and I want to know if a Modbus Slave component is possible.
I tried the Modbus master and I am making progress but my team should be a slave.
Someone has made new test with these components ??
Thank you very much.
-
- Posts: 94
- Joined: Wed Jan 16, 2013 11:37 am
- Has thanked: 56 times
- Been thanked: 16 times
- Contact:
Re: Modbus
Good afternoon guys.
I still do modbus slave component and need to do the CRC calculation, I'm looking information and I can not find anyone explain it to me simply for my little brain .
Can anyone help me and tell me how to do it ??
Thank you very much.
I still do modbus slave component and need to do the CRC calculation, I'm looking information and I can not find anyone explain it to me simply for my little brain .
Can anyone help me and tell me how to do it ??
Thank you very much.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Modbus
This shows how to do the RTU CRC in code.
http://www.ccontrolsys.com/w/How_to_Com ... essage_CRC
I have also sent you a PM with the source of our Modbus master component so you can see how it's been done there.
http://www.ccontrolsys.com/w/How_to_Com ... essage_CRC
I have also sent you a PM with the source of our Modbus master component so you can see how it's been done there.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Steve001
- Valued Contributor
- Posts: 1189
- Joined: Wed Dec 31, 2008 3:37 pm
- Has thanked: 460 times
- Been thanked: 523 times
- Contact:
Re: Modbus
this may be of help too
Steve
Steve
- Attachments
-
- guide to crc16 calculations.pdf
- (70.8 KiB) Downloaded 358 times
Success always occurs in private and failure in full view.
-
- Posts: 94
- Joined: Wed Jan 16, 2013 11:37 am
- Has thanked: 56 times
- Been thanked: 16 times
- Contact:
Re: Modbus
thank you very much Steve001, your help has been very important.
I made a managed to work a block for calculating CRC16.
The next step is the programming of a block modbus slave to respond with some simple functions.
I will report on progress.
Thanks again
I made a managed to work a block for calculating CRC16.
The next step is the programming of a block modbus slave to respond with some simple functions.
I will report on progress.
Thanks again
- Mantas
- Posts: 221
- Joined: Tue May 15, 2012 10:32 pm
- Location: Klaipeda, Lithuania - North sea, UK
- Has thanked: 57 times
- Been thanked: 27 times
- Contact:
Re: Modbus
Hello, guys,
I would suggest you to stop inventing a wheel. Download the source for freeMODBUS which supports RTU/ASCII modes from here: http://sourceforge.net/projects/freemod ... ios/files/, porting the app is easy the documentation is here http://www.freemodbus.org/api/index.html. Port your files for serial like UART and Timers for your chip and get over it (If your not afraid of getting your hands dirty with a bit of C code). Worked like a charm form me, and I only spent one evening getting familiar with the library and porting instructions and vuolia! If you want to use it inside flowcode with flowcode macros just write abstraction layer for calling C code functions. Goodluck!
Best regards,
Mantas
I would suggest you to stop inventing a wheel. Download the source for freeMODBUS which supports RTU/ASCII modes from here: http://sourceforge.net/projects/freemod ... ios/files/, porting the app is easy the documentation is here http://www.freemodbus.org/api/index.html. Port your files for serial like UART and Timers for your chip and get over it (If your not afraid of getting your hands dirty with a bit of C code). Worked like a charm form me, and I only spent one evening getting familiar with the library and porting instructions and vuolia! If you want to use it inside flowcode with flowcode macros just write abstraction layer for calling C code functions. Goodluck!
Best regards,
Mantas
Science is my true religion.