Tutorial :COM port terminal program



Question:

I have developed an embedded application which requests status information from a device down a communications channel. My customer requires that these will be sent with a specific time period, so what I am looking for is a PC terminal application which can send a text string command repeatedly at a set interval over a period of time. I currently use a serial device tester which can immediately send back a set string when something is sent to it, but I need to control the time period and number of repititions.

Are there any applications (for Windows) out there which can acheive this?


Solution:1

Docklight / Docklight Scripting For testing applications communication over the serial port it is the best tool for the job. It listens for user defined sequences on serial port and can then trigger a transmission with parameters derived from the input message or function in a script.

I wrote a C++ program to test a embedded serial application and it was +/- 1000 lines of code. I was able to replace this with about 20 lines of vb script in Docklight Scripting.

Docklight is definitely worth the money.


Solution:2

I would tend to implement a short python script to do this (it can be compiled to a standalone executable with py2exe if that's what you need). Install python and pyserial. Then use a script like this:

#!/usr/bin/python  import time  import serial    # Interval in seconds  interval = 2.5    # Number of times to send  repetitions = 10    # Simple Command string  command_string = "Hello World"    # Or if it's a binary-type command:  command_bytes = [0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64]  command_string = "".join([chr(c) for c in command_bytes])    # Open the serial port - most of these settings have  # defaults in case you want to be lazy  ser = serial.Serial(          port=0, # This is COM1, use 1 for COM2 etc          baudrate=115200,          parity=serial.PARITY_NONE,          stopbits=serial.STOPBITS_ONE,          xonxoff=0,          rtscts=0,          timeout=0)    # Loop 'repetitions' times  for i in range(repetitions):      # Send the string      ser.write(command_string)      # Go to sleep for "interval" seconds      time.sleep(interval)  

However, if you want a more conventional Windows application, then you can probably do it with Docklight, possibly combined with Docklight Scripting (available from the same site).


Solution:3

The serial terminal emulation application Tera Term, has a scripting language which will be capable of setting up timed loops.

http://ttssh2.sourceforge.jp/

http://en.wikipedia.org/wiki/Tera_Term


Solution:4

I use RealTerm. You can write scripts for it and have it send that file repeatedly. You can add delays between characters or delays between lines. It's a little buggy sometimes, but it's great for the price (free).

http://realterm.sourceforge.net/


Solution:5

Although answered already, i use http://www.hw-group.com/products/hercules/index_de.html . Their app is free and in the serial tab, i can send and receive data from rs232. works like a charm.


Solution:6

ScriptCommunicator (open-source, cross-platform) is the right tool for you. It has many features and a very useful script interface.


Solution:7

You can use the built in windows task scheduler to run a simple batch script that writes texts to a the com port some think like

echo "Hell there" > COM1:    

But I've not done this is in yers so my syntax is rusty. Otherwise you could use a simple 'termulator' program that supports scripting - again I've not done this in a decade I think.


Solution:8

I'd write a C# program to do this. They have libraries to open the COM ports and timers to time when to send data.


Solution:9

GModLab - cross-platform, scriptable (JS) terminal: https://github.com/tardigrade888/gmodlab You can write scripts that do anything.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »