Thompson Stack Driver C Interface

tt_dac_enbl()

Synopsis:

    #include "ttdriver.h"

    unsigned short tt_dac_enbl( unsigned short safe );

Description:

Ray Dunn's D/A board supports default "safe" values for each analog output channel. On power up, each channel outputs a safe value which is selected by adjusting a potentiometer on the board. Once all the channels have been set, the programmed outputs can be enabled by calling
     tt_dac_enbl( 0 );
The outputs can be returned to the "safe" levels by calling
     tt_dac_enbl( 1 );

Returns:

Zero.

See Also:

tt_init(), tt_dac_in(), and tt_dac_out().

tt_dac_in()

Synopsis:

    #include "ttdriver.h"

    unsigned short tt_dac_in( unsigned short channel );

Description:

This is a purely software function to report what value was most recently written to the specified D/A channel. Since the board does not have a readback function, this is provided via an array in software.

Returns:

The latest value written to the specified channel or 0xFFFF if the channel number is out of range.

See Also:

tt_init(), tt_dac_in(), and tt_dac_out().

tt_dac_out()

Synopsis:

    #include "ttdriver.h"

    unsigned short tt_dac_out( unsigned short channel, unsigned short value );

Description:

Writes the specified value to the specified D/A channel.

Returns:

Zero on success. 0xFFFF if the channel number is out of range.

See Also:

tt_init(), tt_dac_in(), and tt_dac_out().

tt_gc_reset()

Synopsis:

    #include "ttdriver.h"

    unsigned short tt_gc_reset( void );

Description:

Resets the GC counter card.

Returns:

Zero on success, 0xFFFF if the GC counter board failed to respond within the timeout period.

See Also:

tt_init(), tt_gc_read(), and tt_gc_chan().

tt_gc_byte()

Synopsis:

    #include "ttdriver.h"

    unsigned short tt_gc_byte( void );

Description:

This is the lowest-level interface to the GC counter board, and proved to be somehow too time-consuming, which it hasn't proven to be.

This function reads one byte of data from the GC counter board and returns it. In order to make sense out of the returned values, one must understand the GC board's protocol.

Returns:

The value read from the GC board or 0xFFFF if the GC board has not been reset or if it has timed out since being reset.

See Also:

tt_init(), tt_gc_read(), tt_gc_reset(), and tt_gc_chan().

tt_gc_read()

Synopsis:

    #include "ttdriver.h"

    unsigned short tt_gc_read( gc_data_buf *gcbuf );

Description:

tt_gc_read()

Returns:

tt_gc_chan()

Synopsis:

    #include "ttdriver.h"

    unsigned long tt_gc_chan( unsigned short chan );

Description:

This is the preferred interface to the GC counter board from TMC. This function returns the single counter value most recently read for the specified counter channel. In order to read all the counter data, this function must be called at the GC counter's sample rate for each channel, e.g. 4 times per sample at 8 samples per second.

As with tt_gc_read(), the return values are raw values and must be converted to frequency with the following formula:

    freq = GC_REF_FREQ / sample;
where GC_REF_FREQ is the board's oscillator frequency times the number of counts per integration sample. In the current configuration, this is 5e7 * 100.0.

Returns:

The latest raw counter value for the specified channel. If no sample has been reported, zero is returned. If the GC board has not been reset or has timed out, 0xFFFFFFFF will be returned.

tt_init()

Synopsis:

    #include "ttdriver.h"

    unsigned short tt_init( void );

Description:

Returns:

tt_read_atod()

Synopsis:

    #include "ttdriver.h"

    unsigned short tt_read_atod( unsigned short channel );

Description:

This is the basic interface to the Analog to Digital Conversion board.

Returns:

The value read for the specified channel or 0xFFFF if the channel number is out of range or the routine timed out before receiving an acknowledge from the A/D board.

tt_read_digital()

Synopsis:

    #include "ttdriver.h"

    unsigned short tt_read_digital( unsigned short dig_word );

Description:

Reads the 8-bit value from the specified digital word. Reading from the digital output words is supported in software. Note that this function addresses 8 digital channels at once. Individual channels can then be singled out by appropriate masking.

Returns:

The 8-bit word from the specified channel or 0xFFFF if the word address is invalid for either an input port or an output port.

tt_write_digital()

Synopsis:

    #include "ttdriver.h"

    unsigned short tt_write_digital( unsigned short dig_word, unsigned short value );

Description:

Writes the specified 8-bit value to the specified digital word. Note that this function addresses 8 digital channels at once. Direct control of individual channels is possible via the tt_scdc_command() function.

Returns:

0 on success, 0xFFFF if the word address is invalid.

tt_scdc_command()

Synopsis:

    #include "ttdriver.h"

    unsigned short tt_scdc_command( unsigned char cmd_no );

Description:

This function commands a single digital output line. The cmd_no argument is either the digital output channel number or the channel number plus 100. If cmd_no >= 100, the corresponding output line is set, otherwise it is reset.

Returns:

0 on success, 0xFFFF if the specified cmd_no is invalid.

tt_scdc_multcmd()

Synopsis:

    #include "ttdriver.h"

    unsigned short tt_scdc_multcmd( unsigned char *cmds );

Description:

This function implements the SCDC MULTCMD function, which allows a list of SCDC commands to be executed simultaneously. In the ttdriver implementation, the commands cannot be guaranteed to be simultaneous, but they will occurr within a few microseconds of each other. (On ARP hardware, the commands are actually strobed together.) The cmds argument points to an array of SCDC command numbers ending with 0xFF.

Returns:

0 on success, 0xFFFF if an invalid command is encountered.


Return to Manuals Guide (c)1995 Norton T. Allen