Support Forums
Capturing all MODBUS traffic via serial

Hi,

I have an application where I need to "sniff", and log all MODBUS traffic on RS485 2-wire. The application that DT80 will be used will have one MODBUS Master, and 4 MODBUS Slave Devices.

DT80 will ONLY monitor the link and log the data. The link runs at 9600 baud. The MODBUS Master only will request one register at a time from each slave device. I have tried various different ways of programming this with DeLogger in the Text Window.

The most successful way I have found of doing this is posted below:

BEGIN "Job1" 
/r 
RA"TEST1"("B:",DATA:NOV:100MB) 
RA1SERIAL"" 'Grab 7 Bytes from Rx Buffer 
1SERIAL("%b[1CV]%b[2CV]%b[3CV]%b[4CV]%b[5CV]%b[6CV]%b[7CV]") 
'Init 8CV to default 0xFFFF 8CV=0xFFFF 
'If Message is a request, then store 8th byte in 8CV, otherwise 8CV=0xFFFF 
IF(3CV==0){1SERIAL("%b[8CV]")} 
1..8CV 
LOGON 
END

The debug information is pasted below:

D,089556,"JOB1",2010/05/28,14:18:39,0.064819,0;A,0,0,65535,53,4,0,0,0,1,53,190; 
?? 1SERIAL: RxBuf=7[5\004\002\000\000\008\244] 
?? 1SERIAL: InputAction: "%b[1CV]" 
?? 1SERIAL: RxBuf-6[\004\002\000\000\008\244] 
?? 1SERIAL: InputAction: "%b[2CV]" 
?? 1SERIAL: RxBuf-5[\002\000\000\008\244] 
?? 1SERIAL: InputAction: "%b[3CV]" 
?? 1SERIAL: RxBuf-4[\000\000\008\244] 
?? 1SERIAL: InputAction: "%b[4CV]" 
?? 1SERIAL: RxBuf-3[\000\008\244] 
?? 1SERIAL: InputAction: "%b[5CV]" 
?? 1SERIAL: RxBuf+11[\000\008\2445\004\000\002\000\001\148~] 
?? 1SERIAL: RxBuf-10[\008\2445\004\000\002\000\001\148~] 
?? 1SERIAL: InputAction: "%b[6CV]" 
?? 1SERIAL: RxBuf-9[\2445\004\000\002\000\001\148~] 
?? 1SERIAL: InputAction: "%b[7CV]" 
?? 1SERIAL: RxBuf-8[5\004\000\002\000\001\148~] 
?? 1SERIAL: Triggered schedule A 
D,089556,"JOB1",2010/05/28,14:18:39,0.126831,0;A,0,0,65535,53,4,2,0,0,8,244,65535; 
?? 1SERIAL: RxBuf=8[5\004\000\002\000\001\148~] 
?? 1SERIAL: InputAction: "%b[1CV]" 
?? 1SERIAL: RxBuf-7[\004\000\002\000\001\148~] 
?? 1SERIAL: InputAction: "%b[2CV]" ?? 1SERIAL: RxBuf-6[\000\002\000\001\148~] ?? 1SERIAL: InputAction: "%b[3CV]" ?? 1SERIAL: RxBuf-5[\002\000\001\148~] 
?? 1SERIAL: InputAction: "%b[4CV]" ?? 1SERIAL: RxBuf-4[\000\001\148~] ?? 1SERIAL: InputAction: "%b[5CV]" 
?? 1SERIAL: RxBuf-3[\001\148~] ?? 1SERIAL: RxBuf+10[\001\148~5\004\002\000\000\008\244] 
?? 1SERIAL: InputAction: "%b[6CV]" 
?? 1SERIAL: RxBuf-9[\148~5\004\002\000\000\008\244] 
?? 1SERIAL: InputAction: "%b[7CV]" 
?? 1SERIAL: RxBuf-8[~5\004\002\000\000\008\244] 
?? 1SERIAL: RxBuf=8[~5\004\002\000\000\008\244] 
?? 1SERIAL: InputAction: "%b[8CV]" 
?? 1SERIAL: RxBuf-7[5\004\002\000\000\008\244] 
?? 1SERIAL: Triggered schedule A 
D,089556,"JOB1",2010/05/28,14:18:39,0.152709,0;A,0,0,65535,53,4,0,2,0,1,148,126; 
?? 1SERIAL: RxBuf=7[5\004\002\000\000\008\244] 
?? 1SERIAL: InputAction: "%b[1CV]" 
?? 1SERIAL: RxBuf-6[\004\002\000\000\008\244] 
?? 1SERIAL: RxBuf+14[\004\002\000\000\008\2442\004\000\005\000\001$\008] 
?? 1SERIAL: InputAction: "%b[2CV]" 
?? 1SERIAL: RxBuf-13[\002\000\000\008\2442\004\000\005\000\001$\008] 
?? 1SERIAL: InputAction: "%b[3CV]" 
?? 1SERIAL: RxBuf-12[\000\000\008\2442\004\000\005\000\001$\008] 
?? 1SERIAL: InputAction: "%b[4CV]" 
?? 1SERIAL: RxBuf-11[\000\008\2442\004\000\005\000\001$\008] 
?? 1SERIAL: InputAction: "%b[5CV]" 
?? 1SERIAL: RxBuf-10[\008\2442\004\000\005\000\001$\008] ?? 1SERIAL: InputAction: "%b[6CV]" 
?? 1SERIAL: RxBuf-9[\2442\004\000\005\000\001$\008] 
?? 1SERIAL: InputAction: "%b[7CV]" 
?? 1SERIAL: RxBuf-8[2\004\000\005\000\001$\008] 
?? 1SERIAL: Triggered schedule A 
D,089556,"JOB1",2010/05/28,14:18:39,0.224243,0;A,0,0,65535,53,4,2,0,0,8,244,65535; 
?? 1SERIAL: RxBuf+15[2\004\000\005\000\001$\0082\004\002\000\000\1894] 
?? 1SERIAL: RxBuf=15[2\004\000\005\000\001$\0082\004\002\000\000\1894] 
?? 1SERIAL: InputAction: "%b[1CV]" 
?? 1SERIAL: RxBuf-14[\004\000\005\000\001$\0082\004\002\000\000\1894] 
?? 1SERIAL: InputAction: "%b[2CV]" 
?? 1SERIAL: RxBuf-13[\000\005\000\001$\0082\004\002\000\000\1894] 
?? 1SERIAL: InputAction: "%b[3CV]" 
?? 1SERIAL: RxBuf-12[\005\000\001$\0082\004\002\000\000\1894] 
?? 1SERIAL: RxBuf+20[\005\000\001$\0082\004\002\000\000\18941\004\000\003\000\001\196:] 
?? 1SERIAL: InputAction: "%b[4CV]" 
?? 1SERIAL: RxBuf-19[\000\001$\0082\004\002\000\000\18941\004\000\003\000\001\196:] 
?? 1SERIAL: InputAction: "%b[5CV]" 
?? 1SERIAL: RxBuf-18[\001$\0082\004\002\000\000\18941\004\000\003\000\001\196:] 
?? 1SERIAL: InputAction: "%b[6CV]" 
?? 1SERIAL: RxBuf-17[$\0082\004\002\000\000\18941\004\000\003\000\001\196:] 
?? 1SERIAL: InputAction: "%b[7CV]" 
?? 1SERIAL: RxBuf-16[\0082\004\002\000\000\18941\004\000\003\000\001\196:] 
?? 1SERIAL: RxBuf=16[\0082\004\002\000\000\18941\004\000\003\000\001\196:] 
?? 1SERIAL: InputAction: "%b[8CV]" 
?? 1SERIAL: RxBuf-15[2\004\002\000\000\18941\004\000\003\000\001\196:] 
?? 1SERIAL: Triggered schedule A 
D,089556,"JOB1",2010/05/28,14:18:39,0.282226,0;A,0,0,65535,50,4,0,5,0,1,36,8; 
?? 1SERIAL: RxBuf+22[2\004\002\000\000\18941\004\000\003\000\001\196:1\004\002\000\000\2494] 
?? 1SERIAL: RxBuf=22[2\004\002\000\000\18941\004\000\003\000\001\196:1\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[1CV]" 
?? 1SERIAL: RxBuf-21[\004\002\000\000\18941\004\000\003\000\001\196:1\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[2CV]" 
?? 1SERIAL: RxBuf-20[\002\000\000\18941\004\000\003\000\001\196:1\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[3CV]" 
?? 1SERIAL: RxBuf-19[\000\000\18941\004\000\003\000\001\196:1\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[4CV]" 
?? 1SERIAL: RxBuf-18[\000\18941\004\000\003\000\001\196:1\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[5CV]" 
?? 1SERIAL: RxBuf-17[\18941\004\000\003\000\001\196:1\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[6CV]" 
?? 1SERIAL: RxBuf-16[41\004\000\003\000\001\196:1\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[7CV]" 
?? 1SERIAL: RxBuf-15[1\004\000\003\000\001\196:1\004\002\000\000\2494] 
?? 1SERIAL: Triggered schedule A 
D,089556,"JOB1",2010/05/28,14:18:39,0.347412,0;A,0,0,65535,50,4,2,0,0,189,52,65535; 
?? 1SERIAL: RxBuf=15[1\004\000\003\000\001\196:1\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[1CV]" 
?? 1SERIAL: RxBuf-14[\004\000\003\000\001\196:1\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[2CV]" 
?? 1SERIAL: RxBuf-13[\000\003\000\001\196:1\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[3CV]" 
?? 1SERIAL: RxBuf-12[\003\000\001\196:1\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[4CV]" 
?? 1SERIAL: RxBuf-11[\000\001\196:1\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[5CV]" 
?? 1SERIAL: RxBuf-10[\001\196:1\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[6CV]" 
?? 1SERIAL: RxBuf-9[\196:1\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[7CV]" 
?? 1SERIAL: RxBuf-8[:1\004\002\000\000\2494] 
?? 1SERIAL: RxBuf+16[:1\004\002\000\000\24941\004\000\002\000\001\149\250] 
?? 1SERIAL: RxBuf=16[:1\004\002\000\000\24941\004\000\002\000\001\149\250] 
?? 1SERIAL: InputAction: "%b[8CV]" 
?? 1SERIAL: RxBuf-15[1\004\002\000\000\24941\004\000\002\000\001\149\250] 
?? 1SERIAL: Triggered schedule A 
D,089556,"JOB1",2010/05/28,14:18:39,0.377685,0;A,0,0,65535,49,4,0,3,0,1,196,58; 
?? 1SERIAL: RxBuf=15[1\004\002\000\000\24941\004\000\002\000\001\149\250] 
?? 1SERIAL: InputAction: "%b[1CV]" 
?? 1SERIAL: RxBuf-14[\004\002\000\000\24941\004\000\002\000\001\149\250] 
?? 1SERIAL: InputAction: "%b[2CV]" 
?? 1SERIAL: RxBuf-13[\002\000\000\24941\004\000\002\000\001\149\250] 
?? 1SERIAL: InputAction: "%b[3CV]" 
?? 1SERIAL: RxBuf-12[\000\000\24941\004\000\002\000\001\149\250] 
?? 1SERIAL: InputAction: "%b[4CV]" 
?? 1SERIAL: RxBuf+19[\000\000\24941\004\000\002\000\001\149\2501\004\002\000\000\2494] 
?? 1SERIAL: RxBuf-18[\000\24941\004\000\002\000\001\149\2501\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[5CV]" 
?? 1SERIAL: RxBuf-17[\24941\004\000\002\000\001\149\2501\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[6CV]" 
?? 1SERIAL: RxBuf-16[41\004\000\002\000\001\149\2501\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[7CV]" 
?? 1SERIAL: RxBuf-15[1\004\000\002\000\001\149\2501\004\002\000\000\2494] 
?? 1SERIAL: Triggered schedule A 
D,089556,"JOB1",2010/05/28,14:18:39,0.439453,0;A,0,0,65535,49,4,2,0,0,249,52,65535; 
?? 1SERIAL: RxBuf=15[1\004\000\002\000\001\149\2501\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[1CV]" 
?? 1SERIAL: RxBuf-14[\004\000\002\000\001\149\2501\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[2CV]" 
?? 1SERIAL: RxBuf-13[\000\002\000\001\149\2501\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[3CV]" 
?? 1SERIAL: RxBuf-12[\002\000\001\149\2501\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[4CV]" 
?? 1SERIAL: RxBuf-11[\000\001\149\2501\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[5CV]" 
?? 1SERIAL: RxBuf-10[\001\149\2501\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[6CV]" 
?? 1SERIAL: RxBuf-9[\149\2501\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[7CV]" 
?? 1SERIAL: RxBuf-8[\2501\004\002\000\000\2494] 
?? 1SERIAL: RxBuf=8[\2501\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[8CV]" 
?? 1SERIAL: RxBuf-7[1\004\002\000\000\2494] 
?? 1SERIAL: Triggered schedule A 
D,089556,"JOB1",2010/05/28,14:18:39,0.577392,0;A,0,0,65535,49,4,0,2,0,1,149,250; 
?? 1SERIAL: RxBuf=7[1\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[1CV]" 
?? 1SERIAL: RxBuf-6[\004\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[2CV]" 
?? 1SERIAL: RxBuf-5[\002\000\000\2494] 
?? 1SERIAL: InputAction: "%b[3CV]" 
?? 1SERIAL: RxBuf-4[\000\000\2494] 
?? 1SERIAL: InputAction: "%b[4CV]" 
?? 1SERIAL: RxBuf-3[\000\2494] 
?? 1SERIAL: InputAction: "%b[5CV]" 
?? 1SERIAL: RxBuf-2[\2494] 
?? 1SERIAL: InputAction: "%b[6CV]" 
?? 1SERIAL: RxBuf-1[4] 
?? 1SERIAL: InputAction: "%b[7CV]" 
?? 1SERIAL: RxBuf-0[]
Hi, I have an application where I need to "sniff", and log all MODBUS traffic on RS485 2-wire. The application that DT80 will be used will have one MODBUS Master, and 4 MODBUS Slave Devices. DT80 will ONLY monitor the link and log the data. The link runs at 9600 baud. The MODBUS Master only will request one register at a time from each slave device. I have tried various different ways of programming this with DeLogger in the Text Window. The most successful way I have found of doing this is posted below: ```` BEGIN "Job1" /r RA"TEST1"("B:",DATA:NOV:100MB) RA1SERIAL"" 'Grab 7 Bytes from Rx Buffer 1SERIAL("%b[1CV]%b[2CV]%b[3CV]%b[4CV]%b[5CV]%b[6CV]%b[7CV]") 'Init 8CV to default 0xFFFF 8CV=0xFFFF 'If Message is a request, then store 8th byte in 8CV, otherwise 8CV=0xFFFF IF(3CV==0){1SERIAL("%b[8CV]")} 1..8CV LOGON END ```` The debug information is pasted below: ```` D,089556,"JOB1",2010/05/28,14:18:39,0.064819,0;A,0,0,65535,53,4,0,0,0,1,53,190; ?? 1SERIAL: RxBuf=7[5\004\002\000\000\008\244] ?? 1SERIAL: InputAction: "%b[1CV]" ?? 1SERIAL: RxBuf-6[\004\002\000\000\008\244] ?? 1SERIAL: InputAction: "%b[2CV]" ?? 1SERIAL: RxBuf-5[\002\000\000\008\244] ?? 1SERIAL: InputAction: "%b[3CV]" ?? 1SERIAL: RxBuf-4[\000\000\008\244] ?? 1SERIAL: InputAction: "%b[4CV]" ?? 1SERIAL: RxBuf-3[\000\008\244] ?? 1SERIAL: InputAction: "%b[5CV]" ?? 1SERIAL: RxBuf+11[\000\008\2445\004\000\002\000\001\148~] ?? 1SERIAL: RxBuf-10[\008\2445\004\000\002\000\001\148~] ?? 1SERIAL: InputAction: "%b[6CV]" ?? 1SERIAL: RxBuf-9[\2445\004\000\002\000\001\148~] ?? 1SERIAL: InputAction: "%b[7CV]" ?? 1SERIAL: RxBuf-8[5\004\000\002\000\001\148~] ?? 1SERIAL: Triggered schedule A D,089556,"JOB1",2010/05/28,14:18:39,0.126831,0;A,0,0,65535,53,4,2,0,0,8,244,65535; ?? 1SERIAL: RxBuf=8[5\004\000\002\000\001\148~] ?? 1SERIAL: InputAction: "%b[1CV]" ?? 1SERIAL: RxBuf-7[\004\000\002\000\001\148~] ?? 1SERIAL: InputAction: "%b[2CV]" ?? 1SERIAL: RxBuf-6[\000\002\000\001\148~] ?? 1SERIAL: InputAction: "%b[3CV]" ?? 1SERIAL: RxBuf-5[\002\000\001\148~] ?? 1SERIAL: InputAction: "%b[4CV]" ?? 1SERIAL: RxBuf-4[\000\001\148~] ?? 1SERIAL: InputAction: "%b[5CV]" ?? 1SERIAL: RxBuf-3[\001\148~] ?? 1SERIAL: RxBuf+10[\001\148~5\004\002\000\000\008\244] ?? 1SERIAL: InputAction: "%b[6CV]" ?? 1SERIAL: RxBuf-9[\148~5\004\002\000\000\008\244] ?? 1SERIAL: InputAction: "%b[7CV]" ?? 1SERIAL: RxBuf-8[~5\004\002\000\000\008\244] ?? 1SERIAL: RxBuf=8[~5\004\002\000\000\008\244] ?? 1SERIAL: InputAction: "%b[8CV]" ?? 1SERIAL: RxBuf-7[5\004\002\000\000\008\244] ?? 1SERIAL: Triggered schedule A D,089556,"JOB1",2010/05/28,14:18:39,0.152709,0;A,0,0,65535,53,4,0,2,0,1,148,126; ?? 1SERIAL: RxBuf=7[5\004\002\000\000\008\244] ?? 1SERIAL: InputAction: "%b[1CV]" ?? 1SERIAL: RxBuf-6[\004\002\000\000\008\244] ?? 1SERIAL: RxBuf+14[\004\002\000\000\008\2442\004\000\005\000\001$\008] ?? 1SERIAL: InputAction: "%b[2CV]" ?? 1SERIAL: RxBuf-13[\002\000\000\008\2442\004\000\005\000\001$\008] ?? 1SERIAL: InputAction: "%b[3CV]" ?? 1SERIAL: RxBuf-12[\000\000\008\2442\004\000\005\000\001$\008] ?? 1SERIAL: InputAction: "%b[4CV]" ?? 1SERIAL: RxBuf-11[\000\008\2442\004\000\005\000\001$\008] ?? 1SERIAL: InputAction: "%b[5CV]" ?? 1SERIAL: RxBuf-10[\008\2442\004\000\005\000\001$\008] ?? 1SERIAL: InputAction: "%b[6CV]" ?? 1SERIAL: RxBuf-9[\2442\004\000\005\000\001$\008] ?? 1SERIAL: InputAction: "%b[7CV]" ?? 1SERIAL: RxBuf-8[2\004\000\005\000\001$\008] ?? 1SERIAL: Triggered schedule A D,089556,"JOB1",2010/05/28,14:18:39,0.224243,0;A,0,0,65535,53,4,2,0,0,8,244,65535; ?? 1SERIAL: RxBuf+15[2\004\000\005\000\001$\0082\004\002\000\000\1894] ?? 1SERIAL: RxBuf=15[2\004\000\005\000\001$\0082\004\002\000\000\1894] ?? 1SERIAL: InputAction: "%b[1CV]" ?? 1SERIAL: RxBuf-14[\004\000\005\000\001$\0082\004\002\000\000\1894] ?? 1SERIAL: InputAction: "%b[2CV]" ?? 1SERIAL: RxBuf-13[\000\005\000\001$\0082\004\002\000\000\1894] ?? 1SERIAL: InputAction: "%b[3CV]" ?? 1SERIAL: RxBuf-12[\005\000\001$\0082\004\002\000\000\1894] ?? 1SERIAL: RxBuf+20[\005\000\001$\0082\004\002\000\000\18941\004\000\003\000\001\196:] ?? 1SERIAL: InputAction: "%b[4CV]" ?? 1SERIAL: RxBuf-19[\000\001$\0082\004\002\000\000\18941\004\000\003\000\001\196:] ?? 1SERIAL: InputAction: "%b[5CV]" ?? 1SERIAL: RxBuf-18[\001$\0082\004\002\000\000\18941\004\000\003\000\001\196:] ?? 1SERIAL: InputAction: "%b[6CV]" ?? 1SERIAL: RxBuf-17[$\0082\004\002\000\000\18941\004\000\003\000\001\196:] ?? 1SERIAL: InputAction: "%b[7CV]" ?? 1SERIAL: RxBuf-16[\0082\004\002\000\000\18941\004\000\003\000\001\196:] ?? 1SERIAL: RxBuf=16[\0082\004\002\000\000\18941\004\000\003\000\001\196:] ?? 1SERIAL: InputAction: "%b[8CV]" ?? 1SERIAL: RxBuf-15[2\004\002\000\000\18941\004\000\003\000\001\196:] ?? 1SERIAL: Triggered schedule A D,089556,"JOB1",2010/05/28,14:18:39,0.282226,0;A,0,0,65535,50,4,0,5,0,1,36,8; ?? 1SERIAL: RxBuf+22[2\004\002\000\000\18941\004\000\003\000\001\196:1\004\002\000\000\2494] ?? 1SERIAL: RxBuf=22[2\004\002\000\000\18941\004\000\003\000\001\196:1\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[1CV]" ?? 1SERIAL: RxBuf-21[\004\002\000\000\18941\004\000\003\000\001\196:1\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[2CV]" ?? 1SERIAL: RxBuf-20[\002\000\000\18941\004\000\003\000\001\196:1\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[3CV]" ?? 1SERIAL: RxBuf-19[\000\000\18941\004\000\003\000\001\196:1\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[4CV]" ?? 1SERIAL: RxBuf-18[\000\18941\004\000\003\000\001\196:1\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[5CV]" ?? 1SERIAL: RxBuf-17[\18941\004\000\003\000\001\196:1\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[6CV]" ?? 1SERIAL: RxBuf-16[41\004\000\003\000\001\196:1\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[7CV]" ?? 1SERIAL: RxBuf-15[1\004\000\003\000\001\196:1\004\002\000\000\2494] ?? 1SERIAL: Triggered schedule A D,089556,"JOB1",2010/05/28,14:18:39,0.347412,0;A,0,0,65535,50,4,2,0,0,189,52,65535; ?? 1SERIAL: RxBuf=15[1\004\000\003\000\001\196:1\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[1CV]" ?? 1SERIAL: RxBuf-14[\004\000\003\000\001\196:1\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[2CV]" ?? 1SERIAL: RxBuf-13[\000\003\000\001\196:1\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[3CV]" ?? 1SERIAL: RxBuf-12[\003\000\001\196:1\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[4CV]" ?? 1SERIAL: RxBuf-11[\000\001\196:1\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[5CV]" ?? 1SERIAL: RxBuf-10[\001\196:1\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[6CV]" ?? 1SERIAL: RxBuf-9[\196:1\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[7CV]" ?? 1SERIAL: RxBuf-8[:1\004\002\000\000\2494] ?? 1SERIAL: RxBuf+16[:1\004\002\000\000\24941\004\000\002\000\001\149\250] ?? 1SERIAL: RxBuf=16[:1\004\002\000\000\24941\004\000\002\000\001\149\250] ?? 1SERIAL: InputAction: "%b[8CV]" ?? 1SERIAL: RxBuf-15[1\004\002\000\000\24941\004\000\002\000\001\149\250] ?? 1SERIAL: Triggered schedule A D,089556,"JOB1",2010/05/28,14:18:39,0.377685,0;A,0,0,65535,49,4,0,3,0,1,196,58; ?? 1SERIAL: RxBuf=15[1\004\002\000\000\24941\004\000\002\000\001\149\250] ?? 1SERIAL: InputAction: "%b[1CV]" ?? 1SERIAL: RxBuf-14[\004\002\000\000\24941\004\000\002\000\001\149\250] ?? 1SERIAL: InputAction: "%b[2CV]" ?? 1SERIAL: RxBuf-13[\002\000\000\24941\004\000\002\000\001\149\250] ?? 1SERIAL: InputAction: "%b[3CV]" ?? 1SERIAL: RxBuf-12[\000\000\24941\004\000\002\000\001\149\250] ?? 1SERIAL: InputAction: "%b[4CV]" ?? 1SERIAL: RxBuf+19[\000\000\24941\004\000\002\000\001\149\2501\004\002\000\000\2494] ?? 1SERIAL: RxBuf-18[\000\24941\004\000\002\000\001\149\2501\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[5CV]" ?? 1SERIAL: RxBuf-17[\24941\004\000\002\000\001\149\2501\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[6CV]" ?? 1SERIAL: RxBuf-16[41\004\000\002\000\001\149\2501\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[7CV]" ?? 1SERIAL: RxBuf-15[1\004\000\002\000\001\149\2501\004\002\000\000\2494] ?? 1SERIAL: Triggered schedule A D,089556,"JOB1",2010/05/28,14:18:39,0.439453,0;A,0,0,65535,49,4,2,0,0,249,52,65535; ?? 1SERIAL: RxBuf=15[1\004\000\002\000\001\149\2501\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[1CV]" ?? 1SERIAL: RxBuf-14[\004\000\002\000\001\149\2501\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[2CV]" ?? 1SERIAL: RxBuf-13[\000\002\000\001\149\2501\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[3CV]" ?? 1SERIAL: RxBuf-12[\002\000\001\149\2501\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[4CV]" ?? 1SERIAL: RxBuf-11[\000\001\149\2501\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[5CV]" ?? 1SERIAL: RxBuf-10[\001\149\2501\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[6CV]" ?? 1SERIAL: RxBuf-9[\149\2501\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[7CV]" ?? 1SERIAL: RxBuf-8[\2501\004\002\000\000\2494] ?? 1SERIAL: RxBuf=8[\2501\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[8CV]" ?? 1SERIAL: RxBuf-7[1\004\002\000\000\2494] ?? 1SERIAL: Triggered schedule A D,089556,"JOB1",2010/05/28,14:18:39,0.577392,0;A,0,0,65535,49,4,0,2,0,1,149,250; ?? 1SERIAL: RxBuf=7[1\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[1CV]" ?? 1SERIAL: RxBuf-6[\004\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[2CV]" ?? 1SERIAL: RxBuf-5[\002\000\000\2494] ?? 1SERIAL: InputAction: "%b[3CV]" ?? 1SERIAL: RxBuf-4[\000\000\2494] ?? 1SERIAL: InputAction: "%b[4CV]" ?? 1SERIAL: RxBuf-3[\000\2494] ?? 1SERIAL: InputAction: "%b[5CV]" ?? 1SERIAL: RxBuf-2[\2494] ?? 1SERIAL: InputAction: "%b[6CV]" ?? 1SERIAL: RxBuf-1[4] ?? 1SERIAL: InputAction: "%b[7CV]" ?? 1SERIAL: RxBuf-0[] ````

Dear WillH,

I'm not a "MODBUS" expert, I'll try only to give you some suggestions that may be helping. Also I've no way to test the code today so...

BEGIN "Job1"
/r RA"TEST1"("B:",DATA:NOV:100MB) RA1SERIAL""
'Init 1..12CV to default 0xFFFF
1..12CV(W)=0xFFFF 
'I suggest to initialize all the 8 bytes plus others (four in this example) to initial value in order to recognize missing bytes after serial readings
'Grab up to 12 Bytes from Rx Buffer
1SERIAL("%b[1CV]%b[2CV]%b[3CV]%b[4CV]%b[5CV]%b[6CV]%b[7CV]%b[8CV]%b[9CV]%b[10CV]%b[11CV]%b[12CV]",0.015) 
'timeout of 0,015 s may be enough for up to 12 bytes to be returned at 9600,8,N,1 
1..12CV Bytes effectively read are != 0xFFFF
LOGON
END

I don't know if this approach can work and if DT80 accepts timeout of 0.015 s (normally in "fast" program requiring short timeout I've used 0.1 as also indicated in user manual).

Timeout as to be set shorter enough in order to avoid the inclusion of some response's bytes in the master request frame reading.
Maybe enough in your original program a shorter timeout (default is 10s) and / or regular buffer cleaning (/e) to avoid buffer filling up.

Hope this (if it works...) help!

Regards,
teo

Dear WillH, I'm not a "MODBUS" expert, I'll try only to give you some suggestions that may be helping. Also I've no way to test the code today so... ```` BEGIN "Job1" /r RA"TEST1"("B:",DATA:NOV:100MB) RA1SERIAL"" 'Init 1..12CV to default 0xFFFF 1..12CV(W)=0xFFFF 'I suggest to initialize all the 8 bytes plus others (four in this example) to initial value in order to recognize missing bytes after serial readings 'Grab up to 12 Bytes from Rx Buffer 1SERIAL("%b[1CV]%b[2CV]%b[3CV]%b[4CV]%b[5CV]%b[6CV]%b[7CV]%b[8CV]%b[9CV]%b[10CV]%b[11CV]%b[12CV]",0.015) 'timeout of 0,015 s may be enough for up to 12 bytes to be returned at 9600,8,N,1 1..12CV Bytes effectively read are != 0xFFFF LOGON END ```` I don't know if this approach can work and if DT80 accepts timeout of 0.015 s (normally in "fast" program requiring short timeout I've used 0.1 as also indicated in user manual). Timeout as to be set shorter enough in order to avoid the inclusion of some response's bytes in the master request frame reading. Maybe enough in your original program a shorter timeout (default is 10s) and / or regular buffer cleaning (/e) to avoid buffer filling up. Hope this (if it works...) help! Regards, teo

Good morning WillH

MODBUS messages are binary, have no fixed header we can easily identify and can vary in length. All creating problem with building a suitable parsing string.

So first we need to know which version of firmware is DT80 running and how fast are the MODBUS messages being sent? We estimate that DT80 could probably process about 2 or 3 MODBUS messages per second and what is most likely happening is the messages are occurring at a rate DT80 can't keep up with.

There are also some problems with the code:
Schedule definition
Why not specify the A schedule all in one go, i.e.. RA"TEST1"("B:",DATA:NOV:100MB)1SERIAL""

Logging of binary data
Logging variable length binary messages is tricky. If a message contains fewer than 15 bytes then the 1SERIAL channel will sit there for up to 10s before timing out.

If a subsequent message is received during this time then it will be appended to the first one so the logged data will be misleading. It would be better to specify a timeout that is shorter than the expected message rate.

In fact, for MODBUS, any gap more than a character time or so will terminate a message, so you could use a zero timeout, i.e. 1SERIAL("%b[1CV]...",0). In other words, the entire message must be in the rx buffer at the time that the 1SERIAL channel is processed.

However it is still possible that a second message (eg a reply to the poll message) could also have been received and be in the buffer in which case part or all of it will be appended to the record.

A side effect of this approach is that a timeout error msg will be generated every time a message shorter than 15 bytes is received. These can be turned off using /m, however they will still clog up the event log.

Multiple MODBUS messages
If the intention is to capture a poll-reply message pair in each record then the timeout should be set longer than the expected slave processing time, but still shorter than the expected poll rate.

MODBUS message length
If the length of the regular poll and response messages are known and fixed then the 1SERIAL channel can be set up to capture the exact number of bytes and timeouts should not occur.

Reducing the data to be captured
If you are only interested in the data from a particular device and / or message type then it might be better to trigger a schedule when only that data is received.

For example to poll a device for data the master sends a command that starts with the slave device number and the function number. The device will then respond with a message that also starts with the same slave device number and function number.

The down side is that both messages are of different length and so parsing will be difficult but you could count the number of messages sent which should always be an even number or record a fixed length part of each message.

Old data in Channel variables
The job does not reset CVs between messages so if a short message follows a longer message then misleading data could be logged. Suggest adding 1..15cv(w)=0xffff at the start of the schedule.

Roger

Good morning WillH MODBUS messages are binary, have no fixed header we can easily identify and can vary in length. All creating problem with building a suitable parsing string. So first we need to know which version of firmware is DT80 running and how fast are the MODBUS messages being sent? We estimate that DT80 could probably process about 2 or 3 MODBUS messages per second and what is most likely happening is the messages are occurring at a rate DT80 can't keep up with. There are also some problems with the code: **Schedule definition** Why not specify the A schedule all in one go, i.e.. RA"TEST1"("B:",DATA:NOV:100MB)1SERIAL"" **Logging of binary data** Logging variable length binary messages is tricky. If a message contains fewer than 15 bytes then the 1SERIAL channel will sit there for up to 10s before timing out. If a subsequent message is received during this time then it will be appended to the first one so the logged data will be misleading. It would be better to specify a timeout that is shorter than the expected message rate. In fact, for MODBUS, any gap more than a character time or so will terminate a message, so you could use a zero timeout, i.e. 1SERIAL("%b[1CV]...",0). In other words, the entire message must be in the rx buffer at the time that the 1SERIAL channel is processed. However it is still possible that a second message (eg a reply to the poll message) could also have been received and be in the buffer in which case part or all of it will be appended to the record. A side effect of this approach is that a timeout error msg will be generated every time a message shorter than 15 bytes is received. These can be turned off using /m, however they will still clog up the event log. **Multiple MODBUS messages** If the intention is to capture a poll-reply message *pair* in each record then the timeout should be set *longer* than the expected slave processing time, but still shorter than the expected poll rate. **MODBUS message length** If the length of the regular poll and response messages are known and fixed then the 1SERIAL channel can be set up to capture the exact number of bytes and timeouts should not occur. **Reducing the data to be captured** If you are only interested in the data from a particular device and / or message type then it might be better to trigger a schedule when only that data is received. For example to poll a device for data the master sends a command that starts with the slave device number and the function number. The device will then respond with a message that also starts with the same slave device number and function number. The down side is that both messages are of different length and so parsing will be difficult but you could count the number of messages sent which should always be an even number or record a fixed length part of each message. **Old data in Channel variables** The job does not reset CVs between messages so if a short message follows a longer message then misleading data could be logged. Suggest adding 1..15cv(w)=0xffff at the start of the schedule. Roger
61
2
3
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft