MB2HAL Vacon vfd

More
6 years 11 months ago #150412 by stes
Replied by stes on topic MB2HAL Vacon vfd
I think function code 06 is valid because someone is using it.

Did you check the pdf I linked in the first post? My VFD doesn't support function code 15. Only codes 03, 04, 06 and 16 are supported.

If i have understood correctly, there are no coils to write. But I have to send a control word, and the first 3 bits of that control word will control the spindle.

Please Log in or Create an account to join the conversation.

More
6 years 11 months ago - 6 years 11 months ago #150428 by Todd Zuercher
Replied by Todd Zuercher on topic MB2HAL Vacon vfd
I meant that I don't think Mb2hal supports mode 06, because it isn't mentioned in the Mb2hal documentation. I think it can still work but it will make setting up your hal file a bit more difficult. Just use mode 16 instead of 06. This will be for registers that you are writing to (not reading). You will need to use a weighted_sum component to convert your bit inputs into an S32 integer, then convert that S32 into a float using conv_s32_float, then connect the output of the s32 conversion to the nessisary input of Mb2hal.

Perhaps it might be simpler for you to do all of this including the Modbus communication within Classicladder. (it can do Modbus as well.)
linuxcnc.org/docs/2.6/html/ladder/classic_ladder.html#_modbus
I believe it does support 06.
I would have used it in my configuration except that I needed to do more transactions than it could handle (limit is 16 I think and I needed 32.) I did use Classic ladder's modbus for my initial testing with just a couple VFDs. It was much simpler to configure and get working than Mb2hal.
Last edit: 6 years 11 months ago by Todd Zuercher.

Please Log in or Create an account to join the conversation.

More
6 years 5 months ago - 6 years 5 months ago #167960 by stes
Replied by stes on topic MB2HAL Vacon vfd
It's working now, except when spindle is reversed the pyVCP bar shows the rpm wrong, it's 60 000 instead of 5000. Guess it's because the rpm scale from vfd is +/-. Is the some way to convert it to get the correct rpm reading?

I didn't try Classicladder because not familiar with it.

I leave the code here, maybe it's useful for someone else. And if you use Vacon remember to subtract 1 from the address number.
Code:
[MB2HAL_INIT] INIT_DEBUG=0 SLOWDOWN=0.0 TOTAL_TRANSACTIONS=3 [TRANSACTION_00] LINK_TYPE=serial SERIAL_PORT=/dev/ttyUSB0 SERIAL_BAUD=9600 SERIAL_BITS=8 SERIAL_PARITY=none SERIAL_STOP=1 SERIAL_DELAY_MS=150 MB_SLAVE_ID=1 FIRST_ELEMENT=2104 NELEMENTS=1 MB_TX_CODE=fnct_03_read_holding_registers MB_RESPONSE_TIMEOUT_MS=500 MB_BYTE_TIMEOUT_MS=500 HAL_TX_NAME=rpm MAX_UPDATE_RATE=0.0 [TRANSACTION_01] FIRST_ELEMENT=2000 NELEMENTS=1 MB_TX_CODE=fnct_16_write_multiple_registers HAL_TX_NAME=control MAX_UPDATE_RATE=0.0 [TRANSACTION_02] FIRST_ELEMENT=2002 NELEMENTS=1 MB_TX_CODE=fnct_16_write_multiple_registers HAL_TX_NAME=speed MAX_UPDATE_RATE=0.0
Code:
# Include your customized HAL commands here # This file will not be overwritten when you run stepconf again loadusr -W mb2hal config=mb2hal.ini loadrt mult2 loadrt mux4 loadrt and2 count=2 loadrt near addf mult2.0 servo-thread addf mux4.0 servo-thread addf and2.0 servo-thread addf and2.1 servo-thread addf near.0 servo-thread setp mult2.0.in0 31.25 #320 x 31.25 = 10 000 net spindle-cmd-rps-abs => mult2.0.in1 net speed.vfd mb2hal.speed.00 <= mult2.0.out net spindle-cmd-rps-abs <= motion.spindle-speed-out-rps-abs net S-on and2.0.in0 <= motion.spindle-on net S-fwd and2.0.in1 <= motion.spindle-forward net S-on and2.1.in0 net S-rev and2.1.in1 <= motion.spindle-reverse net S-on-fwd mux4.0.sel0 <= and2.0.out net S-on-rev mux4.0.sel1 <= and2.1.out setp mux4.0.in0 4 #100stop setp mux4.0.in1 5 #101forward setp mux4.0.in2 7 #111reverse setp mux4.0.in3 4 #100reset net control mb2hal.control.00 <= mux4.0.out net rpm-abs motion.spindle-speed-out-abs => near.0.in1 #spindle rpm command net rpm.vfd => near.0.in2 #spindle rpm from vfd net spindle-at-speed motion.spindle-at-speed <= near.0.out setp near.0.scale 1.02
Code:
# Include your customized HAL commands here # The commands in this file are run after the AXIS GUI (including PyVCP panel) starts net rpm.vfd mb2hal.rpm.00.float => pyvcp.spindle-speed net spindle-at-speed => pyvcp.spindle-at-speed
Code:
<?xml version="1.0" encoding="UTF-8"?> <pyvcp> <labelframe text="VFD"> <font>("Helvetica",10)</font> <table> <tablerow/> <tablesticky sticky="w"/> <label> <text>"Spindle at speed:"</text> </label> <tablesticky sticky="e"/> <led> <halpin>"spindle-at-speed"</halpin> <size>"10"</size> <on_color>"green"</on_color> <off_color>"red"</off_color> </led> <tablerow/> <label> <text>" "</text> </label> </table> <table> <tablesticky sticky="nsew"/> <tablerow/> <tablesticky sticky="nsew"/> <label> <text>"Spindle Speed (RPM)"</text> <font>("Helvetica",10)</font> </label> <tablerow/> <tablesticky sticky="nsew"/> <label> <text>" "</text> <font>("Helvetica",2)</font> </label> <tablerow/> <tablesticky sticky="nsew"/> <bar> <halpin>"spindle-speed"</halpin> <min_>5000</min_> <max_>19200</max_> </bar> </table> </labelframe> </pyvcp>
Last edit: 6 years 5 months ago by stes.

Please Log in or Create an account to join the conversation.

Time to create page: 0.164 seconds
Powered by Kunena Forum