Author Topic: M-7018  (Read 9595 times)

Dogface

  • Newbie
  • Posts: 33
  • Woof$
    • View Profile
M-7018
« on: March 18, 2006, 06:50:28 AM »
The M-7018 is the Modbus RTU version of the I-7018.  GREAT! Says I!  One comm protocol for everything.  I can't get these to work with the PLC at all!  I can read the status of the Module using DCon.  I can communicate with the PLC.  Just can't get the two to talk to each other.
Is there any chance of someone out there that has used the combination of M-series Tri-PLC and M-7018 from ICP-DAS?

Thanks,
Dogface

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3171
    • View Profile
    • Internet Programmable PLCs
Re:M-7018
« Reply #1 on: March 19, 2006, 02:54:32 AM »
We haven't had a chance to try out the M-7018 but we learnt from ICP-DAS that it supports MODBUS RTU. If you can use other MODBUS master to talk to M-7018 to read the register then the PLC should be able to read from M-7018P using the READMOBUS or READMB2 instructions.

You have to use READMODBUS(13, nn, xxxx) to read from a MODBUS RTU device. This forces READMODBUS to use RTU instead of MODBUS ASCII protocol to talk to the M-7018P. If you had used port #3 instead of #13 this could be reason.

Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Dogface

  • Newbie
  • Posts: 33
  • Woof$
    • View Profile
Re:M-7018
« Reply #2 on: March 19, 2006, 04:04:20 PM »
Yes.. tried both 13 and 3.  The only thing I haven't tried, is turning on the Checksum function of the M-7018.  What do you think?  I'm having the same problem with my M-7024 module.  I'm pretty sure it has something to do with the fact that I'm a noob.

Thanks

Dogface

  • Newbie
  • Posts: 33
  • Woof$
    • View Profile
Re:M-7018
« Reply #3 on: March 20, 2006, 02:56:23 AM »
Succesfull communication with the M-7024.  Write and Read.  The M-7018 still isn't working.

'command  readmodbus (13,2,0)
status(2) is 0

same command on the m-7024 works fine.  Status(2)=1

 ???

Dogface

  • Newbie
  • Posts: 33
  • Woof$
    • View Profile
Re:M-7018
« Reply #4 on: March 20, 2006, 04:15:32 AM »
Okay.  Herein lies the problem...I think.  The M-7018 uses the Modbus function 0x04 to read the input registers.  The standard should be 0x03, but it isn't.

I'm using a T100MDr49 but using the command setsystem 5,4 doesn't help the issue.  Is this command valid for both ASCII and RTU?

I downloaded and used http://www.tri-plc.com/trilogi/modbusFunction04.zip with somewhat limited success.  Actually, it may have been completely succesfull.  I just can't decipher the information returned in dm(200)- ? .

Any suggestions?

Thanks,
Dogface

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3171
    • View Profile
    • Internet Programmable PLCs
Re:M-7018
« Reply #5 on: March 21, 2006, 08:53:57 PM »
Please check to make sure the the SETSYSTEM 5,4 statement has indeed been executed in the program. We have tested this features and it is being used by some users who need to use Function 04. It is supported by both ASCII and RTU.

If you have an RS232 to RS485 converter (e.g. Auto485) you could monitor the communication between the PLC and the M-7018 to find out what's causing the problem.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Dogface

  • Newbie
  • Posts: 33
  • Woof$
    • View Profile
Re:M-7018
« Reply #6 on: March 22, 2006, 07:59:22 AM »
Actually, the Setsystem 5,4 command is in the same custom function as the modbus command.  (preceding of course)  Can you recommend any software that will enable me to snoop on the serial communications?  TL server dosen't like it when I start communicating with RTU.

Thanks,
Dogface

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3171
    • View Profile
    • Internet Programmable PLCs
Re:M-7018
« Reply #7 on: March 23, 2006, 11:31:14 AM »
There are some sharewares out there that may have 30 days evaluation period.

If you wish, we could send you one serial snooper program we wrote for our own testing purpose. Just email to support@tri-plc.com with your PLC purchase details and we can email you the program to test out. It is written in Java and can run on PC that has TRiLOGI and TLServer already installed.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Dogface

  • Newbie
  • Posts: 33
  • Woof$
    • View Profile
Re:M-7018
« Reply #8 on: April 06, 2006, 02:54:23 PM »
This is my communication with ICP-DAS regarding some of the issues I've had with the M-7018 input module.  If you have the time and inclination to go through it, please correct me if my information is faulty or misleading.
Thanks.  ;)

Hi John,
I'll do my best to relay the information correctly....
Using a "M" series Tri-Plc and the M7017 input module.

The Tri-Plc manual shows using the following TBasic command to read the inputs on the M-7017
READMB2 ch, ID, addr, var, count      {* Applicable only to M+PLC with firmware r44 or higher}

Example:  
readmb2 13,3,0,DM[10],8   *ch 3 is for ASCII, and ch13 is for RTU.

I had no luck with this command.  Communication Error reported between the PLC and the Module.  I believe that the problem is....this command implements a Modbus RTU function 03x (read holding register) which is not supported by the M-7017.  A Modbus RTU function 04x (read input register) is required.

Tech-Support recommended that I precede the above mentioned command with "setsystem 5,4" to force the PLC into using the function 04x instead of the 03x.  This did not work.  I don't know why...it just didn't.

