Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Modbus

For general discussion related FlowStone

Re: Modbus

Postby Embedded » Fri May 13, 2011 10:38 am

Try it now...
Embedded
 
Posts: 143
Joined: Sat Oct 30, 2010 1:42 pm

Re: Modbus

Postby fixstuff555 » Sat May 14, 2011 3:17 am

Excellent work! It works perfectly. I did a couple things to it. I added the "on change" from each write input so any new value initiates a write. I also deleted the link to the trigger on the clear buffer input on the read polling side. It was causing the outputs to flicker (1 brief tick at 0 I believe). Finally, I stretched out the text boxes on the read side so the whole number could be displayed. Otherwise, I just hooked up some pots for the testing. By setting the read and write both to start at address 0, I set the poll rate down as fast as it could go. You can really see it work that server. Cycle the pot values to see big changes. Great job. At this point, the integers can be used as is for analog values being read to and from a server, and a single integer can be used to pass bit data. Is there a object for 16bits to a int? With a 16bit to int, and a int to 16bit object, you could pass a ton of digital IO through this object also.

Good job - This is a great addition to Flowstone. Now I would guess the next step would be a Modbus server object, which really should be easier. It would not have to initiate a connection. Only respond to polls from this client.

Modbus TCP Client V1-03b.fsm
(56.3 KiB) Downloaded 1414 times
fixstuff555
 
Posts: 151
Joined: Thu Oct 21, 2010 3:24 pm

Re: Modbus

Postby fixstuff555 » Sat May 14, 2011 3:44 am

One thing. When I deleted the trigger to the clear buffer, I noted that the update to the label box in the GUI box stopped updating during input changes. However, if I switched to that section of code to view the result, it updates the label. Not sure if that's a bug, or I toggled an "undocumented feature". Putting back the trigger fixed the label boxes, but caused the int outputs to flicker again.
fixstuff555
 
Posts: 151
Joined: Thu Oct 21, 2010 3:24 pm

Re: Modbus

Postby fixstuff555 » Sat May 14, 2011 5:05 am

Alright. Now I tried something cool. I have two computers, each running the client you wrote. One computer has the Modbus simulator server on it, and one flowstone client. The other computer running on a wireless connection, has the other flowstone client on it. I have both of these clients pointing to the server. This gives me a connection between the two client programs. I can read and right to the server from both, which in turn gives me a connection between the two clients. :mrgreen: The next thing I'm going to try is to take the inputs from my xbox360 controller into one client, and control outputs on the other computer tied to the other client which has a Mbed microcontroller on it with an RPC client running some RC servos. By the way, the wireless computer is a Asus EEPC netbook I bought for $200. It runs Flowstone wonderfully and is about the size of a paperback book. It should make for a really nice "embedded" pc for a robot brain.
fixstuff555
 
Posts: 151
Joined: Thu Oct 21, 2010 3:24 pm

Re: Modbus

Postby Embedded » Sat May 14, 2011 1:19 pm

fixstuff555 wrote:One thing. When I deleted the trigger to the clear buffer, I noted that the update to the label box in the GUI box stopped updating during input changes. However, if I switched to that section of code to view the result, it updates the label. Not sure if that's a bug, or I toggled an "undocumented feature". Putting back the trigger fixed the label boxes, but caused the int outputs to flicker again.


What you are seeing isn't what you think you are seeing. If you don't clear the buffer you are looking at the FIFO top of stack (TOS). Meaning the new data gets pushed onto the bottom of the stack. So if you don't clear it you are looking at old data that doesn't change. Plus you will use load of memory until it runs out!
I used a FIFO as sometimes the server would have more than one return string and without it they would be lost. It will always flash as it is being updated.
For the GUI display boxes I made a quick check to see if the data had changed before redrawing the box to save on CPU.
Embedded
 
Posts: 143
Joined: Sat Oct 30, 2010 1:42 pm

Re: Modbus

Postby Embedded » Sat May 14, 2011 3:06 pm

Before I move on to the server, I've tidied up the GUI a little so that it can be made into an app. I've tested it as an EXE and it works great!

The new version also has some real-time graphics on the input showing the average level.

I've also sorted out the re-draws on the text boxes to make them a little better.
Attachments
Modbus TCP Client V1-04.fsm
Modbus Client V1.04
(64.88 KiB) Downloaded 1441 times
Embedded
 
Posts: 143
Joined: Sat Oct 30, 2010 1:42 pm

Re: Modbus

Postby Embedded » Sat May 14, 2011 4:53 pm

OK - Here's the Server V1.00

This Server is still quite basic, I haven't implemented the base address yet, so it just works with 0000, and there is no error response.

Also I found a very small bug with the Write Client TX led, which is now fixed in V1.05

ps. they work great as a pair of EXE's
Attachments
Modbus TCP Client V1-05.fsm
Modbus Client
(64.88 KiB) Downloaded 1477 times
Modbus Server V1-00.fsm
Modbus Server
(23.7 KiB) Downloaded 1323 times
Embedded
 
Posts: 143
Joined: Sat Oct 30, 2010 1:42 pm

Re: Modbus

Postby fixstuff555 » Sat May 14, 2011 10:32 pm

Here are some helpful modules for these Modbus modules...

http://www.dsprobotics.com/support/viewtopic.php?f=2&t=229
fixstuff555
 
Posts: 151
Joined: Thu Oct 21, 2010 3:24 pm

Re: Modbus

Postby Embedded » Sat May 14, 2011 11:26 pm

So here the Modbus Server with address handling:
Attachments
Modbus Server V1-01.fsm
Modbus Server
(28.25 KiB) Downloaded 1324 times
Embedded
 
Posts: 143
Joined: Sat Oct 30, 2010 1:42 pm

Re: Modbus

Postby fixstuff555 » Sat May 14, 2011 11:59 pm

The reads work good in the server when written to from the client. However, the server needs the ability to have input to it in the individual registers, in the same manner that the client does. It looks like if I write to a register in the server, the client overwrites it with a read, which should not happen.
fixstuff555
 
Posts: 151
Joined: Thu Oct 21, 2010 3:24 pm

PreviousNext

Return to General

Who is online

Users browsing this forum: No registered users and 44 guests