modbus

More
29 Oct 2013 20:12 #40387 by btaindustrial
modbus was created by btaindustrial
Hi guys
My name is Flavio and I'm from Brazil
I need help on modbus + linuxcnc
I Santerno's VFD (RS 485) and I need to do communication "Modbus"
Could someone send me an example with "ini.file e hal.file" and whatever else is necessary so that I can understand how you do the setup

thank you very much :silly:

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

More
30 Oct 2013 06:52 #40411 by andypugh
Replied by andypugh on topic modbus
There is a sample HAL file here:
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...hb=refs/heads/master

Most of that should already be compiled and working if you install the "master" (development) branch following the instructions at buildbot.linuxcnc.org.

However, I think that things are much the same in the stable released branch, just without the helpful sample files.
The following user(s) said Thank You: btaindustrial

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

More
04 Nov 2013 05:01 #40522 by btaindustrial
Replied by btaindustrial on topic modbus
Thank you for your help
but my problem is complicated.
need "step by step" to install "vfs11"
I downloaded the files, read how to compile, compiled and failed.
I guess I did not install correctly. :(

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

More
04 Nov 2013 05:39 - 04 Nov 2013 05:39 #40524 by andypugh
Replied by andypugh on topic modbus

Thank you for your help
but my problem is complicated.
need "step by step" to install "vfs11"
I downloaded the files, read how to compile, compiled and failed.(


VFS11 is for a specific VFD, and might well not suit your hardware anyway.

But, first things first. What files did you download, what did you do with them, what did you expect to happen, and what actually happened?
Last edit: 04 Nov 2013 05:39 by andypugh.

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

More
04 Nov 2013 10:59 #40532 by btaindustrial
Replied by btaindustrial on topic modbus
I'm reworking a "milling center" 16 tools
3 axes (servo system)
16 tools tool changer
spindle: vfd rs485 modbus rtu
read rpm
read current
read write frequency
write on / off
write cw / ccw
read encoder
adress serial / dev/ttyUSB0
adress slave = 1
baudrate = 9600
parity = none
stopbit = 1
bitdata = 8



here in Brazil when we want to say thank you for a help
Valeu cara!
Attachments:

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

More
04 Nov 2013 19:59 #40536 by andypugh
Replied by andypugh on topic modbus
That's quite a machine.

Looking at the data sheet, I don't see a Write address for output frequency.

None of the existing Modbus VFD drivers seem to have the same register mapping, so you will either need to modify and recompile an existing component, or use the mb2hal component

I think using mb2hal is the easier approach, but you would need to move to the development (master) version of LinuxCNC.

The mb2hal code isn't particularly clearly documented at the moment. This seems to be it:
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...d00fdeffbd48;hb=HEAD
And here in the Wiki: wiki.linuxcnc.org/cgi-bin/wiki.pl?ModbusToHal

The Wiki page says that you need to compile LinuxCNC from source to run Master, but that isn't true, you can get it as a pre-compiled vesion by following the instructions at buildbot.linuxcnc.org

Be aware that you will be using the unreleased development version of LinuxCNC in this case, and bugs may exist.

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

More
04 Nov 2013 23:53 #40539 by btaindustrial
Replied by btaindustrial on topic modbus

That's quite a machine.

Looking at the data sheet, I don't see a Write address for output frequency.

Adress is 0x0004 frequency reference

ok?

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

More
06 Nov 2013 00:54 #40555 by andypugh
Replied by andypugh on topic modbus

Looking at the data sheet, I don't see a Write address for output frequency.

Adress is 0x0004 frequency reference

It says that that is a Read address.
The following user(s) said Thank You: btaindustrial

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

More
21 Nov 2013 20:16 - 22 Nov 2013 00:52 #41079 by btaindustrial
Replied by btaindustrial on topic modbus
hello
I did a serial communication with python, it works!
but i dont know how to make it interact with the linuxcnc
how do I get it to work with linuxcnc

example:

to enter the MDI "m3 sxxx"
take the value of "s" should be passed to the python
python and make communication with the VFD

#! /usr/bin/python
import linuxcnc
import minimalmodbus

vfd_sinus = minimalmodbus.Instrument('/dev/ttyS0', 1)
s = linuxcnc.stat()
s.poll()

#spindle speed

if s.spindle_speed < 0:
set_rpm = ((s.spindle_speed**-1)/0.30)
else :
set_rpm = (s.spindle_speed/0.30)

vfd_sinus.write_register(4, set_rpm, 0)

# on/off spindle

onoff = vfd_sinus.read_register(5, 0)
bin_onoff = bin(onoff)
spindle_cmd = s.mcodes[2]
if spindle_cmd == 3 :
set_onoff = int(bin_onoff[2:12] + '0' + '1'+ '0', 2)
if spindle_cmd == 4 :
set_onoff = int(bin_onoff[2:12] + '1' + '0'+ '0', 2)
if spindle_cmd == 5 :
set_onoff = int(bin_onoff[2:12] + '0' + '0'+ '1', 2)

vfd_sinus.write_register(5, set_onoff, 0)
Last edit: 22 Nov 2013 00:52 by btaindustrial.

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

Time to create page: 0.159 seconds
Powered by Kunena Forum