mb2hal sets up float pins. Can this be fixed?
31 Dec 2015 21:07 #67614
by Simpson36
mb2hal sets up float pins. Can this be fixed? was created by Simpson36
Document states that U32 pins will be set up, but the pins are floats.
This causes lots of extra work and processing to convert everything. I cannot locate the mb2hal source code, but I'm a newbee at this, so it may be right in front of me.
It *seems* like it would be a simple thing to fix . . . .
This causes lots of extra work and processing to convert everything. I cannot locate the mb2hal source code, but I'm a newbee at this, so it may be right in front of me.
It *seems* like it would be a simple thing to fix . . . .
![:unsure: :unsure:](/media/kunena/emoticons/unsure.png)
Please Log in or Create an account to join the conversation.
31 Dec 2015 21:34 #67615
by BigJohnT
Replied by BigJohnT on topic mb2hal sets up float pins. Can this be fixed?
I don't see a mb2hal component in LinuxCNC where did you get it? What version are you running?
JT
JT
The following user(s) said Thank You: Simpson36
Please Log in or Create an account to join the conversation.
- seb_kuzminsky
- Offline
- Administrator
-
Less
More
- Posts: 75
- Thank you received: 14
31 Dec 2015 21:59 #67618
by seb_kuzminsky
Replied by seb_kuzminsky on topic mb2hal sets up float pins. Can this be fixed?
Which document are you referring to? As far as I know, mb2hal is completely undocumented, unfortunately.
The mb2hal source is in src/hal/user_comps/mb2hal, in our git repo.
Looking at the mb2hal code, it seems like it's creating both float and s32 pins (unfortunately named "int") for some registers, and just float pins for other registers.
I agree, it seems like it should be easy to support both float and s32 and/or u32 pins for all registers. I'd be happy to help you develop and merge a patch for this.
The mb2hal source is in src/hal/user_comps/mb2hal, in our git repo.
Looking at the mb2hal code, it seems like it's creating both float and s32 pins (unfortunately named "int") for some registers, and just float pins for other registers.
I agree, it seems like it should be easy to support both float and s32 and/or u32 pins for all registers. I'd be happy to help you develop and merge a patch for this.
The following user(s) said Thank You: Simpson36
Please Log in or Create an account to join the conversation.
31 Dec 2015 22:25 - 31 Dec 2015 22:27 #67620
by BigJohnT
Replied by BigJohnT on topic mb2hal sets up float pins. Can this be fixed?
Actually there is some documents in the mb2hal directory, I'll make that into a man page and add it to the docs. I must admit I only looked in the docs and not git...
Simson36 git.linuxcnc.org/gitweb?p=linuxcnc.git;a...al;hb=refs/heads/2.7
JT
Simson36 git.linuxcnc.org/gitweb?p=linuxcnc.git;a...al;hb=refs/heads/2.7
JT
Last edit: 31 Dec 2015 22:27 by BigJohnT.
The following user(s) said Thank You: Simpson36
Please Log in or Create an account to join the conversation.
31 Dec 2015 22:55 #67624
by andypugh
Replied by andypugh on topic mb2hal sets up float pins. Can this be fixed?
The HAL pins are created here:
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...b=refs/heads/2.7#l91
It creates both pins for
109 case mbtx_04_READ_INPUT_REGISTERS:
110 case mbtx_03_READ_HOLDING_REGISTERS:
But only float for
138 case mbtx_16_WRITE_MULTIPLE_REGISTERS:
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...b=refs/heads/2.7#l91
It creates both pins for
109 case mbtx_04_READ_INPUT_REGISTERS:
110 case mbtx_03_READ_HOLDING_REGISTERS:
But only float for
138 case mbtx_16_WRITE_MULTIPLE_REGISTERS:
Please Log in or Create an account to join the conversation.
01 Jan 2016 14:09 #67645
by Simpson36
Replied by Simpson36 on topic mb2hal sets up float pins. Can this be fixed?
WOW!
First, let me say a big thank you for all of the responses.!
The 'document' on mb2hal is actually the well commented .ini according to the author. That is where it is stated that the 'module'? makes U32 resisters, bit it actually makes S32 and Float and only float for funct_16 (write multi)
Modbus has only 16 bit registers so unnecessary conversions are required. I discovered Andy's conversions and the offset function so I could make work-arounds, but it would be better, I think it would be a lot more convenient if all of the registers were U32. If there are duplicate floats, it eon't hurt, but I don't see much reason for it.
For example, I have an industrial grade joystick that has encoders rather than analog pots. The data out from the software decoder is +50 to -50 which is sent over the Modbus. Using mb2hal, I had to add 50 at the device and then subtract 50 at the LinuxCNC end because negative numbers read as 65k - the actual number
I think it should be a relatively easy fix, but I cannot find mb2hal on my computer (I set up a new box for LinuxCNC development) and while I am quite willing to spend the time to assist, I am unfamiliar with Linux at this point, so it would mean a lot of research on my part to get this done on my own.
First, let me say a big thank you for all of the responses.!
The 'document' on mb2hal is actually the well commented .ini according to the author. That is where it is stated that the 'module'? makes U32 resisters, bit it actually makes S32 and Float and only float for funct_16 (write multi)
Modbus has only 16 bit registers so unnecessary conversions are required. I discovered Andy's conversions and the offset function so I could make work-arounds, but it would be better, I think it would be a lot more convenient if all of the registers were U32. If there are duplicate floats, it eon't hurt, but I don't see much reason for it.
For example, I have an industrial grade joystick that has encoders rather than analog pots. The data out from the software decoder is +50 to -50 which is sent over the Modbus. Using mb2hal, I had to add 50 at the device and then subtract 50 at the LinuxCNC end because negative numbers read as 65k - the actual number
I think it should be a relatively easy fix, but I cannot find mb2hal on my computer (I set up a new box for LinuxCNC development) and while I am quite willing to spend the time to assist, I am unfamiliar with Linux at this point, so it would mean a lot of research on my part to get this done on my own.
Please Log in or Create an account to join the conversation.
01 Jan 2016 14:30 - 01 Jan 2016 14:31 #67647
by BigJohnT
Replied by BigJohnT on topic mb2hal sets up float pins. Can this be fixed?
Add git to your computer
wiki.linuxcnc.org/cgi-bin/wiki.pl?Git#Pr...development_with_git
Do a git checkout of the source code as shown here.
wiki.linuxcnc.org/cgi-bin/wiki.pl?Git#Anonymous_checkouts
You will find the mb2hal in somedirectory/src/hal/user_comps or something like that. I just use the old name for my directory emc as it is shorter and easier to type.
I'm in the process of adding the mb2hal information to the man pages and the docs and a review when I'm done would be welcome.
JT
wiki.linuxcnc.org/cgi-bin/wiki.pl?Git#Pr...development_with_git
Do a git checkout of the source code as shown here.
wiki.linuxcnc.org/cgi-bin/wiki.pl?Git#Anonymous_checkouts
git clone git://git.linuxcnc.org/git/linuxcnc.git somedirectory
cd somedirectory
git checkout 2.7
You will find the mb2hal in somedirectory/src/hal/user_comps or something like that. I just use the old name for my directory emc as it is shorter and easier to type.
I'm in the process of adding the mb2hal information to the man pages and the docs and a review when I'm done would be welcome.
JT
Last edit: 01 Jan 2016 14:31 by BigJohnT.
The following user(s) said Thank You: seb_kuzminsky, Simpson36
Please Log in or Create an account to join the conversation.
01 Jan 2016 16:23 #67652
by Simpson36
Replied by Simpson36 on topic mb2hal sets up float pins. Can this be fixed?
Thanks for the info.
Taking a peek at the links, I see that I will need to create an account, and so on. My Linux box's Ethernet port is communicating with the device that I am working on, so I'll need to reconfigure and hook the machine up to my network to get web access and follow your instructions.
I am familiar with Modbus and also Mach3 and Mach4. Only Linux and LinuxCNC . . . ad Python . . are new to me. I would be happy to review your doc. when you get them done. Hopefully we can get the mb2hal pins fixed as part of the effort.
Taking a peek at the links, I see that I will need to create an account, and so on. My Linux box's Ethernet port is communicating with the device that I am working on, so I'll need to reconfigure and hook the machine up to my network to get web access and follow your instructions.
I am familiar with Modbus and also Mach3 and Mach4. Only Linux and LinuxCNC . . . ad Python . . are new to me. I would be happy to review your doc. when you get them done. Hopefully we can get the mb2hal pins fixed as part of the effort.
Please Log in or Create an account to join the conversation.
01 Jan 2016 16:51 - 01 Jan 2016 16:52 #67654
by BigJohnT
Replied by BigJohnT on topic mb2hal sets up float pins. Can this be fixed?
You mis-read, no account or anything is needed with an anonymous check out just install git on your computer. Or just download the files from another computer and copy over or just copy the file from the git.linuxcnc.org repository and copy that to your machine computer.
The git files are here:
I'm just copying what I found in the wiki and the source files and converting them to document style.
JT
The git files are here:
I'm just copying what I found in the wiki and the source files and converting them to document style.
JT
Last edit: 01 Jan 2016 16:52 by BigJohnT.
The following user(s) said Thank You: Simpson36
Please Log in or Create an account to join the conversation.
02 Jan 2016 00:49 #67673
by Simpson36
Replied by Simpson36 on topic mb2hal sets up float pins. Can this be fixed?
Please bear with me as I am new to Linux and much of it seems like 'secret code'. While it is slowly sinking in, I'm still climbing a wall on this stuff.
The link to 'installing' git had the instruction in italics below, but if I can just grab the actual files, certainly I can do that
.
I will be happy to go over the code and see if I can make the changes needed to generate U32 pins, but I have no idea where to go from there. Being new here, I hate to be a pest, but could someone provide the steps needed to get from edited code to working module?
1.2. Configure your identity
git config --global user.name "Your full name"
git config --global user.email "This email address is being protected from spambots. You need JavaScript enabled to view it."
Use your real name (not a handle), and use an unobfuscated e-mail address
The link to 'installing' git had the instruction in italics below, but if I can just grab the actual files, certainly I can do that
![B) B)](/media/kunena/emoticons/cool.png)
I will be happy to go over the code and see if I can make the changes needed to generate U32 pins, but I have no idea where to go from there. Being new here, I hate to be a pest, but could someone provide the steps needed to get from edited code to working module?
1.2. Configure your identity
git config --global user.name "Your full name"
git config --global user.email "This email address is being protected from spambots. You need JavaScript enabled to view it."
Use your real name (not a handle), and use an unobfuscated e-mail address
Please Log in or Create an account to join the conversation.
Time to create page: 0.224 seconds