A Description of Taurus Charge Shuffling at the Microprocessor Level

L G Waller

1.  Introduction

The Taurus Charge Shuffling system relies on three microprocessor systems - the CCD Controller, the Instrument Sequencer and the Taurus controller. These microprocessors are co-ordinated by the Observer/Taurus control task running on the VAX, but there are direct real-time interactions between the three microprocessors which occur at a lower level. This commentary seeks to provide a description of the operation of the Taurus Charge Shuffling operations, as it relates to these three microprocessor systems at this level, and to explain why it was implemented this way.

Detailed descriptions of the actual Charge Shuffling operation and higher level control software is given in the following references:

CCD Controller Charge Shuffling Specification, J R Barton
CCD Controller Command Summary, L G Waller
Instrument Sequencer Command Summary, L G Waller
Taurus and Observer Control Tasks, T J Farrell
The purpose of charge shuffling is to move regions of charge on the CCD into and out of an ëxposed" area (which is defined by a mask), synchronised with the switching of a optical filter (i.e. the TTF).

The shuffling of the charge is done entirely by the CCD controller. The triggering and timing of the charge shuffling is controlled by the microprocessor and the timer/counters in the CCD Controller. The switching of the TTF however, is done by the Taurus microprocessor.

2.  Background

2.1  Frequency Switching with the IPCS

Taurus was designed to switch the Etalon in response to Step numbers received from an external controller. These step numbers are received by the Taurus microprocessor on a purpose built serial data link. The detector system to which Taurus was first interfaced, was the IPCS. The IPCS Taurus control software assumed that Taurus was interfaced by a Camac parallel register (as indeed the first Taurus was). In order to accomodate these two incompatible interfaces, an Ïnstrument Sequencer" microprocessor system was developed which, when running Taurus with the IPCS, reads the Camac parallel register when a step number is issued by the IPCS, and sends it to the Taurus microprocessor down the serial link. The Taurus microprocessor is loaded with a translation table which assigns actual Etalon positions to step numbers. When a "run" is started, a step number received on the serial link is converted to an actual Etalon position and the Etalon is switched to that position. A zero step number received by Taurus indicates that the run has ended.

To summarise:

  1. Taurus' interface with the outside world for Elaton switching is via a serial link.
  2. Taurus switches the Etalon when a step number is received on the serial link. The Etalon position is defined by a pre-loaded table indexed by the step number.
  3. The Instrument Sequencer was designed to read step numbers from the IPCS via a Camac parallel register and send them to Taurus on the serial link.

2.2  Frequency Switching with a CCD Detector

With the Charge Shuffling mode, the IPCS is replaced by the CCD Controller. While the CCD Controller does have a microprocessor and can generate Step numbers during charge shuffling, it has no means by which it can send a step number to Taurus. The CCD Controller could have been modified to incorporate a serial link, but this would have required considerable development effort, and would have had to have been incorporated and fully tested in at least 3 if not all 4 CCD controllers. This would have required considerable effort to implement and test.

The only ëxternal world" output which the CCD Controller has, is a synchronisation output which it can pulse. So, to save time and reduce effort, it was decided to use the Instrument Sequencer once again, to send step numbers to Taurus, on receipt of an external synchronisation signal from the CCD Controller. All this scheme required, was the addition of a differential to single ended signal interface in the Instrument Sequencer, and the connection of this signal to an interrupt input on a parallel I/O register port.

The problem then became one of developing a method by which the sync interrupts from the CCD Controller could be associated with Taurus step numbers. Prior to running charge shuffling mode, a user created table defining the CCD Controller operation during shuffling is downloaded to the CCD Controller. This is called the "Phase Table" and contains a number of items of information. Each movement of charge during the shuffle operation is defined by a phase entry in the phase table. When charge shuffle runs, the CCD Controller microprocessor steps through the phase table executing each phase entry according to the information in the various control fields in the phase entry. The operation supports repeating one or more phase entries and repeating the entire phase table sequence. Thus, quite complicated sequences can be defined for a charge shuffle, with many operations.

