Modbus

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 460 times
Been thanked: 523 times
Contact:

Modbus

Post by Steve001 »

Morning guys,

looking at data sheet and you tube video V6 looking good :)

is there a modbus component ?

Steve
Success always occurs in private and failure in full view.

User avatar
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

Post by Benj »

Hello,

Should be easy enough to add, what comms bus were you thinking of using?

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 460 times
Been thanked: 523 times
Contact:

Re: Modbus

Post by Steve001 »

Hello Ben,

Was thinking of RS485 Modbus / Jbus RTU ,depending on the register been used that could be 2,3 or 4 words

Regards

Steve
Success always occurs in private and failure in full view.

User avatar
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

Post by Benj »

Hello,

I've been doing some reading and it looks like this would make a great addition. Especially if I can tap into existing features such as COM port and Ethernet communications so you can actually talk to the devices in simulation and from on-board the microcontroller. Do you know of any reasonable priced and popular modbus devices I could get hold of to do some developing?

tello
Posts: 94
Joined: Wed Jan 16, 2013 11:37 am
Has thanked: 56 times
Been thanked: 16 times
Contact:

Re: Modbus

Post by tello »

Hello Steve001 and Benj, I work a lot in the industrial and Modbus RTU protocol is very used, many manufacturers use this protocol to control peripherals, from input-output modules and analog digital, electrical network analyzers, frequency converters for motors , programmable logic controllers or single temperature and humidity sensors.
I think it's very interesting to create a component Modbus RTU master and slave to open the industrial sector projects created with Flowcode PIC and ARM.
Some time I've been trying to make a macro for basic function of slave PIC, but I do not program in C and there is much information modbus protocol programming in C.
If I can help with anything to do this I would like to make it cooperate.

thank you very much

PD. I like the new Flowcode6

artose
Posts: 3
Joined: Sun Mar 03, 2013 3:28 am
Been thanked: 4 times
Contact:

Re: Modbus

Post by artose »

Yo cree un pequeño programa F5 MODBUS RTU. haciendo el calculo del CRC16.

I created a small program MODBUS RTU F5. making the calculation of CRC16. Edited by dazz(english translation) editado por Dazz(traducción Inglés)
Attachments
pic16f877a ok modbus3.fcf
(35.19 KiB) Downloaded 879 times

User avatar
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

Post by Mantas »

Hello Gent,

If we started talking industrial protocols then why not add CANopen, Profinet, ethernetCAT. They are all like MODBUS a more advanced industrial control protocols which need a high degree of coms knowlage by using CAN, ETHERNET or RS485 interfaces.

Best regards,
Mantas
Science is my true religion.

User avatar
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

Post by Benj »

Hi Mantas,

Thanks to v6 we should be able to cover pretty much any communications busses like this. The great thing is that you can even create them yourself.

We will obviously continue to take requests seriously and do what we can to get as much out the box functionality as possible, I'll make a start on Modbus next week and see how far I get, If it's quick and easy enough then I might be able to roll out a few more protocols.

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 460 times
Been thanked: 523 times
Contact:

Re: Modbus

Post by Steve001 »

Hi Benj,

just a thought would it be possible to modify the coms setup's

ie

adjustable Baud rates
parity odd, even , none

I know that this depends largely on the uarts

Not sure on how easily it is to implement, but it would be nice

Steve
Success always occurs in private and failure in full view.

User avatar
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

Post by Benj »

Hi Steve,

Yes this should all be possible.

For sim the COM port component currently accepts variable bauds but I would have to add options for controlling the parity into the DLL, shouldn't be too much of a problem.

For download we could put the CAL UART into 9-bit data mode and automatically work out the parity as part of the component's inner workings.

User avatar
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

Post by Mantas »

Hi Benj,

I hope you will have time to do CANopen as well. If you want I can send you some C code and documentation regarding this. Recently I had to do a lot of studying on CANopen to control BLDC servos, but due to lack of time I couldn't accomplish this task, as it is pretty tricky, >300 pages of reading documentation :mrgreen: I understood almost all the SDO and PDO functionality, but still need to roll out how to fit it all in CAN message. If you could accomplish all those industrial protocols and V6 would come out with it I bet you would receive a lot of new user interest from industry!

Regards,
Mantas
Science is my true religion.

User avatar
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

Post by Benj »

Hi Mantas,

Yes your welcome to send me anything you have. If it's too large to send via a PM then you could either email to me or send via a dropbox or similar site.

User avatar
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

Post by Mantas »

Hi Benj,

Here is a Dropbox link: https://dl.dropboxusercontent.com/u/104 ... ANopen.zip

Best regards,
Mantas
Science is my true religion.

User avatar
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

Post by Benj »

Hello,

Modbus pretty much in there now, wasn't too bad after all but i'm guessing there will be a few issues at the mo, e.g. simulating parity which requires DLL mods. Just trying to add the ASCII mode as well as the RTU mode but shouldn't be much of an issue. Hopefully include it in the upcoming patchset 3 release tomorrow so you can have a play.

I'll start having a look into CANopen tonight and see if I can make head or tail out of it. Thanks for the files :D

