VFD mb2hal

More
8 years 7 months ago #107718 by BigDo
Replied by BigDo on topic VFD mb2hal
thanks for quick answer

the pin mb2hal.set.cmd.parameters.oo are float type
Owner = 18
Type = float
Dir = IN

and if i want to use Hex how can i do that? A example would be nice :)

Please Log in to join the conversation.

More
8 years 7 months ago #107719 by andypugh
Replied by andypugh on topic VFD mb2hal
In that case you can use a conventional mux4, or change the mux_generic to config="uf4".

Please Log in to join the conversation.

More
8 years 7 months ago #107720 by andypugh
Replied by andypugh on topic VFD mb2hal
To enter numeric constants in hex, just put them in the HAL file as 0x800A (for example)
HAL interprets any constant beginning with 0x as hex.

Or, at least, I think it does. I can't immediately find any reference to this in the documentation.

It is also likely that integers beginning with "0" will be interpreted as octal. Which I can imagine might occasionally be unexpected.

Please Log in to join the conversation.

More
8 years 7 months ago #107723 by Todd Zuercher
Replied by Todd Zuercher on topic VFD mb2hal
There are multiple ways to do this, Andy showed you one way.
In the machine config I posted I used Classicladder to convert the control bits to the numbers needed to write to the modbus registers.

I think I would do it using a Weighted_sum component.
Then make the connections in hal, something like this. The weighted sum component lets you toggle the individual bits of the 16-bit register number.
Code:
loadrt weighted_sum wsum_sizes=16 loadrt not addf process_wsums servo-thread addf not.0 servo-thread setp wsum.0.bit.1.in 1 setp wsum.0.bit.3.in 1 setp wsum.0.bit.15.in 1 net spin-rev <= motion.spindle−reverse => wsum.0.bit.11.in net spin-fwd <= motion.spindle−forward net spin-stop <= not.0.out => wsum.0.bit.12.in net spin-on <= motion.spindle−on => not.0.in net vfd-cmd <= wsum.0.sum => mb2hal.set.cmd.parameters.00 net set-freq <= motion.spindle−speed−out−rps−abs => mb2hal.set.reference.frq.00

Please Log in to join the conversation.

More
8 years 7 months ago #107724 by Todd Zuercher
Replied by Todd Zuercher on topic VFD mb2hal
Connecting your pyvcp controls to Linuxcnc is also done in your hal file(s) and is covered in the manuals, and there are examples in the example configs included with Linuxcnc.
linuxcnc.org/docs/2.7/html/gui/pyvcp.html
linuxcnc.org/docs/2.7/html/gui/pyvcp-exa...tml#_the_connections

Please Log in to join the conversation.

More
6 years 10 months ago #153043 by zajc3w
Replied by zajc3w on topic VFD mb2hal
I'm trying to connect my VFD (chinese yl620) so it will respond to M3-M5,Sxx commands.
I don't want any new GUI elements, don't even need any feedback. At the moment VFD fault relay is in Estop circuit, if VFD trips it stops motion preventing cutter breakage.
I have written YL620.ini to write and read relevant registers

But I'm at loss with what next.
edit custom.hal ? how ?
how to translate M3 to writing 18 to control register and M5 to writing 1 to the same control register?
Any pointers please, I know it's all in WIKI, but it's sooo huge.

Attachment not found

Please Log in to join the conversation.

More
6 years 10 months ago #153066 by andypugh
Replied by andypugh on topic VFD mb2hal
I would start with a mux4 component to send numbers to a register based on the spindlle-fwd and spindle-rev bit outputs.

linuxcnc.org/docs/2.8/html/man/man9/mux4.9.html

You may need to convert to int from float too. (conv_float_u32 component)

Please Log in to join the conversation.

More
6 years 10 months ago #153072 by Hakan
Replied by Hakan on topic VFD mb2hal
An alternative is to do bit to float conversion in two steps like this
Code:
loadusr -Wn aasd30A mb2hal config=Turner_spindle.ini # Start (or stop) the spindle. Comes "bit" needs "float". loadrt conv_bit_u32 loadrt conv_u32_float addf conv-bit-u32.0 servo-thread addf conv-u32-float.0 servo-thread net spindle-enable conv-bit-u32.0.in net spindle-enable-u32 conv-bit-u32.0.out conv-u32-float.0.in net spindle-enable-float conv-u32-float.0.out aasd30A.01.on
Not saying this is better than anything else, it is just another way.
One kind of whishes mb2hal could take a bit as input.

Please Log in to join the conversation.

More
6 years 10 months ago #153073 by andypugh
Replied by andypugh on topic VFD mb2hal
The reason I suggested mux was that it appears that the requirement is 18 for forward and 1 for stop?

Please Log in to join the conversation.

More
6 years 10 months ago #153090 by zajc3w
Replied by zajc3w on topic VFD mb2hal
Thanks.
Mux4 seems more legant way to doing it, just have to figure out syntax.

I'm beginning to think that modyfiing hy_ modbus driver might be asier than trying to understand how hal ticks...
Conversion of rpm to Hz is another one.
All need is to divide rpm by 6 and convert to integer. Can I just slap division by 6 in hal?

Please Log in to join the conversation.

Time to create page: 0.066 seconds
Powered by Kunena Forum