One of the fields in a phase table entry is a Taurus step number. This is ignored by the CCD Controller, but a copy of the Phase Table is also downloaded to the Instrument Sequencer. The Instrument Sequencer is also programmed with the same phase table execution algorithm used by the CCD Controller (with some slight modifications). When a charge shuffling run is started by the CCD Controller, the Instrument Sequencer steps through the phase table in response to external sync interrupts from the CCD Controller. The Instrument Sequencer ignores all the fields in the phase table entries other than those related to phase table execution, and the Taurus step number. If, while executing the phase table on receipt of external syncs from the CCD Controller, a non zero Taurus step number is found, the Instrument Sequencer transmits that step number to Taurus. When the charge shuffling run completes, as determined by the Phase table, the Instrument Sequencer sends a zero step number to Taurus, which causes Taurus to terminate.

In this manner, the TTF Z-steps are triggered from the CCD Controller.

To summarise:

  1. The CCD Controller is the master timing generator for Taurus/Charge shuffling.
  2. The CCD Controller communicates with the Instrument Sequencer via a sync line.
  3. The CCD Controller and the Instrument Sequencer are both loaded with a Phase Table defining the shuffling operation and including Taurus step numbers. Taurus is loaded with a step number to Etalon position lookup table.
  4. During the shuffling operation, the CCD Controller ëxecutes" each phase in the phase table. Each phase triggers the external sync output.
  5. The Instrument Sequencer receives the sync and uses it to trigger execution of each phase in its copy of the phase table.
  6. If a phase entry has a non-zero Taurus step number, the step number is sent to Taurus.
  7. When Taurus receives a step number it converts it to an Etalon position and "moves" the Etalon to that position.
  8. When the CCD Controller and the Instrument Sequencer finish executing the phase table, the Instrument Sequencer sends a zero step number to Taurus, which then stops Etalon shifting.

3.  Command Data Flow and Logical Connections

The following diagram shows the connections between the three microprocessors involved, and the command data flow:
                           +------------+
                           |    Vax     |
                           |  Observer  |
                           |   Taurus   |
                           +------------+
                             ^   ^    ^ RS232 Links
Phase Table (incl Step Nos.) |   |    |   Step Nos. - Etalon Positions Table
          "Shuffle" command  |   |    |   "Run" command
     +-----------------------+   |    +---------------------+
     |                           | Phase Table              |
     |                           | (incl. Step Nos.)        |
     |                           | "Shuffle" command        |
     v                           v                          v
+----------+          +----------------------+          +--------+
| CCD Ctlr |----/---->| Instrument Sequencer |----/---->| Taurus |
+----------+    1     +----------------------+    2     +--------+
              Sync                             Clock+Data

4.  Physical Connections

The following detailed connections must be in place before Taurus charge shuffling can be operated:
  1. CCD Controller Sync Out to Instrument Sequencer Interrupt input. (1 twisted pair connection through 75-way system).
  2. Instrument Sequencer Serial Data output to Taurus Serial Data Input. (3 twisted pair connections through 75-way system).
  3. Taurus RS232 port connected to appropriate Cass cage terminal server port.
  4. Instrument Sequencer RS232 port connected to appropriate Control room terminal server port.
  5. The normal CCD controller connections.

5.  Pseudo Code for Phase Table Execution

On Receipt of 'pt' (Phase Table Terminate) command: Using the formula:
Total X Phases = Sigma (((1 + X Phase i Repeats) x (1 + X Phase i Offset))
                        - X Phase i Offset))

i = 1 to Number of X Phase Entries
X = Start, Run, End
On Receipt of 'cs' command (which specifies Cycles), determine:
Total Phases to Execute = Total Start Phases to Execute +
                          Total Run Phases to Execute x Cycles +
                          Total End Phases to Execute
The following pseudo code describes execution of the Running Sequence in Charge Shuffling Exposure Mode.
Set Running Status (xs == 2)

if cs_Start_Phase_Trigger = TINCR then
        Kick Start TINCR

Wait for Phase Sync Interrupt

