Hello Guest it is March 29, 2024, 08:09:10 AM

Author Topic: Lathe turret, VB, PLC, MODBUS, Position  (Read 16770 times)

0 Members and 1 Guest are viewing this topic.

Re: Lathe turret, VB, PLC, MODBUS, Position
« Reply #20 on: November 17, 2009, 06:07:51 PM »
Hood,  Normal, I am pretty sure.  I don;t think I am using a plug-in, but I am not sure what that is.

Dustin
Re: Lathe turret, VB, PLC, MODBUS, Position
« Reply #21 on: November 17, 2009, 06:16:00 PM »
Hi Dustin,

You probably need to start reading some of the Modbus specs, it will help with the understanding.

X are discrete inputs. They connect to the outside world.
Y are discrete outputs. They connect to the outside world.
C are internal coils. Thinkof them as temporary memory.

With the addressing, Modbus has 2 schemes. 'Hex' addressing and '984' addressing.

So in 984 format the first C1 bit coil is located at address 16385. In hex format, the address of C1 is 0x4000 which is 16384.

Try to write to coil 16384 from Mach3.

I know it sounds really weird, but in 984 addressing each data type is offset by a certain amount depending on its data type. It was initially to do with how PLCs used to be built.

Mach uses hex addressing but in decimal form. So hex 4000 is decimal 16384

Ad to the holding registers DS, there addresses start at 0000 hex.  or 400001 in 984.

I hope this is not to confusing.

Cheers,

Peter.







----------------------------------------------------
Homann Designs
http://www.homanndesigns.com
email: peter at homanndesigns.com
Re: Lathe turret, VB, PLC, MODBUS, Position
« Reply #22 on: November 17, 2009, 06:16:50 PM »
Hood,  Normal, I am pretty sure.  I don;t think I am using a plug-in, but I am not sure what that is.

Dustin

If you are using the Plugin, the modbus setup screen looks like a blue table.

Cheers,

Peter.
----------------------------------------------------
Homann Designs
http://www.homanndesigns.com
email: peter at homanndesigns.com

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Lathe turret, VB, PLC, MODBUS, Position
« Reply #23 on: November 17, 2009, 06:46:33 PM »
Ok I wont even pretend to understand half of what Peter has just said ;D
Heres how I do things, I use the special options as in the pic below, the start address for Inputs is set to 1025 which is decimal equiv of 2001 in octal (I think ;) ) The Outputs are started at 2048 which is decimal for 4000 octal. Been about 2 or 3 years since I read the PLC manual so I cant even remember how I came up with these and your PLC may be different.

Peter may be able to make sense of what I am trying to say and translate it ;)

Hood
Re: Lathe turret, VB, PLC, MODBUS, Position
« Reply #24 on: November 17, 2009, 06:58:24 PM »
Hi Hood,

What you are doing is sending the bits as holding  registers packed with 16 bits in each, rather than sending each bitseparately.

What you are doing is more efficient and requires the ladder in the PLC to extract the bits out of the holding register, or have a PLC that overlays the bits onto the holding registers. I don't think the click PLC does this. But, the ModIO does. :)

Cheers,

Peter.
----------------------------------------------------
Homann Designs
http://www.homanndesigns.com
email: peter at homanndesigns.com

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Lathe turret, VB, PLC, MODBUS, Position
« Reply #25 on: November 17, 2009, 07:04:40 PM »
Thanks Peter for the explanation :)
Dont know anything about the click as its fairly new on the scene and I tend to stick with the things I know as it means I dont have to read :)
I will however have to do some reading as I have just got a cheap D0-06DR with 4 analogue Input modules so I will need to read up on the analogue side of things :(

Hood
Re: Lathe turret, VB, PLC, MODBUS, Position
« Reply #26 on: November 17, 2009, 08:40:22 PM »
Hood,

It's good to use what you know. :)

The ModIP I'm designing will hopefully be an attractive alternation to commercial PLCs. I'm putting in a basic scripting language, so that if you can write macros in Mach3, then you should have no trouble doing it in the ModIP.

The other thing is that there will be many built in functions that will hopefully make it simpler to use. It should cater for building user interface modules as well as more traditional PLC uses such as tool changers etc.

Cheers,

Peter.
----------------------------------------------------
Homann Designs
http://www.homanndesigns.com
email: peter at homanndesigns.com
Re: Lathe turret, VB, PLC, MODBUS, Position
« Reply #27 on: November 18, 2009, 12:43:07 AM »
Peter, Hood,

Thanks so much for the help, I've got Mach talking nicely to the PLC now using the start address 16384.  Ive even managed to trigger a mini-ladder test program that toggles real outputs on the PLC from a VB script, progress!! 

Peter, the ModIP sounds really great, this is pretty confusing and I've got a fair bit of experience with electronics, and micro-controllers.  I'd hate to jump into this without any background....

I'm still not totally clear on the bit-packing options, but I may just stick with it the way it is, things seem to be working and if the CLICK will not unpack them properly anyway I'm OK with the inefficiency.

Thanks again, I'm going to experiment more with the script tomorrow.

Dustin


Re: Lathe turret, VB, PLC, MODBUS, Position
« Reply #28 on: November 18, 2009, 01:00:53 AM »
Dustin,

You would have to write ladder code to unpack them. What it means is that the data is transferred as a register rather than a coil (C). The advantage is that the Modbus messges are shorter , so don't worry about it at the moment, (or ever)

Cheers,

Peter.
----------------------------------------------------
Homann Designs
http://www.homanndesigns.com
email: peter at homanndesigns.com

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Lathe turret, VB, PLC, MODBUS, Position
« Reply #29 on: November 18, 2009, 05:59:25 AM »
The ModIP sounds interesting Peter, have  a link to any details?
Must admit though, I find ladders fairly easy to do and it the talking with the PC part that makes my head hurt ;D

Hood