Introduction

This document describes how the TRACE instrument executes science sequences.

The Basic Concepts

Frame Processing

TRACE is an imaging instrument. The basic process of acquiring image data is called taking a picture. The software has a mechanism for taking individual pictures via telecommand (ICCMTPS). The software can also take a seri es of pictures using a built-in intepretter called the Sequencer. The former is used almost exclusively during instrument testing while the latter is used both in ground test and operations. In either case, the Control Compu ter (CC) configures the instrument to take a picture based on parameters in the Frame Definition Block (FDB). The image data is automatically routed directly to the Data Handling Computer (DHC). Whenever camera image data arrive s at the DHC, the DHC issues an interrupt to the CC. The CC waits, if necessary until all processing of the previous frame has been completed. The CC then supplies a set of options and parameters to the DHC to define all image processing to be done on the data and initiates a DHC queue program. A single DHC queue program will handle all cases (of normal observing). The DHC processing occurs in two phases. Phase I determines if certain events, such as flares have occurred. These events can effect t he flow of the sequence. The DHC issues another interrupt to the CC upon completion of phase I. The CC instructs the DHC to continue data processing (phase II) and resumes execution of the sequence. The DHC issues an additional interrupt to the CC when all processing of the image has been completed.

Frames are readout from the camera into alternate DHC memory pages; specifically, page 0, and page 1. This Ping-Pong effect is transparent to the sequence writer. This allows picture taking overlap a little bit with image processing.

Frame processing flow is shown in Figure 1. Actions in the left column are DHC while those on the right are CC. Note that DHC operations are in two separate pieces. The processing that results in INT0 is performed by a queue program that is invoked by the CCD camera frame. The second part, which performs phase I and phase II processing is performed by a queue program that is invoked by the CC using the BeginMac instruction. The CC fields the INT2 in the background; therefore, if the previous frame processing has been completed prior to INT0, there is no delay between the INT0 and the start of phase I processing.

Figure 1 Frame Processing

Sequence Processing

Once during each execution of its synchronous polling loop, the control computer main loop calls the sequencer. The sequencer executes sequence instructions until it either encounters an instruction that requires a return to the CC main loop or it has executed 10 instructions. The instruction limit can be altered by a telecommand. Sequence instructions are described in section 0.

Starting Sequences

A sequence or set of sequences is started by the Spacecraft Computer System (SCS) by executing a single time-tagged command. The command is called the new sequence command. Sequence initiation is described in section 0.

Sequence Generation Process

There will be some sort of graphic user interface (GUI) for the science planner/observer to use. This application will create ASCII files in a language suitable for compilation into observing sequences. The compiler will create another file that contains blocks of instruction in the language of the TRACE Control Computer Observation Sequencer (SQOPT). A linker then converts these files into microprocessor Load files. These files are sent to the Command Management System (CMS), where they are scheduled for uplink. Once loaded to the CC, sequences are coded blocks in memory that are translated by the on-board software to realize the observing plans. The sequence generation process is shown in Figure 2. Additional details about the sequence generation process are described in other documents (Name sometime or refer to the web).

Figure 2 Sequence Generation Process

Sequences

Sequence Definition

A sequence is a block of memory that contains sequence instructions. Sequences always start with a either a SETID or VID instruction followed by the ID and a pointer to the next sequence. The sequence initiation process finds ID's by searching through this linked list. After a sequence starts, the sequence executes instructions in the block until either the sequence runs to completion, is supplanted by another sequence, or encounters a severe error.

Variables and Built-ins

General

Variables are used to control sequence flow and repetition and to allow a variation of sequence parameters not possible if only literal values were allowed. All variables are 16 bit integers. Variables are stored in single words in memory. These words are called registers and sometimes I use the terms interchangeably. There are 256 registers available at any time. The first 48 registers appear in housekeeping telemetry

Local Variables

The first 16 registers are treated a local variables, i.e., when a sequence calls another sequence, the first 16 registers are pushed onto a stack and are restored when the sequence ends. Local variables are not cleared when a sequence is called from another sequence, so locals can be used to pass information forward. Registers 14 and 15 have a special purpose. When a sequence is started from a NewSequence telecommand, its ID is place in registers 14 and 15. This allows the ID of the top level sequence to always be available in telemetry. The sequencer makes no special effort to preserve the integrity of these registers.

Global Variables

Global variables are a method for sharing parameters between sequences. Registers 16 - 27 and 48 - 99 are available for general usage. Registers 27 - 47 contain built-in variables. 100 - 159 are used by the ExecuteList built-in sequence, 160 - 247 are reserved, and 248 - 255 (by convention) are used as a scratch pad by code generated by the ground-based compiler.

Built-in Variables

Built-ins are variables and parameters that are dedicated to well defined aspects of the TRACE observations. These include things like the location of the IMAX, the indicator that a flare event has happened, or the number of flare buffers available. Some built-ins are values returned from the DHC. Built-in variables are described HERE.

Telemetry Considerations

Registers 0 - 47, i.e., the local variables, built-ins, and the first 12 user globals appear in housekeeping telemetry. The telemetry update rate is once per 5 seconds.

Sequence Instruction Set

General Description

Sequence instructions have op codes that are 1 byte long. Most instructions have 1, 2, or 3 operands. A few have 0 and one (SETREGS) have a variable number of operands. In most cases, operands may be immediate or register. In general, bits 3,2, and 1 indicate the type of operands 1, 2, and 3 respectively. A 1 indicates immediate while a 0 indicates register. Instructions that contain address references, e.g., branch instructions, interpret the operand as an address in sequence space. If the operand is a register, it is defined by a single byte; otherwise, the operand is defined by 2 bytes. All branch addresses are bound checked prior to execution. Detailed information about sequencer instructions with links to the sequencer code may be found HERE.

