Posted to tcl by auriocus at Mon Jun 20 22:40:45 GMT 2016view raw

  1. # instantiate motors
  2. motor Sample-X Sample-X
  3. motor Sample-Y Sample-Y
  4. motor Sample-Z Sample-Z
  5. # instantiate detector channels
  6. channel Diode K1norm
  7. channel Monitor Ring_1
  8.  
  9. Sample-X goto 3.0
  10. # tell the motor to run
  11. Sample-X wait
  12. # wait for this motor to arrive
  13. Sample-Y goto 2
  14. Sample-Z goto 7.5
  15. motor waitforall
  16. # wait until all known motors are in position
  17.  
  18. # now run a scan
  19. for {set x 3} {$x<=5} {set x [expr {$x+0.1}]} {
  20. Sample-Y goto $x
  21. Sample-X wait
  22. lassign [channel readall Diode Monitor -timeout 2000] d m
  23. # trigger both detectors to read a value
  24. # return a list if both have finished reading
  25. # or NaN if the timeout fires first
  26. puts [expr {$d/$m}]
  27. }
  28.  
  29.