Modbus Help - MB2HAL
- racedirector
- Offline
- Elite Member
-
Less
More
- Posts: 267
- Thank you received: 42
03 Sep 2015 20:40 #62086
by racedirector
Replied by racedirector on topic Modbus Help - MB2HAL
Had to make a few adjustments but all is good so far. Just incase anyone else is watching this with an X200 here are the changes
==== CODE BELOW - for formatting ====
loadusr -Wn x200 mb2hal config=x200vfd.ini
setp x200.direction.00 1 This doesn't seem to work, got to figure this one out
loadrt scale count=1
addf scale.0 servo-thread
scale.0.gain = 0.16666667
net spindle-speed scale.0.in <= motion.spindle-speed-out
net x200-freq x200.frequency.00 <= scale.0.out
net x200-run x200.run.00 <= motion.spindle-on
net x200-dir x200.direction.00 <= motion.spindle-reverse <- This is weird, the spindle actually goes CLOCKWISE when M3 is called. Another one to work out
net x200-at-speed x200.at-speed.00 <= motion.spindle-at-speed
========
It turns out the X200 frequency range under ModBus is 0 to 4000 as it accepts values in increments of 0.1Hz so above at 12000 / 0.16666667 = 2000.00004 which the VFD reads as 200.000004Hz.
As for the direction issue I am workin on it
Cheers
==== CODE BELOW - for formatting ====
loadusr -Wn x200 mb2hal config=x200vfd.ini
setp x200.direction.00 1 This doesn't seem to work, got to figure this one out
loadrt scale count=1
addf scale.0 servo-thread
scale.0.gain = 0.16666667
net spindle-speed scale.0.in <= motion.spindle-speed-out
net x200-freq x200.frequency.00 <= scale.0.out
net x200-run x200.run.00 <= motion.spindle-on
net x200-dir x200.direction.00 <= motion.spindle-reverse <- This is weird, the spindle actually goes CLOCKWISE when M3 is called. Another one to work out
net x200-at-speed x200.at-speed.00 <= motion.spindle-at-speed
========
It turns out the X200 frequency range under ModBus is 0 to 4000 as it accepts values in increments of 0.1Hz so above at 12000 / 0.16666667 = 2000.00004 which the VFD reads as 200.000004Hz.
As for the direction issue I am workin on it

Cheers
Please Log in or Create an account to join the conversation.
- LearningLinuxCNC
-
- Offline
- Elite Member
-
Less
More
- Posts: 319
- Thank you received: 48
03 Sep 2015 20:47 #62087
by LearningLinuxCNC
Replied by LearningLinuxCNC on topic Modbus Help - MB2HAL
That is what I get for trying to write HAL of the top of my rusty brain. Glad you were able to interpret what I meant. Not what I typed.

The following user(s) said Thank You: racedirector
Please Log in or Create an account to join the conversation.
- racedirector
- Offline
- Elite Member
-
Less
More
- Posts: 267
- Thank you received: 42
03 Sep 2015 20:56 #62089
by racedirector
Replied by racedirector on topic Modbus Help - MB2HAL
Hahaha, whats in your rusty brain far exceeds what I know about HAL. Thanks for the leg up!That is what I get for trying to write HAL of the top of my rusty brain. Glad you were able to interpret what I meant. Not what I typed.
Please Log in or Create an account to join the conversation.
- racedirector
- Offline
- Elite Member
-
Less
More
- Posts: 267
- Thank you received: 42
03 Sep 2015 21:27 #62093
by racedirector
Replied by racedirector on topic Modbus Help - MB2HAL
net x200-dir x200.direction.00 <= motion.spindle-reverse
I think I understand why this is so.....
motion.spindle-forward is an OUT BIT and when M3 is called, it goes TRUE or 1. When that was getting sent to my X200 VFD direction coil it was telling the VFD to run CCW as CCW = 1 and CW = 0. Using motion.spindle-reverse in the way I am using it, when M3 is called it goes to FALSE or 0 and the is correct for my VFD.
Truth be known no one else knows anyway as it is buried in my HAL file
I think I understand why this is so.....
motion.spindle-forward is an OUT BIT and when M3 is called, it goes TRUE or 1. When that was getting sent to my X200 VFD direction coil it was telling the VFD to run CCW as CCW = 1 and CW = 0. Using motion.spindle-reverse in the way I am using it, when M3 is called it goes to FALSE or 0 and the is correct for my VFD.
Truth be known no one else knows anyway as it is buried in my HAL file

Please Log in or Create an account to join the conversation.
- besriworld
- Offline
- Elite Member
-
Less
More
- Posts: 276
- Thank you received: 77
24 Oct 2024 19:40 - 26 Oct 2024 21:46 #313144
by besriworld
Replied by besriworld on topic Modbus Help - MB2HAL
Hello, I am trying to read the spindle load using Modbus. It works fine with the Windows program, but with Linux and mb2hal, it does not. The problem occurs when I attempt to read address 420—it does not return any value, only increments the error counter. Some addresses can be read, but others cannot. What am I doing wrong?Here is the configuration, along with a screenshot of the working Windows setup.
ps now working! i just changed this parameter MAX_UPDATE_RATE
ps now working! i just changed this parameter MAX_UPDATE_RATE
Attachments:
Last edit: 26 Oct 2024 21:46 by besriworld.
Please Log in or Create an account to join the conversation.
Time to create page: 0.082 seconds