Telecommands

General

This section describes telecommands that are associated with TRACE Science Sequences. This section describes commands in terms on mnemonics and fields. For the detailed coding of commands, refer to the TRACE Instrument Data Base.

NewSequence (ICSQSTR)

The New Sequence Command starts a list of sequences. The command format is:

ICSQSTR NSEQ=N,PRIORITY=P,SEQ1L=XXXX,SEQ1H=XXXX,....,SEQNH=XXXX

the NSEQ field contains the number of sequences in the command. The PRIORITY field is 0 for low priority and non-zero for high. SEQIL and SEQIH are the high and low words of the sequence ID for sequence I in the list.

Figure 3 Sequence Initiation

Sequence Stop (ICSQSTOP)

The sequence stop command causes the current sequence to end. As with sequence start, any incomplete frame or pointing is completed prior to actually stopping the sequence.

Sequence Pause ICSQPAUS)

The sequence pause instruction puts the sequence into paused state. The resume command is the only command that can remove the paused condition. Neither sequence start nor sequence stop have any effect on a paused sequence.

Sequence Resume (ICSQRESM)

The sequence pause instruction puts the sequence into paused state. The resume command is the only command that can remove the paused condition. Neither sequence start nor sequence stop have any effect on a paused sequence

Set Register(s) (ICSQREG)

This command sets the specified sequence register to the specified value. The format is:

ICSQREG REG=N,VALUE=V

Sequence operations does not require the capability to set registers via telecommand; however, the capability does exist. One possible use is to synchronize telecommand and sequence activities.

Take a Picture (ICCMTPS)

The take a picture command is the telecommand equivalent to the FRMPF sequencer instruction. The format is:

ICCMTPS PZT=P,FOCUS=F,ECW=E.

PZT and FOCUS fields are not required. The required ECW field is the exposure control word. ICCMTPS uses a built-in FDB called the Default Frame Definition Block (DFDB). The DFDB is initialized to take a full frame image and transfer it to the spacecraft mass memory uncompressed and unpacked. The ECW specifies the exposure duration and wavelength. The DFDB can be modified using the flags command (ICDPFLGS).

Configure Wedges (ICGTWCNFR)

The configure wedges command is the telecommand equivalent to the STTG sequencer instruction. The format is:

ICGTWCNFR wedge1=W1,wedge2=W2

The CC steps the wedge from their current position to requested positions using the same rules as the STTG instruction. Note that as with the instruction, W2 is a wedge position as defined by the ACS ICD and is thus 180 - motor position.

Configure Optics (ICDPCONF)

The configure optics command has no direct analog in the sequence instruction domain. It is, however equivalent to the device configuration phase of the take picture state machine. The format of the command is:

ICDPCONF FW1=F1,FW2=F1,QS=Q

F1, F2, and Q are the desire positions for filter wheels 1 and 2 and the quadrant selector. This command simplifies the process of getting the instrument to a desired configuration.

Frame Definition Block

The Frame Definition Block (FDB) contains the parameters that define the attributes of a single exposure. The format of the FDB is shown in FrameDefinition Block Description.

Wavelength Table (WLT)

The WLT contains up to 32 instrument configurations. The WLT is shown in the table below and described in the paragraphs that follow. The CC accesses the WLT using the 5 bit wavelength field in the exposure control word. Each WLT entry contains 8 bytes of configuration information.. The CC flight software has a no wavelength table built-in; so, it must be loaded. The most recent version of the wavelength table can be found HERE.

the load table command.

WL Entry Byte BIT
7 6 5 4 3 2 1 0
00 F1A
1
F1DB
2 F2A
3
F2DB
4 QSA
5
QSDB
6 FMA
7
FMDB
18-15 Same as 0-7 for Wavelength 1
216-31 Same as 0-7 for Wavelength 2
etc.
Wavelength Table

Filter Wheel 1 Direction Bits (F1DB)

F1DB is a two bit field that describes the direction in which filter wheel 1 moves for this configuration. The field values are as follows:

0: clockwise

1: counterclockwise

2: shortest path to the target address

3: no move.

No move allows take a picture while maintaining the current configuration.

Filter Wheel 1 Address (F1A)

F1A is the eight bit address of filter wheel 1 for this configuration. Note that while there are only four desirable positions of the wheel, i.e., that correctly position a filter, this table may contain any address.

Filter Wheel 2 Direction Bits (F2DB)

F2DB contains the direction bit field for filter wheel 2. See F1DB.

Filter Wheel 2 Address (F2A)

F2A is the eight bit address of filter wheel 2 for this configuration. See F1A.

Quadrant Selector Direction Bits (SQDB)

SQDB contains the direction bit field for the quadrant selector. See F1DB.

Quadrant Selector Address (SQA)

SQA is the eight bit address of quadrant selector for this configuration. See F1A.

Focus Mechanism Direction Bits (FMDB)

FMDB contains the direction bit field for the focus mechanism. The focus mechanism is not a rotating device. A 3 in this 2-bit field results no move while all other state result in a move.

Focus Mechanism Address (FMA)

FMA is the eight bit address of focus mechanism for this configuration. See F1A. Since the focus mechanism has no position encoder, the CC maintains an internal counter of the focus position and issues a series of increment or decrement position command to achieve the desired position.

Pointing Control Table (PCT)

The PCT contains pointing and target selection information for 64 targets. The PCT is explained in Pointing Control Table Description.

PZT Offset Table (PZOT)

