yeah you have the chip. your vfd # is listed on the manual I have.
there is a thread here somewhere with the manual posted, find it if you havent already.
copy all your vfd settings down as a backup!
install the software listed earlier (scotta's if you have older emc2) (one I posted if you have linuxcnc2.5)
to do this copy hy_vfd to /usr/bin
copy config files to your machine config folder.
run hy_vfd at command line to see all options.
you will have to set data communication settings to match vfd parameters.
you will have to comment out a line in your machine.hal file, look on earlier page. Depending on your vfd settings you may have to change a line in the source code and recompile, to get speed settings right, or I can post it up later.
make copies of the config files in the zip, some of them get overwritten if you run stepconf.
let me know if you have problems.
CNC, Mechatronics Integration and Custom Machine Design
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.
I'm haven't read on how any of that translates, but if you look 2 posts down from what you quoted, it is said that there is a misprint in the data field.
The manual that has been circulating in 99% the manual for another brand which I'm guessing uses the same control board and the Huanyang. Only the PD function code set is different. In the example in the manual the first data is 00H this should be 03H (PD003).
I see the data field is apparently correct, i.e. 00 0B B8 equates to 3000d or 30.00hz.
But what I have gathered from the manual and another source, FUNC is =1 for READ_DATA, = 2 for WRITE_DATA, = 3 FOR WRITE CONTROL, = 4 READ STATUS, = 5 WRITE INV. FREQ.
But what I do not see is where the ADDRESS of the data is indicated, IOW, where the location of the data is, as it is in the True Modbus method?
Address a discrete bit etc?
I agree with another poster that mentioned the Huanyang 'Engineers' must have been on something when they attempted Modbus.
Al.
CNC, Mechatronics Integration and Custom Machine Design
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.
ok maybe when he meant change 00H to 03H it was a miscorrection of a misprint.Code:ADDR FUNC LEN DATA CRC 01H 02H 03H 00H 0BH B8H 7FH 0CH
What makes sense to me would be
03H = pd003 is the addressCode:ADDR FUNC LEN DATA CRC 03H 02H 03H 00H 0BH B8H 7FH 0CH
02H = write data (going off what you wrote)
03H = length, 3 bytes
00H 0BH B8H = 30.00 hz
so the first field would be the address.
Is that what you meant?
Correct, The first field of 03H is the address of the VFD or system on the BUS.
In Modbus, when you want to address a certain bit in a word, the word address is also addressed, how is that shown in Huanyang?.
Modbus for reading a bit or coil. See Function 1 & Function 2
Modbus description
Al.
CNC, Mechatronics Integration and Custom Machine Design
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.
Ok I think I had it wrong, the first field should be the comm address of the vfd.
as far as the data, perhaps the first byte is the parameter (ie 03H = pd003) and the second and third byte are the actual data. (0BH B8H = 3000)
this is the manual I am looking at, start @ page 62.
It is really a mess, I'm suprised anyone was able to make anything work from their poor explanations.
what are you working on?
Hi everyone. I have recently got all of this almost working with RS-485 and the huanyang VFD. I'm currently experiencing the problem where the RPM is actually 8x higher than specified. I know where I need to change the source code but I can't for the life of me install the deps needed to compile. alan_3301, can you upload the binary with the fix you made?
Many thanks.
sudo apt-get install linuxcnc-dev
run that and it will get all the sources you need, or there maybe others you need too, cant remember.
Here is the file I am running. run it in the terminal with --help to see all the options.
It assumes some defaults that you can specify, I'm not sure if I changed any of the defaults (in the source) when I was testing.
hy_vfd.txt
remove the .txt extension
Many thanks. Yes I attempted that but get the message "can't find package linuxcnc-dev" or something to that effect. Have checked the sources and they have linuxcnc specific ones in there so I'm not sure. I attempted to get it from git and compile which worked but then I couldn't "make install", something about a standalone build. Anyway it was late and my linuxcnc install probably needs wiping to get it up to date with 2.5.1 (I'm on 2.5.0) anyway. Thanks for the upload.
Hi Scotta, how are you?
Came across yours usr_comp for these chinesse spindle vfd, for Linuxcnc.
This is my humble way to show appreciation for your efforts in develop and share, many thanks.
Your work in implementing the solution for non compilant modbus VFD, shows a remarkable combination of knowledge
patience & dedication, every day i ask myself if i honour my given life doing things in that way.
Are you interested in share this in linuxcnc git repositories for everyone to know your work?
Regards
Rick
PS:scotta if you think there are something i could do for you please let me know.
PS1: this is a copy of my private msg to scotta but their msg quota is full, someone know if he is doing well?
Also here is a newer Huanyang/Modbus plug in for Mach3.
A new Huanyang VFD plugin
Al.
CNC, Mechatronics Integration and Custom Machine Design
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.
Hi all,
first I would like to say thanks to Scott and alan_3301 for their work.
I have now spent a fair deal of time trying to get the spindle control working. I´m now at an end point. First I would like to clarify that I have been able to use the VFD plugin in Mach3 with no problem. So I know that the usb to rs485 converter is working and I have connceted the Gnd, Rx and Tx correctly to my VFD.
My main CNC program is LinuxCNC so I would like to eliminate Mach3. I´m using ubuntu 10.04 with LinuxCNC 2.5.3.
I have installed linuxcnc-dev successfully and when I try to install the hy_vfd from alan_3301 using make && make install I get this
I can run LinuxCNC without any errors but I´m not able to the get spindle gui on the right as I have seen in one of the screens shots.root@magnus-desktop:~/Downloads/hy_vfd-1.0beta-linuxcnc2.5# make $$ make install
Makefile:27: warning: overriding commands for target `install'
/usr/share/linuxcnc/Makefile.modinc:73: warning: ignoring old commands for target `install'
Makefile:42: warning: overriding commands for target `clean'
/usr/share/linuxcnc/Makefile.modinc:70: warning: ignoring old commands for target `clean'
make: *** No rule to make target `6685'. Stop.
root@magnus-desktop:~/Downloads/hy_vfd-1.0beta-linuxcnc2.5#
When I run hy_vfd in /usr/bin I get
After fixing the memory problem with ulimit -l 20480 and run hy_vfd againroot@magnus-desktop:/usr/bin# hy_vfd
hy_vfd: device='/dev/ttyS0', baud=19200, bits=8, parity='even', stopbits=1, address=1, verbose=1, PID=1970
Opening /dev/ttyS0 at 19200 bauds (even)
RTAPI: ERROR: could not open shared memory (errno=2)
RTAPI: Locked memory limit is 64KiB, recommended at least 20480KiB.
This can cause the error 'could not open shared memory'.
For more information, see
LinuxCNC Documentation Wiki: LockedMemory
Segmentation fault
listing ttyroot@magnus-desktop:/usr/bin# hy_vfd
hy_vfd: device='/dev/ttyS0', baud=19200, bits=8, parity='even', stopbits=1, address=1, verbose=1, PID=1987
Opening /dev/ttyS0 at 19200 bauds (even)
RTAPI: ERROR: could not open shared memory (errno=2)
Segmentation fault
I have tried to change the tty in custom.hal to ttyS0, ttyS1 and ttyUSB0 with no noticeable affect.root@magnus-desktop:/usr/bin# dmesg | grep tty
[ 0.000000] console [tty0] enabled
[ 0.275279] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[ 0.275678] 00:08: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[ 0.275909] 0000:00:03.3: ttyS1 at I/O 0x1128 (irq = 17) is a 16550A
[ 12.161354] usb 3-1: FTDI USB Serial Device converter now attached to ttyUSB0
root@magnus-desktop:/usr/bin#
Any suggestions?
Thanks,
Magnus
run these commands and post the results.
uname -a
dmesg
(not that I know how to interpret the results)
The main problem right now is the segmentation fault. which makes me think the binary is incompatible with your system.
I'd probably work on getting the source to compile. Have you installed build dependencies? Do you have gcc installed?
try these commands
sudo apt-get build-dep linuxcnc
sudo apt-get build-dep linuxcnc-dev
then retry build command "sudo make && make install"
Hopefully something in there will help you, I'm rusty with my linux and linuxcnc. I need to fire up the router and get familiar with it again.
Thanks for the reply and help alan_3301.
I have tried what you suggested. I still have the same problem. Below are the results. I have thought about reinstall ubuntu 10.04 with LinuxCNC but I can´t really see if that would help. Any ideas?
root@magnus-desktop:~# uname -a
Linux magnus-desktop 2.6.32-122-rtai #rtai SMP Tue Jul 27 12:44:07 CDT 2010 i686 GNU/Linuxroot@magnus-desktop:~# dmesg
[245752.067333] VFS: busy inodes on changed media or resized disk sr0
[245753.067319] VFS: busy inodes on changed media or resized disk sr0
[245753.071109] VFS: busy inodes on changed media or resized disk sr0
[245753.116702] RTAI[math]: unloaded.
[245753.135327] SCHED releases registered named ALIEN RTGLBH
[245753.174359] RTAI[malloc]: unloaded.
[245753.272036] RTAI[sched]: unloaded (forced hard/soft/hard transitions: traps 0, syscalls 0).
[245753.274334] I-pipe: Domain RTAI unregistered.
[245753.274376] RTAI[hal]: unmounted.
[245754.067038] VFS: busy inodes on changed media or resized disk sr0root@magnus-desktop:~# sudo apt-get build-dep linuxcnc
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.rroot@magnus-desktop:~# sudo apt-get build-dep linuxcnc-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Picking 'linuxcnc' as source package instead of 'linuxcnc-dev'
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.oot@magnus-desktop:~/Downloads/hy_vfd-1.0beta-linuxcnc2.5# sudo apt-get install gcc
Reading package lists... Done
Building dependency tree
Reading state information... Done
gcc is already the newest version.
The following packages were automatically installed and are no longer required:
user-setup localechooser-data
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.root@magnus-desktop:~/Downloads/hy_vfd-1.0beta-linuxcnc2.5# sudo make && make install
Makefile:27: warning: overriding commands for target `install'
/usr/share/linuxcnc/Makefile.modinc:73: warning: ignoring old commands for target `install'
Makefile:42: warning: overriding commands for target `clean'
/usr/share/linuxcnc/Makefile.modinc:70: warning: ignoring old commands for target `clean'
make: Nothing to be done for `default'.
Makefile:27: warning: overriding commands for target `install'
/usr/share/linuxcnc/Makefile.modinc:73: warning: ignoring old commands for target `install'
Makefile:42: warning: overriding commands for target `clean'
/usr/share/linuxcnc/Makefile.modinc:70: warning: ignoring old commands for target `clean'
cp hy_vfd /usr/bin
Did you have to change any settings to enable a root account? Is that your normal account?
I know that ubuntu doesnt normally use root for anything you need to do, that's what sudo is for.
Just a guess, but try it from a user account.
Also your first result from "make && make install" was "*** No rule to make target `6685'. Stop."
The second result was that it copied the file .
That seems weird.
I just run a root by the command sudo gnome-terminal. I usually do this when I need to copy files or folders in the file system since I often get permission denied when running from user account only.
I have tried the make && make install from both a root and user, below is the results.
1magnus@magnus-desktop:~/Downloads/hy_vfd-1.0beta-linuxcnc2.5$ sudo make && make install
[sudo] password for magnus:
Makefile:27: warning: overriding commands for target `install'
/usr/share/linuxcnc/Makefile.modinc:73: warning: ignoring old commands for target `install'
Makefile:42: warning: overriding commands for target `clean'
/usr/share/linuxcnc/Makefile.modinc:70: warning: ignoring old commands for target `clean'
make: Nothing to be done for `default'.
Makefile:27: warning: overriding commands for target `install'
/usr/share/linuxcnc/Makefile.modinc:73: warning: ignoring old commands for target `install'
Makefile:42: warning: overriding commands for target `clean'
/usr/share/linuxcnc/Makefile.modinc:70: warning: ignoring old commands for target `clean'
cp hy_vfd /usr/bin
cp: cannot create regular file `/usr/bin/hy_vfd': Permission denied
make: *** [install] Error
It seems that it can not copy the hy_vfd file when in user account due to permission access.root@magnus-desktop:~/Downloads/hy_vfd-1.0beta-linuxcnc2.5# make && make installMakefile:27: warning: overriding commands for target `install'
/usr/share/linuxcnc/Makefile.modinc:73: warning: ignoring old commands for target `install'
Makefile:42: warning: overriding commands for target `clean'
/usr/share/linuxcnc/Makefile.modinc:70: warning: ignoring old commands for target `clean'
make: Nothing to be done for `default'.
Makefile:27: warning: overriding commands for target `install'
/usr/share/linuxcnc/Makefile.modinc:73: warning: ignoring old commands for target `install'
Makefile:42: warning: overriding commands for target `clean'
/usr/share/linuxcnc/Makefile.modinc:70: warning: ignoring old commands for target `clean'
cp hy_vfd /usr/bin
What I don't understand is this
Searching the internet and found thiswarning: overriding commands for target `install'Another thing, when I now run linuxcnc I get this errorwarning: ignoring old commands for target `xxx''
GNU make allows commands to be specified only once per target (except for double-colon rules). If you give commands for a target which already has been defined to have commands, this warning is issued and the second set of commands will overwrite the first set.
I'm lostPrint file information:
RUN_IN_PLACE=no
LINUXCNC_DIR=
LINUXCNC_BIN_DIR=/usr/bin
LINUXCNC_TCL_DIR=/usr/lib/tcltk/linuxcnc
LINUXCNC_SCRIPT_DIR=
LINUXCNC_RTLIB_DIR=/usr/realtime-2.6.32-122-rtai/modules/linuxcnc
LINUXCNC_CONFIG_DIR=
LINUXCNC_LANG_DIR=/usr/share/linuxcnc/tcl/msgs
INIVAR=inivar
HALCMD=halcmd
LINUXCNC_EMCSH=/usr/bin/wish8.5
LINUXCNC - 2.5.3
Machine configuration directory is '/home/magnus/linuxcnc/configs/CNCdtu'
Machine configuration file is 'CNCdtu.ini'
INIFILE=/home/magnus/linuxcnc/configs/CNCdtu/CNCdtu.ini
PARAMETER_FILE=linuxcnc.var
TASK=milltask
HALUI=
DISPLAY=axis
Starting LinuxCNC...
Starting LinuxCNC server program: linuxcncsvr
Loading Real Time OS, RTAPI, and HAL_LIB modules
Starting LinuxCNC IO program: io
Starting TASK program: milltask
Starting DISPLAY program: axis
Shutting down and cleaning up LinuxCNC...
Killing task linuxcncsvr, PID=1913
Killing task milltask, PID=1995
Removing HAL_LIB, RTAPI, and Real Time OS modules
Removing NML shared memory segments
Cleanup done
Debug file information:
Can not find -sec MOT -var MOT -num 1
Can not find -sec IO -var IO -num 1
Can not find -sec LINUXCNC -var NML_FILE -num 1
Can not find -sec EMC -var NML_FILE -num 1
custom_postgui.hal:17: Pin 'pyvcp.spindle-speed' does not exist
1913
PID TTY STAT TIME COMMAND
1995
PID TTY STAT TIME COMMAND
Stopping realtime threads
Unloading hal components
Kernel message information:
[ 636.358639] I-pipe: Domain RTAI registered.
[ 636.358645] RTAI[hal]: <3.8.1> mounted over IPIPE-NOTHREADS 2.6-03.
[ 636.358648] RTAI[hal]: compiled with gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) .
[ 636.358681] RTAI[hal]: mounted (IPIPE-NOTHREADS, IMMEDIATE (INTERNAL IRQs DISPATCHED), ISOL_CPUS_MASK: 0).
[ 636.358684] PIPELINE layers:
[ 636.358686] fc77ce20 9ac15d93 RTAI 200
[ 636.358689] c085cb20 0 Linux 100
[ 636.377475] RTAI[malloc]: global heap size = 2097152 bytes, <BSD>.
[ 636.377672] RTAI[sched]: IMMEDIATE, MP, USER/KERNEL SPACE: <with RTAI OWN KTASKs>, kstacks pool size = 524288 bytes.
[ 636.377678] RTAI[sched]: hard timer type/freq = APIC/16612721(Hz); default timing: periodic; linear timed lists.
[ 636.377681] RTAI[sched]: Linux timer freq = 250 (Hz), TimeBase freq = 2126235000 hz.
[ 636.377684] RTAI[sched]: timer setup = 999 ns, resched latency = 2943 ns.
[ 636.377759] RTAI[usi]: enabled.
[ 636.424066] RTAI[math]: loaded.
[ 636.483604] config string '0x378 out '
[ 640.750905] RTAI[math]: unloaded.
[ 640.771047] SCHED releases registered named ALIEN RTGLBH
[ 640.800273] RTAI[malloc]: unloaded.
[ 640.900273] RTAI[sched]: unloaded (forced hard/soft/hard transitions: traps 0, syscalls 0).
[ 640.903001] I-pipe: Domain RTAI unregistered.
[ 640.903039] RTAI[hal]: unmounted.
custom_postgui.hal:17: Pin 'pyvcp.spindle-speed' does not exist
That is why linuxcnc won't start up. Did you copy the necessary lines over to custompanel.xml?
As far as the permissions, I don't know what would cause that, but I've never had to use root with ubuntu, only sudo from user account.
It may be worth starting from scratch. The binary won't run, make fails, and the permissions issue, a fresh install may be what you need.
one more thing, I guess make will only run once unsuccessfully.
do this:
make clean
sudo make && make install
see if there are still errors.