Page 2 of 2
Re: MODBUS Confusion
Posted: Thu Jan 21, 2021 11:37 am
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.
Re: MODBUS Confusion
Posted: Thu Jan 21, 2021 12:14 pm
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
looking forward at the second video

Re: MODBUS Confusion
Posted: Thu Jan 21, 2021 12:36 pm
by BenR
Now everything shares the same naming convention.
So here are the registers made available on the slave.

- SlaveProps.jpg (31.21 KiB) Viewed 8578 times
Here are the Slave functions.

- SlaveFunctions.jpg (20.62 KiB) Viewed 8578 times
And here are the master functions.

- MasterFunctions.jpg (17.53 KiB) Viewed 8578 times
Hopefully much cleaner than before.
Re: MODBUS Confusion
Posted: Thu Jan 21, 2021 1:20 pm
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
Re: MODBUS Confusion
Posted: Thu Jan 21, 2021 2:44 pm
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
Part 2 video now available here.
https://youtu.be/ZVg91kJOXdY
Re: MODBUS Confusion
Posted: Thu Jan 21, 2021 6:00 pm
by p.erasmus
Re: MODBUS Confusion
Posted: Fri Jan 22, 2021 4:11 pm
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 (193.55 KiB) Viewed 8565 times

- no_number_2021-01-22_17-05-47.png (56.06 KiB) Viewed 8565 times
Re: MODBUS Confusion
Posted: Fri Jan 22, 2021 4:43 pm
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

Re: MODBUS Confusion
Posted: Fri Jan 22, 2021 5:28 pm
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 (106.43 KiB) Viewed 8558 times