Counter Functions

read_counter( counter_id), rc()
Returns the counter contents. The function get_counts() returns the number of counts. For non-preset counters both functions return the same value.
e.g.:
* = read_counter(c1)

read_and_reset_counter( device_id), rrc()
Returns the register contents and resets the counter.
e.g.:
* = read_and_reset_counter(c1)

write_counter( counter_id) = int_expr, wc()
e.g.:
wc(c1) = 12345

get_counts( device_id), gc()
Returns the number of counts. The function read_counter() returns the register contents. For non-preset counters both functions return the same value.
e.g.:
* = get_counts(c1)

reset_counter( device_id), resco()
reset_all_counters( device_id), resaco()
Clears a single counter/all counters.
e.g.:
do reset_counter(c1)
do resaco()

get_offsets( [sample_time])
This function is intended to be used in the framework of fast scans. It uses scan_timer to measure the counter offsets of scan_c1, scan_c2, etc. The default sample time is 10s. The function creates the symbols scan_offset_c$i$. Note that the offset symbols refer to the device names not to the symbols scan_c$i$. Suppose we have scan_c1=c16. In this case get_offsets() creates scan_offset_c16.
1. Example: Command line * = get_offsets(c1)
2. Example: Before_general_scan.gra:
  scan_c1 = c1 
  scan_c2 = c2 
  scan_timer = t1
  if !search_symbol(scan_offset_c1)
    s1 = get_offsets() 
  endif

mcs( mcs_id, scan_name, motor_name, start, stop, nchan, np)
The step pulses of motor_name are fed into the first channel of mcs_id. This channel serves as a preset scaler, preset = (stop - start)*conversion/np.

Whenever channel 1 reaches the preset value, it generates a LNE (load-next-event), copying the counter contents (nchan channels) to the next memory location. The counters are cleared after the copy operation.

In other words: while motor_name is moved from start to stop counters are read after preset steps.

Online creates a .fio file that contains scan results. e.g.:
* = mcs( mcs1, sname, mot1, 10, 20, 12, 1000)