Looking further, I found a sub-routine that was written by Tri-Plc's tech support guru.
'  This function implements MODBUS RTU function 04 using the INCOMM and
'  OUTCOMM commands.
'  The address to be read is in A
'  The number of channel to be read is in N
'  The data are returned in DM[201] to DM[201+N]
'  DM[101] to DM[200] are used by this function
DM[101] = &H02     ' node address of slave
DM[102] = &H04     ' function 04
DM[103] = A/256    ' upper 8 bit of address
DM[104] = A & &HFF ' lower 8 bit of address
DM[105] = 0        ' upper 8 bit of count
DM[106] = N        ' lower 8 bit of count
X = CRC16 (DM[101],6) & &HFFFF  ' compute the CRC16 of DM[101] to DM[106]
DM[107] = X / 256    ' upper 8 bit of CRC16
DM[108] = X & &HFF ' lower 8 bit of CRC16
FOR I = 1 to 8          ' send out the MODBUS RTU command in binary
  OUTCOMM 3, DM[100+I]
NEXT
delay (10)  ' delay for a while to wait for response
FOR I = 1 to 90          ' assuming small number of read data
  DM[110+I] = INCOMM (3)
  IF DM[110+I] < 0 GOTO @5: ENDIF
NEXT
@5 FOR I = 1 to N          ' convert two bytes into one 16-bit word.
  DM[200+I] = DM[112+I*2]*256+DM[113+I*2]
NEXT

I had some limited success with this snipet of code and further modified it as follows...

dm[101]=&h02  'address of module
dm[102]=&h04  'modbus protocol code to read modicon input register
dm[103]=&h00  'Start address high
dm[104]=&h00  'start address low
dm[105]=&h00  'Read 8 channel high
dm[106]=&h07  'Read 8 channel low
X = CRC16 (DM[101],6) & &HFFFF  ' compute the CRC16 of DM[101] to DM[106]
DM[107] = X / 256    ' upper 8 bit of CRC16
DM[108] = X & &HFF ' lower 8 bit of CRC16
FOR I = 1 to 8          ' send out the MODBUS RTU command in binary
  OUTCOMM 3, DM[100+I]
NEXT
delay (10)  ' delay for a while to wait for response
FOR I = 1 to 30          ' assuming small number of read data
  DM[110+I] = INCOMM (3)
  IF DM[110+I] < 0 GOTO @5: ENDIF
NEXT
@5 FOR I = 1 to 16          ' convert two bytes into one 16-bit word.
  DM[200+I] = DM[112+I*2]*256+DM[113+I*2]
NEXT

almost identical.

It's working, but it was a painfull chore to make it work.  Having said that....I'm just a rookie.

Thanks,
Sean

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3171
    • View Profile
    • Internet Programmable PLCs
Re:M-7018
« Reply #9 on: April 09, 2006, 01:14:10 AM »
SETSYSTEM 5,4 to force READMODBUS or READMB2 to use function 04 instead of 03 only works on PLC with firmware version r49 and above. Did you check your PLC firmware version? If it is earlier version then it does not support SETSYSTEM 5,4 and is ignored by the PLC. You can find out the firmware version using the "Get PLC Hardware Info" under the TRiLOGI "Controller" menu.

If your PLC firmware is earlier than r49, then you can only use the TBASIC to construct MODBUS function 04 since there is no built-in support. I am surprised that ICP-DAS doesn't support the more basic function 03 (which is a level 1 MODBUS function and should be supported by all MODBUS RTU compatible devices). If you did manage to get the the desired readings then you have done something right. It takes a bit more effort but you get to see what TBASIC is capable of doing beyond built-in command :).
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Dogface

  • Newbie
  • Posts: 33
  • Woof$
    • View Profile
Re:M-7018
« Reply #10 on: April 10, 2006, 10:12:55 PM »
Yes....checked the firmware version.  It is r49.  Like I posted previously.  I'm not sure why the Setsystem command didn't work.  I just know that it didn't.

I don't want to seem negative towards the PLC.  This thing is great!  Not to say it is perfect, but what a powerfull tool!

thanks,
Sean

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3171
    • View Profile
    • Internet Programmable PLCs
Re:M-7018
« Reply #11 on: May 04, 2006, 06:05:28 PM »
We just got a unit of M-7018 from ICP-DAS and tested it with the T100MD+. We found out that we have mistakenly posted the command to force the READMODBUS to use function 04 as "SETSYSTEM 5, 4". This is wrong. It should be "SETSYSTEM 6,4". Maybe you like to try it again?

BTW, ICP-DAS now supports both function 03 and 04 on their latest release of M-7018. But if you can use SETSYSTEM 6,4 to make it work then it would make no difference to you.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Dogface

  • Newbie
  • Posts: 33
  • Woof$
    • View Profile
Re:M-7018
« Reply #12 on: May 04, 2006, 07:53:11 PM »
Awesome!  I've  been in conversation with ICP-DAS and am aware that all new versions of the M-7018 will use both functions 03 and 04.  But the setsystem command thing.... That's great!  

Thanks a bunch!  I'm actually looking forward to rewriting that section of the program....go figure.

Dogface

Dogface

  • Newbie
  • Posts: 33
  • Woof$
    • View Profile
Re:M-7018
« Reply #13 on: May 09, 2006, 12:46:19 AM »
Setsystem 6,4 works great!  Thank you!
« Last Edit: May 09, 2006, 08:30:21 AM by support »