The PZOT is a table that contains 16 entries. Each entry contains 3 8-bit values, one for each PZT. If the PZT qualifier is selected on the frame command, the CC uses 3 values from PZOT at the specified index as the PZT strain gauge offsets. If the qualifier is not specified, the CC uses values at offset 0. The format of PZOT is shown in the table below.

Byte->
Entry
123
0 (Default)PZTA0PZTB0PZTC0
1 (Default)PZTA1PZTB1PZTC1
2-15etc.
PZT Offset Table

Automatic Exposure Control Table (AECT)

General Description

The AECT controls automatic exposure adjustment. The format is shown in the table below and described in the paragraphs that follow. AECT contains 128 entry. The sequencer accesses the AECT by creating a 7 bit index from the Target Class (TC) in the Pointing Control Table and Wavelength Index (WLI) in the Exposure Control Word (ECW). TC supplies the upper 2 of the AECT index while the WLI supplies the lower 5.

Usage Concept

There are 128 AEC entries. One accesses these by a combination of the wavelength and the characterization of the target. The idea is that one will have to maintain different exposure times for each wavelength (CUR). In addition, some AEC parameters may be different for different type of targets. For each wavelength one would have four different AEC parameters sets, one for each target class. See paragraph 0 for more details.

AEC EntryBit->
Byte
7 6 5 4 3 2 1 0
00DEF
1CUR
2SUP
3SDN
4PAH
5PAL
6OEC
7UEC
18-15Same as 0-7 for AEC 1
216-31Same as 0-7 for AEC 2
etc.
AEC Control Table

Parameter Descriptions

DEF

DEF contains the default index to the exposure table for this wavelength. The concept is that one starts taking pictures at a given wavelength using DEF and the AEC algorithm eventually adjusts the exposure to the right level.

CUR

CUR contains the most recently determined automatic exposure for this wavelength. It is an index to the exposure table.

SDN

SDN contains a number to subtract from CUR if the AEC algorithm determines the image is overexposed.

SUP

SUP contains a number to add to CUR if the AEC algorithm determines the image is underexposed.

PAH

Percentage of the area used for the AEC test that must be overexposed to reduce the exposure time.

PAL

Percentage of the area used for the AEC test that must be not be underexposed to maintain the current exposure time.

OEC

OEC is the DN level in a CCD (output) pixel that indicates the pixel is overexposed.

UEC

UEC is the DN level in a CCD (output) pixel that indicates the pixel is underexposed.

Frame Processing

General

This section describes what happens when CC executes a frame instruction. The description is in four sections. The first describes what the sequencer does with the instruction. The second describes the CC take picture processing which occurs in response to what the sequencer has done. The third describes what the sequencer does when it resumes following the INT1. The last section describes the processing that occurs in the DHC.

Frame Processing by the Sequencer

General Description

When the sequencer executes the frame instruction, or when the CC receives a take picture telecommand, a CC function called DecodeFrame executes. This function transforms information in a number of tables into 4 structures that define the desired hardware configuration and another that defines the processing that is to occur in the DHC. The sequencer then sets a flag that initiates the CC configure and take a picture process. The sequencer resumes once the DHC has completed phase I processing. Figure 4 shows the tables and structures involved. The sections that followed describes the details of that transformation.

Figure 4 CC Frame Processing

Exposure Index

If the specific exposure bit is set in the exposure control word (ECW), the exposure index comes from the IND field in that word. If not set, the exposure index is determined by the ECW, the Pointing Control Table (PCT), and the AEC Table. The 7-bit AEC index is created from the 5 bits in the wavelength field of the ECW and the 2-bit Target Class (TC) from the current target, TC begin the upper 2-bits. The DEF bit is clear (0) in the ECW, the current AEC is the base index; otherwise the default is the base index. Finally, the signed AECO field from the ECW is added to the base index to create the exposure index. Figure 5 show this process.

Figure 5 Exposure Index Generation

Device Control Table (DCT)

The Device Control Table (DCT) is shown in the table below. The wavelength field in the ECW times 8 is an index to the Wavelength Table. The 8 byte entry is copied to the DCT. If the focus qualifier is specified on the telecommand or frame instruction, the signed focus offset is added to the focus address.

ByteContentsDescription
0FW1 Address
1FW1 Direction Bits0:default; 1:CW; 2:CCW; 3:No Move
2FW2 Address
3FW2 Direction Bits0:default; 1:CW; 2:CCW; 3:No Move
4QS Address
5QS Direction Bits0:default; 1:CW; 2:CCW; 3:No Move
6Focus Address
7Unused
Device Control Table

PZT Control Table (PZCT)

The PZCT contains 3 PZT strain gauge offsets. If the PZT qualifier is selected on the frame instruction or the take picture command, the value of the qualifier times 3 is an index to the PZT Offset Table. If it is not specified, zero is used as the index. The three values at that index are copied to the PZCT.

Camera Control Table (CCT)

The tables below show the format CCT and how OFFSET and LENGTH are created from camera mode (CM) and other parameters. PRV is the central position value of the previous frame, i.e., 512, $MXR or $MNR. AMP contains 0 for amplifier A, 1 for B, or 2 or 3 for current. OffsetA and OffsetB contain the current or requested offset. EnableA and EnableB are 0 if the related offset has been requested and non-zero when it has been implemented.

Bit Positions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
XSUM
YSUM
OFFSET
LENGTH
AMP
EnableBOffsetB EnableAOffsetA
Camera Control Table

CMXSUMYSUMOFFSETLENGTH
011N/AN/A
122N/AN/A
244N/AN/A
388N/AN/A
411512- ES*32ES*64
511PRV- ES*32ES*64
611$MXR- ES*32ES*64
711$MNR- ES*32ES*64
CCT Generation

