spec

Software for Diffraction

2.4.8.3. - Miscellaneous



reconfig
Reconfigures the hardware. This command obtains any modified configuration information, including hardware devices and types, CAMAC slot assignments and motor parameters and settings, from the config and settings files. The sequence of events is as follows:

First, spec waits for all asynchronous activity (moving and counting) to finish. It then does a sync of the motor controller registers, comparing them with the internal program positions. Next, all open devices are closed. The config file is then read to obtain the configuration information, and the program opens and possibly does hardware presence tests on the selected devices. Finally, the internal program motor positions are updated from the settings file and then resynchronized with the motor hardware.

set_sim(how)
If how is 0, simulate mode is turned off. If how is 1 (or positive), simulate mode is turned on. In either case the program waits for moving and counting to finish before changing the mode, and the function returns the previous mode (0 or 1). If how is -1 (or negative) the function returns the current value of simulation mode without changing it. Whenever simulation mode is turned off, the motor settings file is reread to restore the motor positions. Simulation mode cannot be turned off if spec was invoked with the -s flag.

wait()
Waits for all active motors, timers, counters, MCA- and image-type activity to complete. Returns true .

wait(mode)
Waits for specified activity to complete or returns status indicating whether specified activity is active. The function wait() is used to synchronize the flow of commands in spec with moving, counting and other activity. Since the built-in commands and functions move_all, move_cnt, tcount() and mcount() return immediately after starting moving or counting, macros need to include some form of wait() if the next command requires the previous move or count to complete.

Bits set in the mode argument affect the behavior as follows:
 Bit   Value   Activity Waited For Or Other Action 
    0   Moving, counting and other acquisition 
 0   1   Moving 
 1   2   Counting (by the master timer) 
 2   4   Other acquisition (MCAs, CCDs, etc.) 
 3   8   Remote connections and remote asynchronous events 
 4   16   Shared motors started by other clients 
 5   32   Return zero or nonzero to indicate if busy 

If mode is a negative number, wait() will behave as for mode = 0, but a message will be printed showing what is being waited on.

For acquisition devices with "auto_run" mode enabled (such devices are started automatically during counting), waiting for counting will also include waiting for those devices.

When spec is running as client to a spec server, bit 3 checks if remote_async() replies have all arrived. In addition, bit 3 also checks if all configured spec servers have connected and if all spec server and EPICS remote motors have connected.

Waiting for spec server and remote motor connections is mainly an issue on start up or after reconfig. One might use wait(8) or wait(0x28) in the built-in special macro config_mac if it is important to delay until all connections are up. Note, until remote spec server and EPICS motors are fully connected and usable, the positions reported for those motors will be the last saved positions from spec's settings file.

When spec is configured with shared motors either on a spec server or using EPICS channel access, if those motors are started by a different client, setting bit 4, as in wait(16) will cause spec to wait until those motors have completed their move. Waiting can be interrupted with a ^C, but that will not stop the motors.

Also, note that wait(0) does not check for the events flagged by bits 3 or 4. To wait for remote events or externally busy motors requires explicitly setting bits 3 or 4 in mode. Also, a ^C interrupts a wait(8) or wait(16) but doesn't change the conditions that caused wait(8) or wait(16) to block. That is, the next wait(8) will still block if there are still pending connections, and the next wait(16) will still block if the external motors are still moving.

If bit 5 (0x20) in mode is set, wait() returns true (1) if the activities flagged by bits 0, 1, 2, 3 or 4 are still going on, otherwise wait() returns false (0).

stop()
Stops all asynchronous activity. Returns true .


stop(mode)
If mode has bit one set (1), stops all motors that are moving. If mode has bit two set (2), stops the timer, counters and any other data acquisition (multi-channel scaling, for example).