Hello Guest it is November 22, 2019, 09:08:33 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - markgeigel

Pages: 1
Later this weekend I'm going to implement all the stuff you did with Zuxztah in this thread: http://www.machsupport.com/forum/index.php/topic,34023.0.html

After that I guess I'll have to revisit the E-Stop situation a bit.



Don't ask me why ask Hitachi :)

Anyway as it turns out (verified all this with a tachometer) the Hitachi NE-S1 has two registers for the frequency but you have to set the high order one to zero and then populate the low order one with the desired frequency 0-400hz multiplied by 100. So for the full 24,000 RPM on my router you just stuff the 40000 into the low register and the VFD treats it like an unsigned integer and it works fine. I guess they allocated two registers just to be safe and allow for future products. None of this is documented in the Hitachi manual of course other than the fact that there are two registers and that the resolution is .01 HZ.

I still have to hook up the VFD trip stuff so that Mach knows when the VFD throws and error.

Getting closer, fun fun fun.



I have not tried using the alias yet. That does indeed make the spindle spin. On the hitachi the frequency is from 0-40000 via modbus since the resolution is .01 hz. It works fine with the frequency <32767 but when I try to use something closer to 24,000 RPM of course then I need the 2nd register value to be updated. So far when I do that I get an error from the VFD I need to look at that a bit more. But it's working a LOT better. Thanks and I'll post something again when I get this all working since I'm sure there are other Hitachi VFD people who will want to do this.

Thanks again


Nice catch. Makes perfect sense. I'm away from the machine right now but I'll try it over the weekend and I really appreciate the help

you rock :)


Hi Craig:

Now we are on the same page. Simpson36 who seems to have worked a lot with modbus asked the same question in a previous thread but then 2 hours later said "never mind, figured it out" but never posted what he figured out :)

but on the hitachi the coil numbers are 1 and 2 and guess what that is the same address used for the setFrequency register so unless there is some addressing translation scheme that I don't know about I'm stuck.

Here was the thread asking the same question from Simpson367 https://www.machsupport.com/forum/index.php/topic,27158.msg209066.html#msg209066

forgot to add these screenshots

Hi Craig:

See attached files. I have a working modbus connection to the VFD but I'm only able to set register values not coil values.

In the screenshots my setFrequency function I defined in Configure/Modbus causes Mach4 to automatically create the spndlFrequency0 and spndlFrequency1 registers. The script in the screenshot (most of which you wrote lol) does indeed set the frequency in the VFD and it then appears in the modbus diagnostic window and registers diagnostics window when I press the button that the script is attached to. I set the register value and it gets sent to the VFD without error.

So registers work fine for me with the VFD from what I can tell.

What I don't know how to do is change the coil value from 0 to 1

Mach does not create a register that I can get an instance to in LUA script for me for the coil like it does for the write register function.

to make my test button start the spindle I need to do the following

1) set the frequency (I have that working since it uses registers and I now know how to do that)

2) Set the direction by writing to coil 2 either a 1 or 0 depending on if I want fwd or rev

3) set the spindle to run by writing a 1 to coil 1 (that is my sop/run function I have defined in modbus)

I don't know how to do steps 2 or 3 show me some code obi-wan

Sorry for being a pain.



If I press the button that executes the script in the screenshot I do see the spndlFrequency0 and spndlFrequency1 values change in the modbus tree on the register diagnostics and I also see them change in the diagnostic window for Modbus (see screenshot)

So I have registers working but don't know how to set a coil to 0 or 1 in LUA after I have it the function defined in modbus

is that any clearer?

Hi Craig:

I have done that already. When you do that for a register in modbus you automatically get an instance variable that you can access in LUA. But when you do the same thing for a coil you don't. So the question is once you have the write coil function defined in Modbus how do you actually set it's value in LUA?



Hi Craig:

I have modbus communicating to the VFD, I can write a frequency to the VFD because that uses the write registers function. And that function when setup in Configure/Modbus automatically creates an instance register that I can access from LUA. And that is working. However the write coil function which is just working on a bit field when setup in modbus does not create any kind of variable automatically. So I don't know how to tie that to my LUA script. I went through all the scripts you did when you helped someone else get a VFD working but he was using only registers. My NES1 needs coils for stop/run and direction but uses registers for the frequency setting.
I really appreciate the help.


Mach4 General Discussion / writing modbus coils using LUA for Mach4? how?
« on: October 13, 2017, 01:36:13 PM »
I'm interfacing build 3481 of Mach4 to a Hitachi NES1 VFD. I've got them communicating and I can write registers fine from LUA. What I can't seem to do is write coils from LUA since Mach4 does not create registers for coils how do I access it from LUA?



Pages: 1