% Written by Tom Spinka on Sept. 26, 2007 for completing a write operation
% to a Lambda Physik FL3001/3002 dye laser. Note that the string to send
% may need to be formatted correctly (numbers converted to ascii-coded
% decimal).
function Err = DyeLaserWrite(BdHandle, DyeHandle, StringToSend)
[Err, BdAddr] = ibask(BdHandle, 01); % Get the GPIB Address of the Board
[Err, DyeAddr] = ibask(DyeHandle, 01); % Get the GPIB Address of the Dye Laser
Err = ibcmd(BdHandle, char(64 + BdAddr), 1); % Set the Board to be the Talker
Err = ibcmd(BdHandle, char(32 + DyeAddr), 1); % Set the Dye Laser to be the Listener
Err = ibwrt(BdHandle, StringToSend, length(StringToSend)); % Complete the write operation.
Err = ibcmd(BdHandle, char(95), 1); % Send UNT (Untalk)
Err = ibcmd(BdHandle, char(63), 1); % Send UNL (Unlisten)