Hello Guest it is January 17, 2022, 11:16:13 PM

Author Topic: Allen Bradley micro logix and Modbus  (Read 18778 times)

0 Members and 1 Guest are viewing this topic.

Re: Allen Bradley micro logix and Modbus
« Reply #10 on: December 09, 2008, 04:00:58 PM »
Peter,

 Yes I see what you mean and i tried It the other way and still no luck


Is there any modbus VB script examples I saw the video in the feed pot  but i may need something more to fall back on


A couple of things to try:

1.  Change the address 40001 to 40005. THis is because plc addressing subrtracts 1 sometimes.
2.  Change the address 40001 to 5. This is because holding registers are in the range 40000 ->


Cheers,


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

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Allen Bradley micro logix and Modbus
« Reply #11 on: December 09, 2008, 08:16:39 PM »
Here is the VB for accessing serial

Function: GetInBit(buffIndex, Bit Number) as Integer
  Function: SetOutBit(buffIndex, Bit Number) as Integer
  Function: ResetOutBit(buffIndex, Bit Number) as Integer
GetInBit(BuffIndex, BitNumber) to use this one, Index number is 0-63 on channel one, and 64-127 on Channel 2, and BitNumber is 0-15 relating to the individual bit status in that word that you want, i.e. 0 or 1. See the Input section of config autopoller modbus. NOTE If you are using Bit packing special control then you can only Use the GetInBit on the 2cd channel 64-127. You have to use something like "IsActive(INPUT1)" on channel 1. If you don't use bit packing then you can use it with the 1st channel.
SetOutBit(BuffIndex, BitNumber) to use this one, Index number is 0-63 on channel one, and 64-127 on Channel 2. and BitNumber is 0-15 relating to the individual bit status in that word that you want, It Turns the bit ON!!. See the Output section of config autopoller modbus. NOTE If you are using Bit packing special control then you can only Use the SetOutBit on the 2cd channel 64-127. You have to use something like "ActivateSignal(OUTPUT1)" on channel 1. If you don't use bit packing then you can use it with the 1st channel.
ReSetOutBit(BuffIndex, BitNumber) is just like SetOutBit(BuffIndex, BitNumber) above, but it turns the requested bit OFF.


GetMasterInput(0-1023)
GetMasterOutput(0-1023)

SetMasterOutput(0-1023, 0-16bit)

SetMasterInput(0-1023, 0-16bit)

scott
fun times
Re: Allen Bradley micro logix and Modbus
« Reply #12 on: December 10, 2008, 08:33:00 AM »


So to use VB script calls the does modbus still has to be configured?


Adam

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Allen Bradley micro logix and Modbus
« Reply #13 on: December 10, 2008, 09:35:10 AM »
Use these if your using the "Serial Plugin Enabled" Modbus:

GetMasterInput(0-1023)
GetMasterOutput(0-1023)

SetMasterOutput(0-1023, 0-16bit)

SetMasterInput(0-1023, 0-16bit)

YES, you have to set up the Modbus config to communicate with your PLC.

scott
fun times

Offline KTM

*
  •  92 92
    • View Profile
Re: Allen Bradley micro logix and Modbus
« Reply #14 on: December 10, 2008, 09:39:50 AM »
Make sure that your plc comms protocol is set up as RTU 57600,8,1,N

In Mach modbus under special control select input word - 16 bits.
In ports and pins select modbus I/O support.

Regards

KTM

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Allen Bradley micro logix and Modbus
« Reply #15 on: December 10, 2008, 03:52:32 PM »
KTM:

Actually the Modbus protocol was fixed by Art to: 8,2,N, even if you type in 8,1,N the Sepia modbus module changes it to 8,2,N (that as the last I was told by Art himself
at the Galesburg 2 annual workshop.

scott
fun times
Re: Allen Bradley micro logix and Modbus
« Reply #16 on: December 10, 2008, 09:00:35 PM »
I an trying to do some scripting and getting off to a slow start Is there a good way to see if the registers are beaning read
with out setting up screen
 
here is some code i have been trying with no luck
ModTest = GetInput(64)
Call SetUserDRO(39 , ModTest )

I could also use more clarification on these please
"IsActive(INPUT1)"
ActivateSignal(OUTPUT1)"
Adam

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Allen Bradley micro logix and Modbus
« Reply #17 on: December 10, 2008, 11:41:43 PM »
to write to 39 from the modbus you need to put in this VB to run at least Once in your init at start up, or once in your macropump: SetParam( "RPMOverRide" , 1 )

To check your registers on inputs and outputs, Use the "Mach Brains" and make you a Modbus input and output testing Brian to see your IO
GetINPUT(64) is for the "Old style" serial modbus, you need to enable Modbus support and serial plugin modbus under ports;pins

"IsActive(INPUT1)"  = this will return a 1 if that signal is on, 0 if off

ActivateSignal(OUTPUT1)"  will activate OUTPUT1
DeActivateSignal(OUTPUT1)"  will deactivate OUTPUT1
fun times