Hello Guest it is March 29, 2024, 01:22:42 AM

Author Topic: modbus  (Read 8022 times)

0 Members and 1 Guest are viewing this topic.

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
modbus
« on: October 21, 2010, 05:02:58 AM »
Anyone know how to send a byte or a word or indeed anything from Mach VB to a modbus slave (direct access - not autopolling preferably)? I can happily read/write data from/to my slave's holding registers using the Mach modbus test interface - but how to do with VB?

The wiki teases us with this:

Quote
Direct access to Modbus registers

There are occasions when a VB Script writer needs direct access to Modbus device registers. This is provided by an interface which allows reading and writing of a block of one or more registers into Mach3 buffers (distinct from the autopoller buffers) and routines for accessing data in the buffers.

But sadly no mention that I can find of WHERE these elusive VB calls are documented.
Any seasoned modbus gurus out there?

Cheers

Ian

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: modbus
« Reply #1 on: October 21, 2010, 10:27:37 AM »
Ian , you need to contact Peter Holmann designer of the MODIO system  he is a Modbus Guru.

Last I heard the new Plugin Modbus is broken and no imediate plans to fix. The OLD serial system still works LAST I USED IT.

Seems most abandoned modbus for USB.  Shame really as MODBUS is one of the MOST used protocalls and USB well it is just USB(;-)

I can round up some info on the VB side for you if needed.

(;-) Tp

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: modbus
« Reply #2 on: October 21, 2010, 10:47:23 AM »
IAN look in the Mach wiki under Mach subfunctions it gives the basic VB  commands and syntax to talk to a modbus device. It shold be what you need.

(;-) TP

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: modbus
« Reply #3 on: October 21, 2010, 11:04:55 AM »
IAN look in the Mach wiki under Mach subfunctions it gives the basic VB  commands and syntax to talk to a modbus device. It shold be what you need.

(;-) TP
I'm currently ploughing through this BUT there doesn't seem to be anything other than using autopolling. There are hints that direct access is possible but no explanation of how. I'll keep reading.

All I want to be able to do is send an 8 bit DRO value to my THC when I hit a screen button (required torch voltage). I've looked at sendserial but there are issues that make it less than ideal. I thought modbus would be the way but now I'm not so sure - it seems to be about the most complex method imaginable to send a few bits of data.

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: modbus
« Reply #4 on: October 21, 2010, 03:30:37 PM »
I see your point. (;-) 

I used to have a good pendant that was Modio it worked great UNTILL someone changed something in MACH and it never worked right again.

What did not work about the send serial, that is an 8bit transfer.??

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: modbus
« Reply #5 on: October 21, 2010, 03:45:21 PM »
IAN I don't see any way to do a VB based direct write TO the modbus registers. You can only do a direct read FROM the modbus register to mach

The only way I see is to write  thru the autopolling method. I do know that works fine as that is the basis of the pendant I have.

Peter could tell you for sure. OR possibly SCOTT. I forgot about Scott.

(;-) TP

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: modbus
« Reply #6 on: October 22, 2010, 04:12:36 AM »
What did not work about the send serial, that is an 8bit transfer.??

The problem with sendserial is that it isn't session based. It opens the port, sends the data and closes the port again. The way I've designed the THC is that it treats a port open as the start of a session and resets the MCU. If sendserial is what I have to use then I'll re-jig this - just thought modbus might be the way but I'm going off it by the minute!

I agree it seems a read is trivial but not a write - strange. I may be wrong but I'm getting the feeling that Mach's modbus protocol is non-standard and has been fudged to work with particular hardware rather than with any general modbus slaves. I'll keep at it for a short while and see where I get.

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: modbus
« Reply #7 on: October 22, 2010, 10:17:33 AM »
Well the problem with a standard IS there are so many of them(;-).

It sounds as though the modbus is what you are needing as it is available ALL the time.

Many have used the Modbus to drive PLCs so it does work

Just a thought, (;-) TP


Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: modbus
« Reply #8 on: October 22, 2010, 11:30:37 AM »
Just a thought, looking at other THC they used the serial port BUT it seems to be a hybrid protocal that is done through a PLUGIN.

(;-) TP

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: modbus
« Reply #9 on: October 22, 2010, 01:40:31 PM »
I guess the first question IS what com protocol does your THC unit use to communicate.

(;-) TP