Serial "Master Modbus Configure Port" Subroutine no available for PAC Controls


#1

I’m in the process of switching over from OptoControls to PAC Controls and everything have converted perfectly expect for the modbus subroutines. I notice there is a new modbus for PAC Controls and notice they dont have a configure port subroutine like my old strategy has.
I have downloaded the library “PAC-INT-MB-R9.3a” but it doesn’t seem to include the configure subroutine. This modbus is for serial communication, thanks.

OptoContorls Modbus ____________________________PACControls



#2

Not sure how the old modbus routines worked, but if you end up having to do a significant amount of work, I have a chart that may help you out. I’ve been using it for all my modbus communication that uses the current library. I’m not going to post it on here, as I would like it to be tested on more equipment first.

Configuration of the chart is like this:

//Comm Handles - You can set multiple comm handles to talk through different serial ports / TCP ports
SetCommunicationHandleValue("tcp:127.0.0.1:502", chModbus);
potModbusCommHandles[0] = &chModbus;
ntModbusCommType[0] = 2; //Comm Type: 0=Serial RTU, 1=Serial ASCII, 2=TCP
fModbusErrorValue=-32768;

And then I specify the modbus address and register I want to store in my PAC Control variable in a configuration string table with the following format (Example below)

Modbus Configuration Fields:

1- Interval (seconds),
2- Port Index (pointer table to the comm handle)
3- Device Address
4- Function Type: 1=Coil Status, 2=Input, 3=Holding Reg, 4=Input Reg
5- Starting Register Number
6- Data Type:
–0 = 16bit unsigned
–1 = 16bit signed
–2 = Floating Pt.
–3 = Floating Pt.(Swapped)
–4 = 32bit signed
–5 = 32bit signed(Swapped)
7- Multiplier - (0 to ignore and not store)
8- Storage variable name - Float, Int32 variables and tables supported
9- Allow Write: 0=Read Only, 1=Read/Write

Continuation Line
This is when the registers are consecutive, you ommit the first 5 parameters
1- * (asterisk indicates the this register number is one higher (or more depending on the previous data type) than the previous so we can do a read multiple
2- Data Type
3- Multiplier
8- Storage variable
9- Allow Write
*, Data type, Multiplier, Store Variable

Example:

stModbusReadConfiguration[0] = "1,0,1,3,1,0,.01,ntData[0],1"; //int16 holding register 1
stModbusReadConfiguration[1] = "*,1,.1,ntData[1],1";  //2
stModbusReadConfiguration[2] = "*,1,1,ntData[2],1"; //3
stModbusReadConfiguration[3] = "*,1,10,ntData[3],1"; //4
stModbusReadConfiguration[4] = "*,1,100,ntData[4],1";  //5
stModbusReadConfiguration[5] = "*,3,1.0,ftData[0],1"; //float holding register (32bit) 6
stModbusReadConfiguration[6] = "*,3,0.5,ftData[1],1"; //8
stModbusReadConfiguration[7] = "*,5,1,nData,1";  //int32 holding register 10
stModbusReadConfiguration[8] = "1,0,1,1,7,0,1,ntData[8],1";  //Coil 7
stModbusReadConfiguration[9] = "*,0,1,ntData[9],1";  //Coil 8
stModbusReadConfiguration[10] = "1,0,1,2,1,0,1,ntData[5],0"; //Digital Input 1
stModbusReadConfiguration[11] = "1,0,1,4,1,3,1,ftData[2],0"; //Input Register 1
stModbusReadConfiguration[12] = "";  //Last one must be empty string

From there I can read write to the PAC Control variables and the chart does the rest.

If this will help you, send me a PM with your e-mail address and I’ll send it over.


#3

This subroutine is not needed in PAC Control
In the setup block of the integration kit you will set a communication handle. This is all that is needed


#4

I documented my modbus read/write chart (which uses the 91i version of the integration kit) and it is available on my blog.


#5

Thank you for all of your help (your blog is super helpful), But I am not sure your blog post is for the most current Modbus tool kit. (I don’t have a pink “block 8” in my modbus master chart. I am using “Modbus R9.3a, July/2015” (just downloaded it 2-15-2016 to double check). Our “Master charts” look completely different.

What you have done is super helpful. I am wanting to poll 4 ABB drives over tcp to start/stop, change speeds, # of rotations, and perhaps get/reset faults.


#6

You’re right, just checked and I am using version 91i of the integration kit and it looks like there were a lot of changes to the subroutines on the 9.3a version. The chart I have that has the pink block 8 is not from the integration kit, it is a chart I made that uses the integration kit (91i version). If you download the zip file, it has the whole sample strategy which will have the 91i version of the subroutines.


#7

9.4a? Where is that version? I downloaded your sample and am going over it. It’s a lot to think about/digest. Now I will have to figure out what changes need to be made to use the updated kit.
Thanks again!


#8

Sorry, 9.3a.