RB9603_monochromator Class Reference
[RB9603 Monochromator Controller]

#include <rb9603_monochromator.h>

Inherits RulbusDevice.

List of all members.


Detailed Description

Purpose

Control a Bausch & Lomb monochromator remotely.

Description

The RB9603 Rulbus module enables remote control of a Bausch & Lomb monochromator by driving its nonius with a stepping motor.

The target wavelength can be set manually with Up and Down keys on the Rulbus module and programmatically via the Rulbus computer interface.

The module has a one-line display that shows the target wavelength along with indications if the monochromator is still moving up or down and if the wavelength was set manually or via program control.

Besides setting the wavelength, several properties may be requested from the controller via the computer interface: the target wavelength, the current wavelength, the minimum and maximum wavelengths and the current wavelength as seen by the potentiometer on the stepping motor--potentiometer assembly (see omplementation).

When a monochromator is created, no configuration steps are made with respect to the monochromator Rulbus module.

Usage

Here is a small example how you may use an amplifier module.

   Rulbus::RB603_monochromator lamp( "lamp" );

   lamp.setWavelength( 333.5e-9 );      // yes its in [m]

Implementation

The controller module itself sits in a Rulbus rack. A stepping motor--potentiometer assembly is located on the Bausch & Lomb monochromator to drive it. Via a cable the assembly is connected to the MOTOR connector on the controller.

The potentiometer in the assembly records the absolute position of the monochromator. It is used to calibrate the monochromator wavelength at 500 nm initially and to check the position when a new wavelength has been reached.

The minimum wavelength that can be used can be set at production time with jumper CN4 to be 0 nm or 100 nm. Minimum and maximum wavelength may be obtained with methods minWavelength() and maxWavelength().

Remote operation

The messages exchanged between computer and monochromator controller consist of two-letter commands and an optional argument or response of six uppercase hexadecimal characters. The argument and response values are four times the wavelength in nm.

Thus messages look like:

   SW<sp>0007D0<eot>    # set wavelength to code

   GW<eot>              # request current wavelength code
   0007D0<eot>          # read current wavelength code
   

Here <sp> is a space character and <eot> is the end-of-text character (see below).

The following table lists the commands that can be sent to the monochromator controller via the computer interface.

   Cmd   Arg    Resp     Remark
   -----------------------------------------------------------------------------
    GW          WLact    get current wavelength
    GS          WLset    get wavelength setvalue
    GA          WLadc    get measured wavelength (ADC)
    GM          WLmean   get 4-sample mean measured wavelength (ADC)
    GN          WLmin    get minimum wavelength
    GX          WLmax    get maximum wavelength
    SW   WLset           set wavelength setvalue
    CW                   calibrate, move to 500 nm
   

The Rulbus processor--monochromator controller is a master--slave combination. The master controls the communication. It writes to the controller's command register and reads from the status register. These registers are both at the same Rulbus address, normally 0xCE.

Command communication

The commands sent are two-letter strings optionally followed by a space and an argument. The command-argument string is terminated by the end-of-text character COMEOT (see the table below). If a result is returned, the master must collect its characters. Arguments and results consist of six uppercase hexadecimal characters. Like command-argument strings, results are terminated with the COMEOT character.

   write a command-argument string   for each character in string do:
                                        write character
                                     write COMEOT

                   read a response   read character
                                     while character <> COMEOT:
                                        string = string + character
                                        read character
   

Character communication

Exchanging characters with the monochromator controller is done as follows.

                 write a character   write COMRDY

                                     read tempchar
                                     until tempchar = COMRDY

                                     write character

                                     read tempchar
                                     until tempchar = character

                                     write COMRDY

                  read a character   write COMRDY

                                     read tempchar
                                     until tempchar = COMRDY

                                     write COMGET

                                     read character
                                     until character <> COMRDY
                                     
                                     read character     # note 1.

                                     write COMRDY
   

Note 1. In a real implementation, the character must be read again because, although the character previously read differs from COMRDY, it is not necessarily stabilized to the character sent by the controller (the loop terminates when datalines begin to change).

