Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - abradford

Pages: [1]
1
Technical support / Re:Controller drops TCP connection
« on: August 12, 2009, 11:57:41 AM »
If only it were a case of bad wireless; but the controller is connected with ethernet.

I had researched using the MODBUS protocol instead of the custom protocol.  In the end I decided that MODBUS is too low-level and device-specific.  My server has to accept connections from a variety of controllers, and can't know anything about the controller internals.  MODBUS address mappings may change between controller models or manufacturers.

On the other hand, it certainly hasn't been a walk in the park developing the custom protocol :)

Thanks!
Andrew

2
Technical support / Re:Controller drops TCP connection
« on: August 10, 2009, 01:11:03 PM »
Hm, sorry for not replying sooner.

Thanks for looking into this for me.  If it's still relevant, the controller is connecting over the LAN to a PC running the data-receiving server.

The connection is broken seemingly randomly, and not when idle.  The connection drops in the middle of sending data.
The program on the controller connects, sends data, and disconnects.  The connection is never open for more than 30 seconds, depending on how much data needs to be sent.  My controller usually sends between 180 and 1260 characters in a transmission.

I've addressed the issue by developing a more robust transfer protocol that acknowledges every message and aborts if no acknowledgement is received.

Unfortunately, I'm not authorized to share the codebase.  You may be able to recreate the issue by setting up a listener using the UNIX program 'netcat' and configuring a controller to dump memory to the server.

I still see the dropped connections, but since I'm not losing data it's no longer an issue that I must solve.

Thanks again!
Andrew

3
Technical support / Controller drops TCP connection
« on: July 30, 2009, 10:02:51 AM »
Hi all,

I'm having two issues with my F2424 controller.  First, the controller seems to close TCP connections without reason during data transfer, and second, the STATUS(3) command doesn't detect the closed connection.

What happens is the controller connects to a central server to upload a sensor log, but sometimes during the data upload the TCP connection is dropped.  The server sees a 'Connection reset by peer'.

There doesn't seem to be a way to detect the dropped connection on the PLC, as STATUS(3) call in the following code is ineffectual in stopping the loop.  When the connection drops, the controller is unaware and continues trying to upload the data.

Any help will be much appreciated!
Andrew


This is the code that is affected by the dropped connection:
Code: [Select]
' loop through the controller log
   WHILE I < N
' offset from start of log
      O = DM[34] + (DM[30] * DM[32])

' format data to send (6-char ascii number)
      A$ = STR$(DM[O], 6)
      A$ = A$ + STR$(DM[O + 1], 6)
      A$ = A$ + STR$(DM[O + 2], 6)
      A$ = A$ + STR$(DM[O + 3], 6)
      A$ = A$ + STR$(DM[O + 4], 6)
      PRINT# 4 A$

      ' Erase log entries that have been sent
      DM[O] = 0
      DM[O + 1] = 0
      DM[O + 2] = 0
      DM[O + 3] = 0
      DM[O + 4] = 0
      ' Bring the start index up to speed
      DM[30] = (DM[30] + 1) MOD (DM[33] / DM[32])

' if the connection is closed, close our end down
' and log an error
      IF STATUS(3) <> 1 THEN
         PRINT# 4 "</>"
         DM[DM[40]] = DM[DM[40]] | 4
         RETURN
      ENDIF

      I = I + 1
   ENDWHILE

4
Technical support / Re:Binary Data over Ethernet
« on: July 02, 2009, 09:45:48 AM »
Ok, thanks for looking into this for me.

In my copy of the F2424 User Manual, section 14.6, it mentions INCOMM, INPUT, PRINT, and OUTCOMM as methods of sending/receiving data through COMM ports.  It makes no mention that INCOMM and OUTCOMM don't work for COMM4.

5
Technical support / Re:Binary Data over Ethernet
« on: June 29, 2009, 07:00:35 PM »
Yes, I considered using a fixed-width ASCII length for the protocol, but I am also sending a large sensor log dump as well.  I can fit a much higher number (longer messages) in a 4-byte integer than in 4 ASCII characters.

Thank you for your help
Andrew

6
Technical support / Re:Binary Data over Ethernet
« on: June 29, 2009, 08:47:35 AM »
The PC is running a custom server program that I developed.  I've also tested the issue using netcat, a program similar to telnet but capable of acting as a server, with the same result.

The code on the controller is this:
PRINT# 4 "<TCPCONNECT 192.168.1.101:53463>"

PRINT# 4 "testing"

OUTCOMM 4, 0
OUTCOMM 4, 0
OUTCOMM 4, 0
OUTCOMM 4, 5
PRINT# 4 "hello";

What I'm doing here is sending a 4-byte integer before each message so that the receiving program knows the length of the message.  The documentation for OUTCOMM says only 8 bits are sent for each call.

7
Technical support / Binary Data over Ethernet
« on: June 26, 2009, 12:46:59 PM »
Hi,

I'm transmitting data from my controller to a PC using the built-in ethernet module on the F2424.

I've got it connecting and mostly working.  When I run the custom function, no binary data comes through on the PC.

e.g. (on the controller):
OUTCOMM 4, 65
PRINT# 4, "hello"

The data I receive on the PC doesn't include the binary data.  All I see on the PC is "hello" when what I should see is "Ahello".  (65 is the ASCII value for 'A').

Any help is appreciated,
Andrew

Pages: [1]