Cycle Count = Cycles
Next Phase  = First Phase Entry
Offset Phase Count = 0
Phase Repeat Count = Next Phase Repeat Count
if Next Phase == Last Run Phase and Cycle Count > 1 then
begin
        Future Phase = First Run Phase
        Cycle Count = Cycle Count - 1
end
else
begin
        Future Phase = Next Phase + 1
end


Wait for First Phase Sync Interrupt

while Total Phases to Execute > 0 and Abort Flag False
begin

        Current Phase = Next Phase
        Next Phase = Future Phase

        Execute Current Phase

        Setup Next Phase

        if Phase Repeat Count == 0 then
        begin
                if Next Phase Offset > 0 then
                begin
                        Offset Phase Count = Next Phase Offset + 1
                        Phase Repeat Count = Next Phase Repeat Count
                        Future Phase = Next Phase - Next Phase Offset
                end
                else {Next Phase Offset == 0}
                begin
                        if Next Phase Repeat Count > 0 then
                        begin
                                Phase Repeat Count = Next Phase Repeat Count
                                Offset Phase Count = 0
                                Future Phase = Next Phase
                        end
                        else 
                        begin
                                Phase Repeat Count = 0
                                Offset Phase Count = 0
                                if Next Phase == Last Run Phase and
                                               Cycle Count > 1 then
                                begin
                                        Future Phase = First Run Phase
                                        Cycle Count = Cycle Count - 1
                                end
                                else
                                begin
                                        Future Phase = Next Phase + 1
                                end
                        end
                end
        end
        else {Phase Repeat Count > 0}
        begin
                if Offset Phase Count > 0 then
                begin
                        Offset Phase Count = Offset Phase Count - 1
                        if Offset Phase Count == 0 then
                        begin
                                Phase Repeat Count = Phase Repeat Count - 1
                                if Phase Repeat Count == 0 then
                                begin
                                        if Next Phase == Last Run Phase and Cycle Count > 1 then
                                        begin
                                                Future Phase = First Run Phase
                                                Cycle Count = Cycle Count - 1
                                        end
                                        else
                                        begin
                                                Future Phase = Next Phase + 1
                                        end
                                end
                                else
                                begin
                                        Future Phase = Next Phase -
                                                          Next Phase Offset
                                        Phase Count = Next Phase Offset + 1
                                end
                        end
                        else
                        begin
                                if Next Phase == Last Run Phase and
                                                    Cycle Count > 1 then
                                begin
                                        Future Phase = First Run Phase
                                        Cycle Count = Cycle Count - 1
                                end
                                else
                                begin
                                        Future Phase = Next Phase + 1
                                end
                        end
                end
                else
                begin
                        Phase Repeat Count = Phase Repeat Count - 1
                        if Phase Repeat Count == 0 then
                        begin
                                if Next Phase == Last Run Phase and
                                                   Cycle Count > 1 then
                                begin
                                        Future Phase = First Run Phase
                                        Cycle Count = Cycle Count - 1
                                end
                                else
                                begin
                                        Future Phase = Next Phase + 1
                                end
                        end
                        else
                        begin
                                Future Phase = Next Phase
                        end
                end
        end

        Total Phases To Execute = Total Phases To Execute - 1
        
        Test External Sync Input

        if Stop At End of Cycle Flag True then
        begin
                Reset Stop At End of Cycle Flag
                if Cycle Count > 1 then
                begin
                        if Total Phases to Execute > (Total Run Phases to 
                         Execute x Cycles + Total End Phases To Execute) then
                        begin
                                Total Phases To Execute = Total End Phases to 
                                   Execute - Total Run Phases To Execute x 
                                      (Cycles - 1)
                                Cycle Count = 1
                        end
                        else if Total Phases To Execute > Total End Phases To
                                                            Execute then
                        begin
                                Total Phases To Execute = Total End Phases to   
                                   Execute - Total Run Phases To Execute x 
                                       (Cycle Count - 1)
                                Cycle Count = 1
                        end
                end
        end

        Wait for Next Phase Sync Interrupt
end

File translated from TEX by TTH, version 0.9.