The table below lists the codes used for communication with the monochromator controller.

   Code    Value  Remark
   COMRDY    0    character accepted / ready to accept a character.
   COMGET    1    request from master for a character of a response.
   COMEOT    2    end of command-argument or response string.
   other     -    command, argument, or response character.
   

And here are the module's registers.

   Registers    Offset  Read/Write    Description
   -----------------------------------------------------------------------------
   command        0       write       write command string
   status         0       read        read response
   


Public Types

typedef Int Value
 step count type; holds 3-byte number


Public Member Functions

Construction
 RB9603_monochromator (NameCref aName, Addr aAddr=DEF_ADDR, Rack aRack=DEF_RACK)
 constructor.

 ~RB9603_monochromator ()
 destructor.

Predicate and ...
bool isReady () const
 true if monochromator is at target wavelength; may throw RulbusTimeoutError.

void wait () const
 wait until monochromator is at wavelength set; may throw RulbusTimeoutError.

Accessors
Length adcWavelength () const
 the current wavelength according to the measured voltage; may throw RulbusTimeoutError.

Length adcMeanWavelength () const
 the current wavelength according to the mean-measured voltage; may throw RulbusTimeoutError.

Length currentWavelength () const
 the current wavelength; may throw RulbusTimeoutError.

Length targetWavelength () const
 the target wavelength; may throw RulbusTimeoutError.

Length minWavelength () const
 the lowest valid wavelength; may throw RulbusTimeoutError.

Length maxWavelength () const
 the highest valid wavelength; may throw RulbusTimeoutError.

Mutators
void calibrate (bool and_wait=true) const
 move monochromator to 500 nm for calibration; may throw RulbusTimeoutError.

void setWavelength (Length aWavelength, bool and_wait=true) const
 set target wavelength; may throw RulbusRangeError, RulbusTimeoutError.


Static Public Attributes

Defaults
const Addr DEF_ADDR = 0xCE
 default address


Protected Types

enum  ComCodes { COM_RDY = 0, COM_GET = 1, COM_EOT = 2, COM_LEN = 15, COM_CNT = 500, COM_SLPMS = 1 }
 communication codes. More...


Protected Member Functions

Construction and Assignment
 RB9603_monochromator ()
 prevent default construction

 RB9603_monochromator (RB9603_monochromatorCref rhs)
 prevent copying

RB9603_monochromatorRef operator= (RB9603_monochromatorCref rhs)
 prevent copying

Checker
void checkWavelength (Length aWavelength) const
 check for valid wavelength; may throw RulbusRangeError.

Communication
Value read (CharCptr aName, CharCptr aCmd) const
 issue command, read and return response; may throw RulbusTimeoutError.

void write (CharCptr aName, CharCptr aCmd, Value aPos=-1) const
 write a command with optional value; may throw RulbusTimeoutError.

String getString () const
 read a string; may throw RulbusTimeoutError.

void putString (StringCref aString) const
 write a string; may throw RulbusTimeoutError.

char getCharacter () const
 read a character; may throw RulbusTimeoutError.

void putCharacter (char ch) const
 write a character; may throw RulbusTimeoutError.


Private Attributes

Data
Length theMinWL
 cached minimum valid wavelength

Length theMaxWL
 cached maximum valid wavelength


Static Private Attributes

Register offsets
const int OFF_CMD = 0
 command register offset

const int OFF_STS = 0
 status register offset

const int ADR_WIDTH = OFF_STS + 1
 address width

Conversion
const Length CON_MPS = 0.25e-9
 meter-per-step conversion value (4 nm per step).


Member Enumeration Documentation

enum ComCodes [protected]
 

Enumeration values:
COM_RDY  ready code
COM_GET  get character code
COM_EOT  end-of-transmission code
COM_LEN  maximum string length
COM_CNT  number of retries for character communication (500 ms)
COM_SLPMS  ms sleep between retries


The documentation for this class was generated from the following files:
Generated on Tue Oct 12 14:12:05 2004 for Rulbus Device Class Library for Microsoft Windows by doxygen 1.3.4