Image Processing Block

General Description

The Image Processing Block (IPB) contains the information needed by the DHC to perform all image processing on the camera frame. Most of the information in the IPB is in the FDB. The IPB has been reformatted to made processing in the DHC more efficient.

The IPB is shown in the table below and described in the paragraphs that follow.

Word(s)NameDescription
0SPGSource Page
1BPTBad Pixel Table
2BPYOBad Pixel Y Offset
3BPYLBad Pixel Y Length
4-5P1SAStart Address
6P1NCNumber of Columns
7P1NRNumber of Rows
8P1RL Row Length
9P1BFBinning Factor
10SFSuper Flare Flag
11SFHBSuper Flare Histogram Bin
12-13SFHCSuper Flare Histogram Counts
14FFFlare Flag
15FHBFlare Histogram Bin
16-17FHCFlare Histogram Counts
18AECXExecute AEC
19AEHBAEC High Bin
20-21AEHCAEC High Pixel Count
22AELBAEC Low Bin
23-24AELCAEC Low Pixel Count
25TFTransient Event Flag
26TMULTransient Multiplier
27-28TPCTransient Event Count
29DTDark Transient
30TAITime Average Interval
31T0Start of a Time Average
32IMXMaximum
33IMNMinimum
34-39SPARE
40-55FCP2PFull Camera Output Parameters
56-71A1P2PArea0 Phase II Parameters
72-89A2P2PArea0 Phase II Parameters
Image Processing Block

Source Page (SPG)

Camera image output data alternates between (DHC) page 0 and page 1. The CC automatically toggles the address in the CCD header. SPG reflects the address of the current and is 0 for page 0 and 080016 for page 1.

Bad Pixel Table (BPT)

BPT indicates which of the bad pixel tables to use. There are eight tables, one for each summing mode and amplifier. If this number is greater than 7, bad pixels are not removed.

For CM=0,1, 2, or 3, BPT = AMP*4+CM. For CM > 3, BPT = AMP*4.

Bad Pixel Y Offset (BPYO)

BPYO is the Y offset parameter used by the Bad Pixel and Bad Column instructions. It is the row number of the first row read from the camera, i.e., it is 0 for full reads and the starting row for partials.

Bad Pixel Y Length (BPYL)

BPYL is the Y Length parameter for the bad pixel and bad column instructions and is the total number of rows read from the camera.

Phase I Area Geometry

There are 5 parameters that define the phase I area. These are described in the paragraphs that follow.

Phase I Area Start Address (P1SA)
The P1SA is the (DHC) start address of the image data to be used for phase 1 processing. The upper 5 bits of the address define the page number. The remainder of the discussion in this section deals with the (20-bit) address within the page.

If ED in the frame block is 0, this contains the address of the first image pixel that arrives at the DHC and is always 51416.

If ED is 1, this contains the address of the first pixel in area1 and P1SA is given by Equation 3 Rccd and Cccd are the reference row and column for area1, and RLcm is the row length for various summing modes (see the table below).

Equation 3 P1SA for ED=1 and On-Chip Summing

CMRL
0,4-71040
1528
2272
3144
Row Length vs. Camera Mode
Phase 1 Row Length (P1RL)
The table below shows RL for all camera modes.

Phase 1 Number of Rows (P1NR)
P1NR is ES*64 if ED = 0 and A1RB*64 if ED =1.

Phase 1 Number of Columns (P1NC)
P1NC is RL-16 if ED = 0 and A1RC*64 if ED =1.

Phase 1 Binning Factor (P1BF)
P1BF is 2FCB if ED=0 and 2A1B if ED=1.

Flare Flags, Histogram Bins, and Count Levels

The DHC indicates a flare or super flare event if the counts in a (cumulative) histogram bin exceed a value. The FDB contains a count rate and pixel count. These are converted to histogram bin and counts in that bin by the CC. These conversion are described below. FF and SF in the IPB are copies FF and SF from the frame block.

Histogram Bin (SFHB or FHB)

Equation 4 Histogram Bin Number for Flares and Super Flares
Equation 4 shows the conversion of event count rate to histogram bin (HB). ECR is event count rate (FCR or SFCR). EXPT is the exposure time in seconds. CM is the camera summing mode where 1=1x1, 2=2x2, etc. OFFSET is a built-in table of amplifier offsets. The counts (DN) that read out from the camera include an (amplifier) offset. The offset is different for each summing mode and amplifier but is (essentially) independent of exposure time (provided the CCD is cold). Because of AEC, the sequence writer may not know the exposure time; therefore, the CC adjusts the flare and super flare thresholds for this offset. The CC converts the threshold counts by multiplying by the exposure time then to counts per output element (summed pixels) by multiplying by the summing mode squared. The CC then adds the offset associated with the current summing mode and amplifier. This number is divided by 32 and rounded to match the DHC histogram generation method which creates a 128 element histogram form 12-bit (0-4095) values.

Histogram Counts (SFHC and FHC)

Equation 5 Histogram Counts for Flares and Super Flares
Equation 5 shows the conversion of event pixel count to histogram counts (HC). EPC is the Event Pixel Count (FPC or SFPC). CM is the camera summing mode where 1=1x1, 2=2x2, etc. EVB is the Event Binning (FCB or A1B) that happens in the DHC.

Automatic Exposure Control Flags

AECX reflects the state of EXEC in the exposure control word of the frame block. If AECX is non-zero, the DHC executes the AEC algorithm. If it is set, AEC count levels and areas are converted to bin numbers and counts per bin.

AEC Bin (AEHB and AELB)
AEHB and AELB are the bin numbers in the 128 bin histogram associated with overexposure and underexposure. AEHB is (OEC*32 + OFFSETCM,AMP)/ 32 while AELB is (UEC*32 + OFFSETCM,AMP)/32.

