Logic Machine Forum
Modbus profile generator - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: Modbus profile generator (/showthread.php?tid=3053)

Pages: 1 2


Modbus profile generator - Daniel - 08.12.2020

If somebody struggle to play directly with json file here is Excel file where you can just fill it in and generate the profile.

.xlsm   Modbus-Profile-Generator.xlsm (Size: 78.84 KB / Downloads: 641)


The json file will be created in the same folder where the Profile generator is and it will have the same name, you can change the name as you want.
Make sure to enable Macros in Excel!
For custom values just create new sheet and create a table for enumeration, Put the sheet name in the value_custom cell.
If you need additional parameters just rename spare column name to needed parameter name and start filling it in. 
Modbus documentation is here https://openrb.com/docs/modbus.htm


RE: Modbus profile generator - tomnord - 08.12.2020

(08.12.2020, 12:06)Daniel. Wrote: If somebody struggle to play directly with json file here is Excel file where you can just fill it in and generate the profile.



The json file will be created in the same folder where the Profile generator is and it will have the same name, you can change the name as you want.
Make sure to enable Macros in Excel!
For custom values just create new sheet and create a table for enumeration, Put the sheet name in the value_custom cell.
If you need additional parameters just rename spare column name to needed parameter name and start filling it in. 
Modbus documentation is here https://openrb.com/docs/modbus.htm
Thank you Daniel. Great work.

Sent fra min SM-G980F via Tapatalk


RE: Modbus profile generator - JRP - 09.12.2020

Thank you very much Daniel extremely useful tool. It would not be too much for something similar to be included in LM.
a greeting


RE: Modbus profile generator - Trond Hoyem - 21.12.2020

(08.12.2020, 12:06)Daniel. Wrote: If somebody struggle to play directly with json file here is Excel file where you can just fill it in and generate the profile.



The json file will be created in the same folder where the Profile generator is and it will have the same name, you can change the name as you want.
Make sure to enable Macros in Excel!
For custom values just create new sheet and create a table for enumeration, Put the sheet name in the value_custom cell.
If you need additional parameters just rename spare column name to needed parameter name and start filling it in. 
Modbus documentation is here https://openrb.com/docs/modbus.htm

Hi Daniel

Great tool!
I have one problem though. I have added addresses for a device where there are several custom values. I have added one sheet for each table of enumeration and entered the sheet name in the cell of respective address.

When I run the macro I get an error in the subfunction, saying the subscript is out of range and highlighting the line number 3 in the below code.

Any good idea of what I do wrong?
Code:
Function customValues2Dict(WorksheetName As String)
    Dim jsonCustomValues As New Dictionary
    Worksheets(WorksheetName).Activate
    NumRows = Range("A1", Range("A1").End(xlDown)).Rows.Count
    For Row = 1 To NumRows
        jsonCustomValues(Cells(Row, 1)) = Cells(Row, 2)
    Next Row
    Set customValues2Dict = jsonCustomValues
End Function



RE: Modbus profile generator - Daniel - 21.12.2020

I would guess you made a typo in the name of enum sheet.


RE: Modbus profile generator - Trond Hoyem - 22.12.2020

(21.12.2020, 15:13)Daniel. Wrote: I would guess you made a typo in the name of enum sheet.
Yes, that was my first guess too, so I copied the name of the sheet into the cell, but no luck. I then removed all values from the value_custom column, and still same error.

(22.12.2020, 06:23)Trond Hoyem Wrote:
(21.12.2020, 15:13)Daniel. Wrote: I would guess you made a typo in the name of enum sheet.
Yes, that was my first guess too, so I copied the name of the sheet into the cell, but no luck. I then removed all values from the value_custom column, and still same error.

OK, figured it out. I did not realize that I needed to set the value_custom to 'null' if there is no custom values. I had removed the original lines from the sheet and started to add my own, and then this was just empty cells...


RE: Modbus profile generator - JRP - 29.04.2021

Hello
First of all great tool, it makes the job of making a profile much easier.
The question is that I have noticed that the generated JSON file contains one less record than indicated in the mapping sheet.
In the example itself there is the Output 10 line and in the generated JSOn file it does not appear, it stays in Output 9.
a greeting


RE: Modbus profile generator - Daniel - 29.04.2021

In did, I updated the generator in the original post.


RE: Modbus profile generator - JRP - 29.04.2021

Thanks it works perfectly.
a greeting


RE: Modbus profile generator - gdimaria - 17.11.2021

Hi, I get an error when I try to generate the profle.
I use MS Office 385 on two different PC anche strange thing is it work perfectly on one and even in the other PC I get errors.

Can you see what happens?

Thank in advance

Peppe


RE: Modbus profile generator - Daniel - 17.11.2021

I'm using office 365 not 385 Wink  and it just worked for me. Did you enable the content when it asked. Your profile attached. Didn't change anything.


RE: Modbus profile generator - gdimaria - 17.11.2021

Pardon, 365 Smile
I do the same things in both PC with the same Office version.

That's very strange... could be a Pc Security policy or another installed software causing it?


RE: Modbus profile generator - Daniel - 17.11.2021

The only thing what I can think of is this.
   


RE: Modbus profile generator - gdimaria - 17.11.2021

(17.11.2021, 14:47)Daniel Wrote: The only thing what I can think of is this.

mmm.. no. Because the macro goes on until it stops on a certain line, as you can see in the picture...

I 'll investigate, I will let you know  Smile


RE: Modbus profile generator - admin - 17.11.2021

I think it has something to do with the xlsm file path. Try putting it into a different folder.


RE: Modbus profile generator - gdimaria - 17.11.2021

(17.11.2021, 14:52)admin Wrote: I think it has something to do with the xlsm file path. Try putting it into a different folder.

Already done. Tried in diffent folders, ieven in desktop...


RE: Modbus profile generator - gdimaria - 17.11.2021

I found the cause of the problem... but not the solution! Smile

cdir = Application.ActiveWorkbook.Path

But Application.ActiveWorkbook.Path is not the path you can see on the picture ("https:\\ ... ect.")

The actual path is "C:\user\Peppe\Desktop"

I checked it on the PC in which it works and I found the right path.

That's very strange because it is the same file in the same position (Desktop) on two different PCs.

I also reinstalled Office but nothing changed.


RE: Modbus profile generator - Daniel - 18.11.2021

Hi
Try this one. It should always export to Desktop. Regardless where the file is.


RE: Modbus profile generator - gdimaria - 18.11.2021

(18.11.2021, 10:01)Daniel Wrote: Hi
Try this one. It should always export to Desktop. Regardless where the file is.

Perfect! That's what I thought I was doing, but I was uncertain about the syntax to use...

Thank you so much

BR

Peppe


RE: Modbus profile generator - Ian@GWTi - 21.01.2022

Hi,

I would like to have a total of 7 custom_values worksheets to use in the value_custom drop down menu. Can this be done?