SPLat Logo

ModBus: Communication Control Blocks

NOTICE: SPLat Controls has moved. We are now at 1/85 Brunel Rd, Seaford, 3198. map

ModBus: Communication Control Blocks

Since this was written we have introduced Hash commands. The Open_Serial hash command make this much simpler to do.

ModBus is selected and configured via a suitable Communications Control Block (CCB). The following table summarizes the various parameters in the CCBs for ModBus. Entries are hyper-linked to detailed descriptions. If you are using a ModBus protocol you must set up a CCB with the specified parameters and then invoke it in your program with a ComSetCCB instruction.

The table contains a spare column so you can print it out and use it as a work sheet. Click on each entry to get a detailed expose.

Byte Slave RTU Master RTU Notes
0 1 2  
1

DevAddr

0  
2

CharProfile

CharProfile

 
3

BaudRate

BaudRate

 
4 Not used - set to 255  
5 Not used - set to 255  
6 Not used - set to 255  
7 Not used - set to 255  
8 Not used - set to 255  
9

MessageGap

MessageGap

 
10 0

QryTimeout

 
11 0

QryAttempts

 
12 Not used - set to 255  
13 Not used - set to 255  
14 Not used - set to 255  
15 Not used - set to 255  
16 Not used - set to 255  
17 Not used - set to 255  
18 Not used - set to 255  
19 Not used - set to 255  

Examples

The following table is a copy of the one above (with the master column removed) used as a worksheet for a slave.

Byte Slave RTU Example value
0 1 1
1

DevAddr

3
2

CharProfile

0 (8,1,N)
3

BaudRate

5 (9600)
4   Not used - set to 255
5   Not used - set to 255
6   Not used - set to 255
7   Not used - set to 255
8   Not used - set to 255
9

MessageGap

10 (x10mS = 100mS)
10

QryTimeout

0 (Not used in slave)
11

QryAttempts

0 (Not used in slave)
12   Not used - set to 255
13   Not used - set to 255
14   Not used - set to 255
15   Not used - set to 255
16   Not used - set to 255
17   Not used - set to 255
18   Not used - set to 255
19   Not used - set to 255

In your SPLat program this configuration would look like this:

                NVEM0           ;Start of NVEM data
ModBusCCB:
                NV0Byte         1       ;Protocol
                NV0Byte         3       ;Address
                NV0Byte         0       ;Character = 8,1,N
                NV0Byte         5       ;9600
                NV0Byte         255     ;Not used - set to 255
                NV0Byte         255     ;Not used - set to 255
                NV0Byte         255     ;Not used - set to 255
                NV0Byte         255     ;Not used - set to 255
                NV0Byte         255     ;Not used - set to 255
                NV0Byte         10      ;Message gap 100mS
                NV0Byte         100     ;Query timeout 1S
                NV0Byte         3       ;Query attempts
                NV0Byte         255,255,255,255,255,255,255,255 ;Not used - set to 255