AEC Pixel Counts (AEHC and AELC)
AEHC and AELC are the pixel counts associated with overexposed and underexposed images. The CC converts the percentage of area from the AEC table to a number of pixels. Equation 6 and Equation 7 show the conversion for Full camera (ED=0) and area1 (ED=1) event detection. PAX is percentage high (PAH) or percentage low (PAL) parameters from the AEC table.

(RLcm- 16) * ES * 64 * PAX


100 * (FCB+1)2

Equation 6 AEC Counts for ED=0

A1RB * A1CB * 4096 * PAX


100 * (A1B+1)2

Equation 7 AEC Counts for ED = 1

Transient Flags

There are 5 parameters associated with processing transient events. TF, TMUL, TPC, and TAI, are direct copies of the same parameters in the FDB. T0 is set if this is the first sample of a time average. T0 is set by the STARTAVE sequencer instruction and cleared after its first use.

Transient detection is designed to look for a relative brightening of darkening of the image. The process seeks to detect if some area has increased or decreased in brightness by some proportion. The DHC's TRDETECT instruction calculates SourceData*SourceScaleFactor + ReferenceData*ReferenceScaleFactor and returns the count of pixels for which the result is negative. If the result is greater than the transient pixel count (TPC), then a transient event has occurred. For transient detection, the source and reference data may be single images or averages. The first image or average collected is the initial reference. The next image or average becomes the source. After the transient detection, the source becomes the reference and the process continues. For a bright transient, the source is the new data, while for a dark transient, the source is the old data. In both cases, the source scale factor is -100 and the reference scale factor is TMUL. TMUL should be greater than 100 for the process to work correctly.

Maximum and Minimum Flags (MX and MN)

These flags are a direct copy of MX and MN flags in the FDB.

Area Phase II Parameters

General
A frame can include up to three areas: one that is the full area read from camera and up to 2 other sub- areas. The IPB include a 22 word section for each area that defines the phase II processing associated with the area. The are block is show in the table below shows the format of the area definition blocks. The paragraphs that follow define how the area parameters are set.

Word(s)NameDescription
0OUTOutput Flag
1TMSArea Time Samples
2TM0Area First Time Flag
3-4SAArea Starting Address
5NCArea Number of Columns
6NRArea Number of Rows
7RLArea Row Length
8BMArea Binning Mode
9APIDArea Application ID
10CMPArea Compression
11QT/PCKJPEG Quantization Table or Packing Size
12HT/LUTJPEG Huffman Table or Lookup Table Number
13QMJPEG Quality Indicator
14 -15SPAREUnused
Area Parameters

Output Flag (OUT)
If OUT is 0, there is no output from the area. If FFFF16, the data is output directly. If anything else, the output is queued.

Time Averaging Parameters
There are 2 parameters associated with time averaging. TMS is the number of sample in the time average. If 0 or 1, the data is not time averaged. T0 indicates this is the first sample of a time averaged set.

Area Geometry
There are 5 parameters associated with the source field definition. These are constructed in the same fashion as the phase 1 geometry parameters. See paragraph 0 for details.

Application ID (APID)
The area application ID determines if the data goes to a flare file or the chronological file. APID is 6010 for chronological file. Flare file APID depends on the current flare buffer and is 61, 63, 65, or 67 for buffers 1, 2, 3, or 4 respectively.

Compression parameters
There are 4 words that define the final stage of output. In general, output is either compressed using a 12- bit JPEG algorithm, or it is output directly with a optional lookup table stage. Output that is not JPEG compressed, maybe packed, i.e., the lower n-bits of source words are packed into 16-bit output words. The parameters that define JPEG, packing and lookup are a direct reflection of those same parameters, split into words for easy processing by the DHC.

Take Picture Processing

This section describes the processing that happens in the main part of the CC code. There are five parts to the CC processing: configuring devices (including the camera); taking the picture; processing the frame gate interrupt (INT 0); transferring the status and processing block to the DHC; and, processing the end of phase I (INT 1).

Configuring Devices Taking the Picture Processing the Frame Gate Interrupt (INT 0) Initiating Phase I Processing

The CC transfers Local On-Board time, the current state of all housekeeping telemetry, the Frame Definition Block, and the Image Processing Block to the data transfer buffer at address 10316 (259). This ensemble is called the Status and Processing Block. See the tables below for details. It then executes the DHC BeginMac instruction using the built-in (queue vector) address 1. The program at this address performs all phase I and phase II activities.

Word(s)NameDescriptionSubsystem
0-31SA17HKSub-address 17 HousekeepingControl Computer
32-63SA18HKSub-address 18 HousekeepingPower
64-95SA19HKSub-address 19 HousekeepingThermal
96-127SA21HKSub-address 21 HousekeepingCamera
128-159SA22HKSub-address 22 HousekeepingDHC
160-191SA23HKSub-address 23 HousekeepingGT/ISS
192-223SA25HKSub-address 25 HousekeepingIntegrated Functions
224-255SA28HKSub-address 28 HousekeepingSequence Registers
256-287SA30HKSub-address 30 HousekeepingDevices
Houskeeping Summary Block

Word(s)NameDescriptionDetails
0 - 2LOBTLocal On-Board Time See Trace-Spec-006 Vol.1 Par.2.3.1.2.2.2
3-290HSTHousekeeping Summary Block
291-306FDBFrame Definition Block
307-394IPBImage Processing Block
Status and Processing Block

Processing the Phase I Interrupt (INT 1)

