INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Serial Port Read from Agilent E3648A Power Supply

Serial Port Read from Agilent E3648A Power Supply

Serial Port Read from Agilent E3648A Power Supply

(OP)
Greetings all....

I've created a couple of TCL scripts that write strings to the Agilent Power supply, now I am working on a read/write version of the same thing.
Been having problems receiving characters properly from the bench supply.

1. If I run my code in a tclsh, I get nothing back from the device at all.
2. If I run my code in an ActiveTcl wish console, I can get data back from the bench supply but only if I either halt script execution after the "read" command or I enter the "read" command manually.

Here is the minimal code I've been working with. Any help is appreciated.

CODE --> TCL

set msg ""
set w_time 1000

proc rd_chid {chid} {

if { [catch {set msg [read -nonewline $chid] } ] } {
		puts "error"
	   } else {
	   puts stdout $msg
	   #puts "com recv"
	    }
 }

#open the com ports
set psone [open "com1" r+]
fconfigure $psone -mode 9600,n,8,1 -blocking 0 -translation auto -buffering none
fileevent $psone readable [list rd_chid $psone]

# set device into remote control mode
puts $psone "SYSTEM:REMOTE"

# select first node of dual node supply
puts $psone "INSTRUMENT:nSel 1"

# read voltage
puts $psone "MEASure:VOLTage:DC?"

#puts $psone "*OPC?"

#puts $psone "*CLS"

#puts $psone "SYSTEM:LOCAL"

#after 5000 {close $psone} 

RE: Serial Port Read from Agilent E3648A Power Supply

Try "flush".

_________________
Bob Rashkin

RE: Serial Port Read from Agilent E3648A Power Supply

(OP)
Thanks for the reply Bong.

Unfortunately "flush" does not change things. I've tried using the command in several different ways and it is not working the way I expect it too.

What I'm attempting seems very basic, and because of my problems I'm thinking something is wrong with my entire approach. The entire script, when finished, is supposed to be interactive with the user. At this point I wonder if I should be using Expect.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close