Author Topic: Custom Protocol  (Read 6064 times)

BC SYSTEMS

  • Full Member
  • Posts: 146
    • View Profile
Custom Protocol
« on: December 02, 2010, 02:39:51 AM »
Hi,

I'm trying to communicate to a device that uses the M50 protocol.

The device command information must be transmitted in ASCII format and the responses will be received in ASCII format.  see attached picture from the manual.

I need to use the setprotocol 3,10 for custom protocol but I'm not sure how to send the command string using the outcomm command??



support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3170
    • View Profile
    • Internet Programmable PLCs
Re:Custom Protocol
« Reply #1 on: December 02, 2010, 09:18:51 AM »
The protocol seems to be using all numbers. Are they really communicated in ASCII representation? That means for example the number "123" is not sent as binary 123, but sent as "&H31", "&H32" and "&H33"  since that is the way ASCII are used to represent numbers for human to read easily.

Does the protocol use Carriage return to terminate a command and response string? If so, you can easily use the PRINT #n command to send the command and INPUT$(n) to read the response. Of course for INPUT$(n) you may need to put in a loop until you read a returned string or the loop times out.

You can also use the NETCMD$ command (with "~" termination so that it doesn't append the FCS to the string) and the best way is to look at the I-70xx example where we use the NETCMD$ to talk to I-70xx which have their own custom protocol. You can find the examples in the usr\samples\I-7000\ folder.

« Last Edit: December 02, 2010, 09:21:22 AM by support »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

BC SYSTEMS

  • Full Member
  • Posts: 146
    • View Profile
Re:Custom Protocol
« Reply #2 on: December 03, 2010, 02:50:50 AM »
It looks to me that they send the string in hex even though they state it must be is ASCII??

I will try to complete some tests in the mean time using  a serial port monitor to send some test strings.

I noticed in a previous post you guys have a program for testing serial communications, is this available for download?

If the string can be sent in hex, what is the best command to use?  when a response is received how do I extract the data from the response and store in a DM?

BC SYSTEMS

  • Full Member
  • Posts: 146
    • View Profile
Re:Custom Protocol
« Reply #3 on: December 03, 2010, 02:52:15 AM »
I cant see any reference to carriage return in the manual.  Some more images below

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3170
    • View Profile
    • Internet Programmable PLCs
Re:Custom Protocol
« Reply #4 on: December 03, 2010, 09:30:21 AM »
Assuming that you can send in binary then only INCOMM and OUTCOMM can be used.

You can go to the Frequently Asked board in this forum and look for the thread regarding using Modbus RTU. We have written some TBASIC code to use INCOMM, OUTCOMM etc to implement some  MODBUS functions that are not directly supported by the READMODBUS and WRITEMODBUS commands.

Unfortunately we can only offer suggestions but we can't help you troubleshoot communication with third party devices. Please go through the sample programs for I-70xx and those Modbus functions to have an idea on how to communicate with third party devices with custom protocol.

There are many commercial serial monitor programs out there. We wrote a program that we used for in house testing which is not a serial monitor but require tapping into the receiving pin of the communication hardware to spy on the data. If you have a real serial monitor it will surely work better than this one.

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

BC SYSTEMS

  • Full Member
  • Posts: 146
    • View Profile
Re:Custom Protocol
« Reply #5 on: December 06, 2010, 02:48:44 AM »
Ok.  Thanks for the help.