When the phase I interrupt occurs, the CC transfers the phase I results to an area that can be accessed by the sequencer, issues an enable queue instruction to the DHC, and sets a flag which the sequencer uses to determine that phase I is complete. The CC continues to monitor the DHC interrupt and when it receives an INT 2, the CC sets a flag that indicates completion of frame processing and allows the next frame to proceed to phase I.

Sequencer Post-processing

The sequencer resumes processing after phase I is complete. The results of phase I processing (shown in the table below) are placed in the data transfer buffer by the DHC image processing program. The sequencer must transfer the flags that are associated with events, adjusts the automatic exposure time, and transform IMAX or IMIN location to CCD amplifier A row and column. The paragraphs that follow describe the detailed processing of these results by the sequencer.

Word(s)NameDescription
0FEFFlare Event
1SEFSuper Flare Event
2TEFTransient Event
3ADJAEC Adjustment
4IMXVIMAX Value
5-6IMXLMaximum Count Location
7IMNVIMIN Value
8-9IMNLMinimum Count Location
10-11SPAREUnused
Image Processing Results

Event Processing

The three sequencer flags $FEF, $SEF, and $TEF are each set to the state of the related flag in the results block if the event was requested in the frame block.

AEC Adjustment

ADJ can be 0, if no adjustment should be made, -1 if the exposure time should be decreased, and 1 if the exposure should be increased. If the AEC execute flag was set in the frame block, and ADJ is -1 or 1, then CUR in the AEC table now in use, is either decrease by DN of increased by UP.

IMAX and IMIN Values and Locations (IMXV,IMXL,IMNV,IMNL)

IMXV and IMNV are contain the value of the pixel at IMXL or the IMNL location. The value is in DN. The location is in DHC memory address offset from the start of the Phase I processing area. The IMAX and IMIN parameters are valid if requested by the FDB (MX or MN respectively). The IMAX parameters are also valid if a flare or super flare event was requested and occurred. If a transient event was requested and detected, the location is in IMXL and the IMXV is 1. In all other cases, the IMAX and IMIN parameters are 0. The sequencer will convert extrema locations (IMXL,IMNL) to amplifier A row and column only if the respective extrema was requested in the FDB. In cases where IMXL was returned by the DHC through not requested, i.e., an event has occurred, the sequencer instruction UPDIMAX will replace the existing IMAX location with this one.

Converting Extrema Locations to Row and Column

The CC converts the address to camera row and column as follows:

ROW = (LOC/(P1NC/P1BF) * P1BF + (P1SA-1300)/RLCM) * XSUM + Rccd

COL = (LOC Mod (P1NC/P1BF)) * P1BF + (P1SA-1300) mod RLCM) * YSUM

LOC is the Extrema location (IMXL or IMNL). Rccd is the number of first CCD row that reads out (0 for full camera reads and the first row in the region of interest for partial camera reads). If amplifier B is currently selected, the row and column are subtracted from 1023 to get amplifier A equivalent parameters.

DHC processing

The DHC processing contains three major sections: frame gate processing (phase 0); event detection (phase I ); and, output processing (phase II). These section happen sequentially with CC intervention between each section. Phase 0 is initiated by the arrival of a camera frame. Frame gate processing is a single standalone queue program. Phase I and phase II processing is accomplished by another queue program which is invoke directly by the CC using the BeginMac instruction. The sections that follow describe the Processing during each phase.

Phase 0

The Phase 0 program is invoked automatically by the camera frame. The camera image data is preceded by 256 words of header information and a 1040 word engineering line. The most of the header is unused. It is a remnant of the previous program (MDI) for which the camera design had been used. Some parts of the first 10 word section are still used in the TRACE application to route the camera data to a specific DHC memory page and to invoke a queue program via a vector. The vector is a byte that contains the address of a location in the queue which contains the address of the queue program to execute. For TRACE, the queue vector is set to 0. Whenever a CCD camera frame arrives at the DHC, the DHC invokes the queue program whose address is stored at queue location 0. This program extract CCD temperatures from the engineering line using the AVGTEMPS DHC instruction, issues an interrupt with code 0 to the CC and ends.

Phase I

General Description

Phase I processing is invoked by the CC using the BEGINMAC instruction. The instruction parameter is the vector which is set to 1. The purpose of PHASE I is to determine is any requested events have happened and to return a block of image results to the CC. The DHC program signals completion of PHASE 1 by executing a SETIRPT instruction with the instruction parameter set to 1 (INT 1).

Detailed Processing Flow

Phase I processing involves the following steps:
  1. Input data block from CC and adjust time words.
  2. If testmode flags set execute test mode otherwise continue with normal mode.
  3. Execute initialization routine (P1_InitSub)
  4. Execute flags routine (P1_FlagSub)
  5. Unless test mode is FFFD, execute bad pixel routine (P1_BadPixSub)
  6. If safety flag is set, execute the safety routine (P1_SafetySub)
  7. If the do something flag is not set, go to interrupt generation
  8. Mark Phase I parameter as source and execute the bin/extract routine (BinExtSub)
  9. If the histogram flag is set, execute the histogram routine (P1_HistSub)
  10. If an event has been detected, go to interrupt generation.
  11. If the transient flag is set, execute the transient detection routine (P1_TransSub)
  12. If a transient has been detected, go to interrupt generation
  13. If extrema have been requested, but not yet been determined, execute the extrema routine (P1_ImaxSub)
  14. Interrupt generation

Each of these steps is described in the paragraphs that follow.

Input Data and Adjust Time Words

The program clears the new frame flag set by phase 0 and saves the CCD frame address (the page into which the frame was written by the camera). Then InitLiteralSub is called to preset some registers. The program then reads 394 words from the DTB into register space at address 259. Finally, timewords 1 and 3 are swapped. This last step is required as the CC passes the (3) timewords in the reverse order from CCSDS.

