开发者

COM port terminal program

开发者 https://www.devze.com 2022-12-19 00:34 出处:网络
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 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?


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.


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).


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


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/


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.


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


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消