Blog post by Steve Palmgren, Vice President Texas Operations, Patti Engineering
To the layman packet sniffing may sound a little suspect…drug related possibly??? But, in an engineer’s world using RS232 packet sniffing hardware is a great way to diagnose and debug network-related problems. But what if you are out on location when a problem arises and you don’t have RS232 packet sniffing hardware with you and/or a RS232 port debugging laptop?
That is exactly the problem I ran into recently on a job site. Instead of delaying the debugging process to find RS232 hardware, I decided to get “creative”, or really, lazy (you be the judge)! In my effort to be “creative”, I was successful in creating another method for myself to debug which sped up my debugging efforts in the field. If this is something which would be helpful to you, here is how the work-around was created in a Siemens S7-300 series PLC and Step7:
- Create an OpenTCP connection in the PLC using TConn(FB65) and connect via Ethernet to your laptop using HyperTerminal/Putty (or your terminal software of choice)
- Create PLC code to copy RS232 packets (both directions) from your hardware modules to the OpenTCP connection using TSend(FB63) and capture the TCPIP (which were originally RS232) packets on your laptop
- Review your logged packet data from the PLC and determine where the problem is occurring
- Fix your issue in the RS232 packet generation (PLC and/or external device) and you are up and running
When it comes to debugging code, it isn’t always just about looking at the existing code or hardware. Adding additional debugging code to trap or log events/data is a great way to narrow down where the problem is occurring. This particular method of debugging RS232 eliminated the need for additional hardware and decreased the debugging time.
With PLC technology there are usually multiple ways to solve a problem. As Confucius, the great Chinese philosopher once said, “When it is obvious that the goals cannot be reached, don’t adjust the goals, adjust the action steps.”
Hope this tip has been helpful!