Initialization Routine (P1_InitSub)

The Initialization Routine clears the results block to all zeroes. If the testmode flag is FFFC, the routine sets the CCD alert flag. (This feature allows testing the CC portion of the CCD safety procedure without concern for the content of the image data). The nine processing flags and the transient done flag are cleared. Lastly, the program sets some flags associated with transient accumulation.

Flags Routine (P1_FlagSub)

The Flags Routine examines a variety of parameters in the Image Processing and sets a few flags to indicate which processing steps are required. If Flare, SuperFlare, or AEC is requested, the histogram flag is set. If max or min are requested, the max flag is set. If a transient if requested and this is the last frame in the transient average, the transient flag is set. The safety bit in the FDB is isolated and used to set the safety check flag. The routine also sets the do something flag is any phase 1 processing is required.

Bad pixel Routine (P1_BadPixSub)

The Bad Pixel routine uses the parameters in the IPB to select a bad column table, and executes the BADCOL instruction. It then determines the address of a bad pixel table and executes the BADPIX instruction.

Safety Routine (P1_SafetySub)

Creates a histogram of a full CCD image frame binned to 8x8. Tests a specific bin and if the counts in that bin exceed a threshold increments the danger frame counter and clears the safe frame counter. If the danger frame counter exceeds the danger counter threshold, set the danger flag in the return block. If the histogram bin does not exceed the threshold, increment the safe frame count. If the safe frame count exceeds the safe frame threshold, clear danger frame counter.

BinExtract Routine (BinExtSub)

BinExtSub is a general purpose routine used in both phase 1 and phase 2 to extract and/or bin a region of interest from the source page (where the camera placed the image) into page 7. The caller places the address of the parameters for the region into a variable and the routine moves those parameters to a set of registers using the COPYRI2D instruction. The routine then sets up a call to either BINNXN of EXTRACT instruction (both use the the same parameters set). The routine then executes either BINNXN or EXTRACT based on the state of the bin parameter in the parameter set. If the image is binned, the routine determines the length of the output field. Finally the routine sets the(32 bit) parameter DPLENGTH to the length of the output image and set the x, y and rowlength of the output in the (3 word) array XYRLEN.

Histogram Routine (P1_HistSub)

The histogram Routine executes the histogram instruction (HIST128) on the region of interest, determines which of the request events if have occurred, and sets flags accordingly. If AEC is requested, the high (overexposure) threshold is tested. If it is not exceeded, then the low threshold is tested. AEC flags are set in accordance with the results. The AEC hogh threshold count is shifted right by 3. This satisfies a late requirement to have the high threshold be in units of eigths of percents. If either IMAX or IMIN is requested, the MAX and/or MIN locations and values are trasferred to the results block (HIST128 returns the max and min for free). If a flare or superflare event has been detected, the IMAX location and value is placed in the results block even if IMAX had not been requested.

Transient Detection Routine (P1_TransSub)

The routine first tests if the transient detecion is using a single image or an average. If it is an average, the averaging is performed by calling SumSub and AvgSub. The routine then sets up the call parameters to the TRDETECT instruction. If the request is for a dark transient, the source is the old data, while if the request is for a bright transient, the source is the new data. In both cases, the source multiplier is -100 and the reference multiplier is TMUL from the IPB. The routine test the result of TRDETECT with the threshold (TPC) and if TPC is greater of equal to the results, a transient has occurred and the transient flag in the results block and the internal event flag is set. If a transient is detected, the program must recreate the functions of the TRDETECT instruction to find the location of the transient. This is done by using the SCALESUM instruction using -100 and TMUL as the mulitpliers. The routine uses the IMIN instruction to find the minimum value of the SCALESUM result and returns that location in the results block as the IMAX location. The IMAX value is set to 1.

Extrema Routine (P1_ImaxSub)

This routine executes the FINDMAX and/or FINDMIN instructions based on the states of the FINDIMin and FINDIMAX flags in the IPB. The results are returned in the results block. The main part of the phase 1 processing check if the extrema were set by the histogram routine. If so, P!_ImaxSub is not called.

Interrupt Generation

Upon complete of all phase I processing (DoPhase1Sub), the main program (ObservingMain) transfer the results block to the Data Transfer Buffer (DTB) and execute a SETIRPT instruction with a interrupt value of 1.

Phase I Test Mode

The Phase I test routine sets the (12 word) results block to 0,1,...11. Test mode is invoked only if the normal mode flag is 0 and the testmode flag is FFFF16.

Phase II

General Description

Phase II processing continues directly from phase 1 processing once the queue is enabled by the CC following the INT1. Phase II is a formatting and output operations. For each output area, the program determines if processing is required. If so, it performs the processing. In general, processing an area results is data output. An area is also processed but not neccessarily output if the area is a time average. In the time average case, the area is output only when the averaging is complete. There is little communication between the operations done in phase I and those done in phase II. The only exception is time averaged fields that are used for transient detection. Since the transient detection is done in phase I, the average has already been computed. In this case, phase II uses the result from phase I rather than redoing the processing steps.

Detailed Processing Flow

