MODBUS Confusion

For general Flowcode discussion that does not belong in the other sections.
BenR
Matrix Staff
Posts: 1924
http://meble-kuchenne.info.pl
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 501 times
Been thanked: 684 times

Re: MODBUS Confusion

Post by BenR »

Many thanks, hopefully will have a part 2 out shortly.

Just a heads up, I hated the way that the functions for modbus were named. We named them after official functions and really they make no sense. So now I have named them in a cleaner way so they better align with the slave device features. Hopefully making things much easier for someone coming to it for the first time.

Please beware this will break existing programs. I'm really sorry about this and can help if you need any help moving to the new version. The function parameters haven't changed just the function names.

User avatar
p.erasmus
Posts: 434
Joined: Thu Dec 03, 2020 12:01 pm
Location: Russia / Россия
Has thanked: 104 times
Been thanked: 88 times

Re: MODBUS Confusion

Post by p.erasmus »

Hi Ben

Thanks Ben

No problem on my side was just exploring until now ,from next week I will start the real application,Will look at the new names
I have named them in a cleaner way so they better align with the slave device features. Hopefully making things much easier for someone coming to it for the first time.

How does this affect the Master function as I will work with the MIAC dsPIC as a MATER controlling an 250Kw Inverter system :D
looking forward at the second video

:D :D
Regards Peter - QME Electronics

BenR
Matrix Staff
Posts: 1924
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 501 times
Been thanked: 684 times

Re: MODBUS Confusion

Post by BenR »

Now everything shares the same naming convention.

So here are the registers made available on the slave.
SlaveProps.jpg
SlaveProps.jpg (31.21 KiB) Viewed 8047 times
Here are the Slave functions.
SlaveFunctions.jpg
SlaveFunctions.jpg (20.62 KiB) Viewed 8047 times
And here are the master functions.
MasterFunctions.jpg
MasterFunctions.jpg (17.53 KiB) Viewed 8047 times
Hopefully much cleaner than before.

stefan.erni
Valued Contributor
Posts: 997
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 190 times
Been thanked: 217 times

Re: MODBUS Confusion

Post by stefan.erni »

Hi Ben

Thank you very much.
Modbus is nice to use. It's almost like a data socket. Have you already been able to do something for the data socket?

regards

Stefan

BenR
Matrix Staff
Posts: 1924
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 501 times
Been thanked: 684 times

Re: MODBUS Confusion

Post by BenR »

Hi Stefan,

No sorry not had chance to look at that one yet. Ideally I would like to encrypt a data socket or at least provide the means to do this which would be a benefit over modbus TCP. I'll keep at it :D

Part 2 video now available here.
https://youtu.be/ZVg91kJOXdY

User avatar
p.erasmus
Posts: 434
Joined: Thu Dec 03, 2020 12:01 pm
Location: Russia / Россия
Has thanked: 104 times
Been thanked: 88 times

Re: MODBUS Confusion

Post by p.erasmus »

Thanks Ben looks impressive

:D :D :D
Regards Peter - QME Electronics

stefan.erni
Valued Contributor
Posts: 997
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 190 times
Been thanked: 217 times

Re: MODBUS Confusion

Post by stefan.erni »

Hi Ben

In your video there are numbers in the gauge. How did you do this? My gauge don't show numbers.

Regards

Stefan
number_2021-01-22_16-53-55.png
number_2021-01-22_16-53-55.png (193.55 KiB) Viewed 8034 times
no_number_2021-01-22_17-05-47.png
no_number_2021-01-22_17-05-47.png (56.06 KiB) Viewed 8034 times

BenR
Matrix Staff
Posts: 1924
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 501 times
Been thanked: 684 times

Re: MODBUS Confusion

Post by BenR »

Hello,

The way the scaling works on the gauges is a bit strange but this is how it works.

Minor tick step - Sets the number between each minor tick. On a ruler this might be 1 for a mark every 1mm. For your scale of 2000, 50 might be a nice number.

Major tick step - Sets the number of minor tick steps for each numeric marking. On a ruler this might be 10 for a number every 10mm. For your scale of 2000 with minor ticks of 50, 2 or 4 might be nice values.

Major 2, Minor 50 works well as does Major 5, Minor 20.

Hope this helps :D

stefan.erni
Valued Contributor
Posts: 997
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 190 times
Been thanked: 217 times

Re: MODBUS Confusion

Post by stefan.erni »

Hi Ben

Perfect. It's working with the text.
The program get a string from a bluetooth Modul with values as ascci code every 500mSec.
A small code convert the string to integer and control the gauge.

I will change the program to Modbus / Wlan soon.

regards

Stefan
// receive string look like "0015,0022,0000,0022,2010,1201,\r\n)



.temp_str = Mid$ (signalstring,0,5)
.channel[0] = StringToInt$ (.temp_str)

.temp_str = Mid$ (signalstring,7,11)
.channel[1] = StringToInt$ (.temp_str)

.temp_str = Mid$ (signalstring,13,17)
.channel[2] = StringToInt$ (.temp_str)

.temp_str = Mid$ (signalstring,19,23)
.channel[3] = StringToInt$ (.temp_str)

.temp_str = Mid$ (signalstring,25,29)
.channel[4] = StringToInt$ (.temp_str)

.temp_str = Mid$ (signalstring,31,36)
.channel[5] = StringToInt$ (.temp_str)

String_to_int_2021-01-22_18-16-21.png
String_to_int_2021-01-22_18-16-21.png (106.43 KiB) Viewed 8027 times

Post Reply