Updated 2015-12-15 03:00:58 by RLE

2005-02-17 VI We have a HP16500 (and a HP1655A). These are old HP Logic Analyzers. And very beautiful. They have a serial port output that can connect to an HP printer. And you can print the screen to that. There seems to be no other easy way to get the screens out. I wrote up this script which will capture the data and write it into a gif file. Setup is easy: On the Logic Analyzer, set it

  • Printer on Serial Port
  • 19.2KB (the fastest it goes), no Xon-Xoff, 8 bits no parity
  • Laserjet.

Use a crossover (null-modem) serial cable to connect the Analyzer to the serial port of the PC (com1 for me). They all print a standard 640 x 368. The 640 is 85 * 8. If your LA prints a different size - it should be easy to figure out what to change in this script.

  • On the PC type tclsh hpcap.tcl gif_file_name (which is where this script is saved)
  • On the LA hit the print and then print screen button
  • Wait a few minutes and you have your gif file!

The end of capture is detected as a one second silence. Note that the gif file creation takes a few minutes (perhaps someone can speed that up), so don't give up and Ctrl-C it. Tested on win
 proc writeimg {r fn} {
    puts "Writing GIF to file $fn"
 
    package require Tk
    image create photo pic -height [expr 368] -width [expr 85 * 8]
 
    set y 0
    set i1  1
    while {1} {
       set i1 [string first b85W $r $i1]
       if {$i1 < 0} {break}
       incr i1 4
       set str [string range $r $i1 [expr $i1 + 85 - 1]]
       binary scan $str c85 l
       set x 0
       foreach c $l {
          for {set i 7} {$i >= 0} {incr i -1} {
             if {(1 << $i) & $c} {
                pic put black -to $x $y
             }
             incr x
          }
       }
       incr i1 85
       incr y
    }
 
    pic write $fn -format gif
    puts "Done"
    exit
 }
 
 proc endcap {} {
    puts "Capture Ended with [string length $::buf] bytes"
    writeimg $::buf $::giffile
 }
 
 proc rd_chid {chid} {
    if {[info exists ::afterid]} {
       after cancel $::afterid
    } else {
       puts "Capture Started"
       set ::buf ""
    }
    append ::buf [read $chid]
    set ::afterid [after 1000 endcap]
 }
 
 set giffile [lindex $::argv 0]
 
 if {$giffile eq ""} {
    puts "Usage : <hpcap> gif_file_name"
    exit
 }
 
 set com [open com1: r+]
 fconfigure $com -mode 19200,n,8,1 -blocking 0 -translation binary -buffering none
 fileevent $com readable [list rd_chid $com]
 puts "Waiting for Capture data. Will write into $giffile"
 vwait forever

Links to here: