RB8515_clock Class Reference
[RB8515 Clock for Time Delay]

#include <rb8515_clock.h>

Inherits RulbusDevice.

List of all members.


Detailed Description

Purpose

Generate a clock signal for the time delay module RB8514.

Description

Module RB8515 is a clock signal generator for time delay module RB8514.

It provides four fixed frequency outputs, three identical clock outputs with programmable frequency and a Rulbus interrupt output with programmable frequency.

   Output        | Description
   --------------+-----------------------------------------------------------
   Ffixed        | fixed frequencies:
                 | 100 kHz, 1 MHz, 10 MHz and 100 MHz
                 |
   Fprogrammable | programmable frequencies:
                 | 0 Hz (disabled), 100 Hz, 1 kHz, 10 kHz, 100 kHz, 1 MHz, 10 MHz and 100 MHz.
                 |
   Finterrupt    | programmable Rulbus interrupt frequency:
                 | 0 Hz (disabled), 1 Hz, 5 Hz, 10 Hz, 50 Hz, 100 Hz, 500 Hz, 1 kHz.
   

When a clock is opened, it is configured as follows:

Usage

Here is a small example how you may use a clock module.

   Rulbus::RB8515_clock clock( "clock" );

   clock.setClockFrequency(  10e6  );

Implementation

Module RB8515 contains a 100 MHz oscillator, a 10 MHz oscillator, several divider ICs and logic to select the output frequency and to select the interrupt frequency. An on-board jumper selects the oscillator used.

The module has a a control-register to select the programmable clock- and interrupt frequencies and it has a status-registers to read the interrupt status.

   Register      | Offset  Rd/Wr   Description
   --------------+-----------------------------------------------------------
   Status        | 0       read    status register
                 |                 76543210
                 |                 7        : interrupt pending
                 |                  6543210 : not used
                 |
   Control       | 0       write   control register
                 |                 76543210
                 |                 7        : interrupt enable and /clear pending interrupt
                 |                  6       : interrupt enable
                 |                   543    : interrupt frequency
                 |                            0: disabled
                 |                            1:   1  Hz
                 |                            2:   5  Hz
                 |                            3:  10  Hz
                 |                            4:  50  Hz
                 |                            5: 100  Hz
                 |                            6: 500  Hz
                 |                            7:   1 kHz
                 |                      210 : clock frequency
                 |                            0: disabled
                 |                            1: 100  Hz
                 |                            2:   1 kHz
                 |                            3:  10 kHz
                 |                            4: 100 kHz
                 |                            5:   1 MHz
                 |                            6:  10 MHz
                 |                            7: 100 MHz
   


Public Member Functions

Construction
public methods

 RB8515_clock (NameCref name, Addr addr=DEF_ADDR, Rack rack=DEF_RACK)
 constructor; may throw RulbusOpenError.

 ~RB8515_clock ()
 destructor.

Accessors
Freq clockFrequency () const
 the current clock frequency.

Freq interruptFrequency () const
 the current interrupt frequency.

bool isPendingInterrupt ()
 true if interrupt is pending; a pending interrupt is cleared.

bool isEnabledInterrupt () const
 true if interrupt is enabled.

Mutators
void setClockFrequency (Freq aFrequency)
 set clock frequency; may throw RulbusRangeError.

void setInterruptFrequency (Freq aFrequency)
 set interrupt frequency; may throw RulbusRangeError.

void clearInterrupt ()
 clear pending interrupt.

bool disableInterrupt ()
 disable interrupt.

bool enableInterrupt (bool enable=true)
 enable or disable interrupt.


Protected Member Functions

void getClkFreqCode (Freq aFrequency, IntPtr pCode) const
 map clock frequency to register code; may throw RulbusRangeError.

void getIntFreqCode (Freq aFrequency, IntPtr pCode) const
 map interrupt frequency to register code; may throw RulbusRangeError.

void getFreqCode (Freq aFrequency, const FreqTable *tablePtr, IntPtr pCode) const
 using specified table, map frequency to register code; may throw RulbusRangeError.

Construction and Assignment
 RB8515_clock ()
 prevent default construction

 RB8515_clock (RB8515_clockCref rhs)
 prevent copying

RB8515_clockRef operator= (RB8515_clockCref rhs)
 prevent copying


Private Types

Clock frequency codes
enum  {
  FC_INVALID = -1, FC_0Hz = 0, FC_100Hz, FC_1kHz, FC_10kHz, FC_100kHz,
  FC_1MHz, FC_10MHz, FC_100MHz
}
Interrupt frequency codes
enum  {
  FI_INVALID = -1, FI_0Hz = 0, FI_1Hz, FI_5kHz, FI_10Hz, FI_50Hz,
  FI_100Hz, FI_500Hz, FI_1kHz
}

Private Attributes

Data
Byte theCtlByte
 control byte


Static Private Attributes

Register offsets
const int OFF_CR = 0
 control-register offset

const int OFF_SR = 0
 status-register offset

const int ADR_WIDTH = OFF_SR + 1
 address with

Masks and shifts
const int MSK_CLKFRQ = 0x07
 bit-mask clock frequency

const int MSK_INTFRQ = 0x38
 interrupt frequency

const int MSK_INTENA = 0x40
 interrupt enable

const int MSK_INTCLRn = 0x80
 interrupt enable & /clear

const int MSK_INTSTS = 0x80
 interrupt status

const int SHL_CLKFRQ = 0x00
 shift left # bits clock freq.

const int SHL_INTFRQ = 0x03
 shift left # bits interrupt freq.

Defaults
const Addr DEF_ADDR = 0xC8
 default address

const Freq DEF_CLKFRQ = 1e3
 default clock freq. (1 kHz)

const Freq DEF_INTFRQ = 0e0
 default interrupt freq. (disable)

Tables for frequency--code mapping
FreqTable clkTable []
 table to map clock frequency to register code.

FreqTable intTable []
 table to map interrupt frequency to register code.


Member Enumeration Documentation

anonymous enum [private]
 

Enumeration values:
FC_INVALID  sentinel
FC_0Hz  disabled
FC_100Hz  100 Hz
FC_1kHz  1 kHz
FC_10kHz  10 kHz
FC_100kHz  100 kHz
FC_1MHz  1 MHz
FC_10MHz  10 MHz
FC_100MHz  100 MHz

anonymous enum [private]
 

Enumeration values:
FI_INVALID  sentinel
FI_0Hz  disabled
FI_1Hz  1 Hz
FI_5kHz  5 Hz
FI_10Hz  10 Hz
FI_50Hz  50 Hz
FI_100Hz  100 Hz
FI_500Hz  500 Hz
FI_1kHz  1 kHz


Member Data Documentation

RB8515_clock::FreqTable clkTable [static, private]
 

Initial value:

   {
        0  ,  FC_0Hz    << SHL_CLKFRQ,  
      100e0,  FC_100Hz  << SHL_CLKFRQ,  
        1e3,  FC_1kHz   << SHL_CLKFRQ,  
       10e3,  FC_10kHz  << SHL_CLKFRQ,  
      100e3,  FC_100kHz << SHL_CLKFRQ,  
        1e6,  FC_1MHz   << SHL_CLKFRQ,  
       10e6,  FC_10MHz  << SHL_CLKFRQ,  
      100e6,  FC_100MHz << SHL_CLKFRQ,  
        0  ,  FC_INVALID,               
   }

RB8515_clock::FreqTable intTable [static, private]
 

Initial value:

   {
        0  ,  FI_0Hz   << SHL_INTFRQ,   
        1e0,  FI_1Hz   << SHL_INTFRQ,   
        5e0,  FI_5kHz  << SHL_INTFRQ,   
       10e0,  FI_10Hz  << SHL_INTFRQ,   
       50e0,  FI_50Hz  << SHL_INTFRQ,   
      100e0,  FI_100Hz << SHL_INTFRQ,   
      500e0,  FI_500Hz << SHL_INTFRQ,   
        1e3,  FI_1kHz  << SHL_INTFRQ,   
        0  ,  FI_INVALID,               
   }


The documentation for this class was generated from the following files:
Generated on Tue Oct 12 14:12:05 2004 for Rulbus Device Class Library for Microsoft Windows by doxygen 1.3.4