Solved

Using TCL to communicate with Serial port in Windows

Posted on 2013-01-24
1
1,029 Views
Last Modified: 2013-01-28
Hello,

I am trying to use TCL to set a connection with a device on the serial port (using Windows) and to send commands to the device based on prompts given by the device on the serial port.

For example,

As the device boots up you can enter a mode to update the software by pressing the letter "P" as there is a prompt that gives you 2 seconds to press "P" to update sw.  I am looking for the tcl commands that will allow me to read the informaion comming from the serial port and if it sees the request for "P" it will send "P" back over the serial port to the device.  


I thought, as a test, I would write a script that would show what the com port is recieving.
So far I have tried this:



set com [open com1:a+]
fconfigure $com -mode 115200,n,8,1 -blocking 0 -translation auto -buffering line

set data [read $com]

puts "$com"


all I get back is:
file6355a8

Again, my main goal is to send the device into sw update mode by sending "P" when prompted.  

Any help would be appreciated, and thank you for your time.
0
Comment
Question by:DivergentUser
1 Comment
 
LVL 51

Accepted Solution

by:
ahoffmann earned 500 total points
ID: 38820162
expect is your friend http://wiki.tcl.tk/201
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Background Still having to process all these year-end "csv" files received from all these sources (including Government entities), sometimes we have the need to examine the contents due to data error, etc... As a "Unix" shop, our only readily …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now