User avatar
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

Post by Mantas »

Good luck Benj,

I hope you will succeed:) That will make my life a lot easier;)

Cheers,
Mantas
Science is my true religion.

tello
Posts: 94
Joined: Wed Jan 16, 2013 11:37 am
Has thanked: 56 times
Been thanked: 16 times
Contact:

Re: Modbus

Post by tello »

Good morning guys and thanks to all

Thanks Benj for your work, I am currently working on several projects and seriously need Modbus Rtu and Asci communication to communicate the microcontroller with industrial equipment.

I have really wanted to work with Modbus because it greatly simplifies my projects and my life jejejejeje :D :D :D

Thank you again.

User avatar
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

Post by Benj »

Hello,

Ok in PatchSet 4 the Modbus component should be complete and should work correctly. I'm a bit unsure as the guide I was following sent the data MSB first but then sent the CRC LSB first so might be a few remaining issues to iron out.

If anyone tries the component with Modbus hardware then let me know how your getting on and I will do my best to help out.

Modbus slave component would also be a nice feature so I will make sure it is on the list.

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 460 times
Been thanked: 523 times
Contact:

Re: Modbus

Post by Steve001 »

Thanks for that benj ,

i have some hardware and software that you are more than welcome borrow that we use at work for testing modbus loops

let me know if you would like to borrow it

steve
Success always occurs in private and failure in full view.

User avatar
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

Post by Mantas »

Benj,

I think you and other MM crew will win a Nobel prize next year! :mrgreen:

BR,
Mantas
Science is my true religion.

User avatar
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

Post by Benj »

i have some hardware and software that you are more than welcome borrow that we use at work for testing modbus loops
That would be fantastic Steve if you wouldn't mind doing that, really appreciated.
I think you and other MM crew will win a Nobel prize next year! :mrgreen:
Cheers Mantas, that would be a nice feather for the bow indeed. Still I would be happy just to have some customers who enjoy using the product.

User avatar
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

Post by Mantas »

Hi Benj,

You certainly do have more than one :wink: How is the progress on CANopen?

Regards,
Mantas
Science is my true religion.

User avatar
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

Post by Benj »

Hi Mantas,

Cheers :D Good to know.

Progress on CANopen is not great at the moment but we are pushing for the release build today and then I will aim to get it in for v6.1. Got a bit sidetracked by the MPU6050 sensor arriving for my quadcopter project I hope to publish on the Flowcode blog.

Hopefully shouldn't take too long from what I have seen on the specification so far but I will do more research and try and get out some code for you to play with. Do you have any or know of any good yet low cost CANopen hardware.

User avatar
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

Post by Mantas »

Hi Benj,

I received my MPU6050 today as well :D I want to upgrade my ITG3200 + BMA180 + RM3000F which was an amazing combo! I was looking for MPU6000 breakout which is set for SPI protocol, and allows for higher sample rate. As far as CANopen goes, I was aiming for servo motors. There are plenty of them on the market, but I know only the price for Dunkermotor BG75x25 which is the biggest from their BLDC motor series - 1310 euros, which is expensive, but it is a very clever, has many different working modes, even stepper mode :) Let me know how it goes with you quadrocopter :wink:

P.S. I saw an amazing video on youtube, were a presenter controls two quads with hands using XBOX kinect, and much more crazy stuff :)

Best regards,
Mantas

[edit by moderator to remove profanity]
Science is my true religion.

User avatar
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

Post by Benj »

I want to upgrade my ITG3200 + BMA180 + RM3000F which was an amazing combo!
If you do any integration between the MPU6050 and the magnetometer sensor that that would be really interesting. The component to drive the MPU 6050 should be in the v6 release if you want to have a play and let me know how you get on.
As far as CANopen goes, I was aiming for servo motors.
Ok I will try and develop some code and probably pass it over for testing. Might have a quick look around and see what is out there.
I saw an amazing video on youtube, were a presenter controls two quads with hands using XBOX kinect
I have also seen some very cool stuff using the kinect like scanning in real world models etc, I also have one sat on my shelf at home that rarely gets used so I feel a project coming on. Be nice if we could somehow pass the data into v6.

User avatar
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

Post by Mantas »

Hi Benj,

I have made a board with GPS, BMP085 pressure sensor, BMA180 acc, ITG3200 gyro, RM3000F mag. It working wonderful, at 100Hz. Now I am writing a code in flowcode for geomagnetic earth model so it would calculate the declination angle regarding on the date and position, so it would know the true north. Its called 11th Gen International Earth geomagnetic model IGRF11, or WMM2010 used by NATO and others. So you can make a drone for flying to programmed destination, fully autonomously. Also developed realy good calibration algorithms for magnetometers, accelerometers and gyros, to be able withstand accidental magnetic interference and not loose direction.

If we had a component for Kinect in FC it would be really cool! :D

P.S. you can try to contact Dunkermotors regarding their smaller BLDC which should be cheeper: http://www.dunkermotor.com/default.asp? ... 120&lang=2

Cheers,
Mantas
Science is my true religion.

Post Reply