Phase II processing involves the following steps:
  1. If testmode flags set execute test mode otherwise continue with normal mode.
  2. Execute initialization routine (P2_InitSub)
  3. For each of the three fields, copy the field parameters and execute the Phase II output routine (P2_OutSub) which consists of
    1. If the field is not averaged and not output, Exit
    2. Mark the current field as the source and bin or extract the field (BinExtSub)
    3. If the field is averaged, average the field (P2_AvgSub); if the average is not complete, Exit
    4. Check field output flag and if not set Exit.
    5. If the field requires compression, compress it (P2_JpegSub)
    6. If Lookup is requested, perform lookup (P2_LutSub)
    7. If Packing is requested, pack the field (P2_PackSub)
    8. Initialize High Speed Serial (HSS) output (P2_HSSInitSub)
    9. If there was a timeout, Exit
    10. Do the final output formatting and perform the output (HssOutSub)
  4. Upon return from ouput routine, if a timeout occurred, throw an error; otherwise, go on to the next field.

Each of these steps is described in in the paragraphs that follow.

Initialization (P2_InitSub)

The Phase 2 Initialization Routine checks a flag set in phase 1 if a transient test had produced a data product. If so, the result, which phase 1 left in 7:90000 is moved to 2:90000.

Bin/Extract Routine(BinExtSub)

If the data product had been created in phase 1, it is moved from 2:90000 to 7:0. If not, The BinExtSub is called to extract and/or bin the field to page 7:0.

Time Averaging Routine(P2_AvgSub)

If field is averaged, P2_AvgSub is called to perform the averaging. If this is the first sample, the averaging count is forced to a legal value (1-16) and the time words are saved. If the image is the first sample of a set, the current image data (in 7:0) is moved to 2:0. If the image is not the first sample, the data in 7:0 is added to the data in 2:0 with the result placed in 6:0. The result is then returned to 2:0. All averages are accumulated in 2:0. If the image is the last sample in a average, the accumulated sum is averaged using the fimrware's USCALE instruction. The result is placed in 7:0.

Final output flag check (rationale)

The phase 2 code takes a last look at the output flag at this point. If it is not set, the field processing is complete. Because a field could be averaged, perhaps for transient detection, phase 2 must go through the code that performs field extracts, binning and averaging. Delaying checks the output flag until this point allows those activities to occur even if the field is never destined to be output.

Compression Routine (P2_JPegSub)

Lookup table routine

Pack Routine (P2_PackSub)

Hss Initialization (P2_HssInitSub)

Hss Output (HssOutSub)

Timeout Error Generation

Additional Processing Notes

Phase II Test Mode

Data Product Header

Each data product is preceeded by a data product header. The header is different for each of the major data product types: Normal Image Mode; Test Mode; Jitter Mode: Dump Mode. The first three words for all data types contain a two word synchronization marker (352EF85316 followed by a type indicator. The type codes are: The type field is defined as follows:

  • 0: Raw 16-bit data (Normal Mode)
  • 1: JPEG (Normal Mode)
  • 8: 8-bit packed (Normal Mode)
  • C: 12-bit packed (Normal Mode)
  • FFFF: Unformatted camera frame (252+1040*1033) (Test Mode)
  • FFF0: Jitter Mode Data
  • FFF2: Page Dump Data (Dump Mode)
  • FFF4: Register Dump Data (Dump Mode)
  • FFF6: Data Transfer Buffer (Dump Mode)

    Normal Mode Data Product Header

    The table below and the paragraphs that follow describe the normal mode data product header.

    Word(s)NameDescriptionDetails
    0-1SYNCSynchronization Marker352EF85316
    2TYPEGeneral Data Type Indicator
    3 - 397FPBStatus and Processing Block
    398-409IPRImage Processing Results
    410-411DPLData Product LengthData Product Word Count
    412OWPOne Word PadData Product has a one word pad
    413SAISource Area Index0: full frame; 1: Area 1; 2 Area 2
    414-416LOBT0Local On-board Time of Image 0Applies to time averages
    417-424PURGETable Purge ResultsParameters Used and returned by PURGETAB
    425AP0CNTAPID0 CounterNumber of APID 0's encountered since last reset
    426-439SAFETYCCD Safety ParamtersCCD Safety Counters and Thresholds
    440-504SPAREUnusedTBD

    Data Product Header

    Type

    The type code is defined as follows:

  • 0: Raw 16-bit data (Normal Mode)
  • 1: JPEG (Normal Mode)
  • 8: 8-bit packed (Normal Mode)
  • C: 12-bit packed (Normal Mode)

    DPL

    DPL contains the data prodcut length in words. It includes the length of the header (505) and perhaps one extra word that is not part of the data prodcut (see OWP).

    OWP

    The DHC to Spacecraft interface requires that data transaction are in integer number of double words, i.e., it is a 32 bit interface. The DHC must therefore sonetimes add an additional word since data products are of arbitrary length. If and extra word has been added, OWP is 1: if not, it is 0.

    SAI

    SAI indicates whic of the three fields (areas) is contained in this data product.

    LOBT0

    If the area is time averaged, LOBT0 contains the timeword of the first sample in the average. If it is not time averaged, the field is meaningless.

    PURGE

    Purge Contains the results of the most recent DHC table purge (EDAC Error Sweep). The details of this 8 word block is as follows: ADD SOMETHING LATER

    AP0CNT

    AP0CNT counts the occurances of APPLICATION ID 0 (APID0). Whenever the normal mode program encounters a request to output APID0 if AP0CNT is 0, it generates DHC error A000. On each occurance of APID0, AP0CNT is incremented by 1. APID 0 occurs if the CC sequences receives a request to output data to a small buffer but none are available. The queue program flags only the first occurance of APID 0. Unless the count is reset by ground command, the error will occur only once each 65536 frames that request APID0.

    SAFETY

    This section contains the current state of the parameters used for the automatic CCD safety features. Details about this section can be found HERE.

    SPARE

    The remained of the header is unused.

    Last Update: 01/08/98 CC Version 1.2e DHC Version 1.2b

    Name: Michael Levay