Drivers for S.Ha.R.K.

 

Contents

PCI interface module (PCI6025E)
Analog input module (ADC)
Analog output module (DAC)
Digital lines module (DIO_PPI)
General porpuse counters/timers (TIM)

 

 

 

 

 

 

PCI interface module

 

 

 

Files

Filename

click to view code

Description Functions
PCI6025E.H

PCI6025E.C

REGCONST.H

Contains variables and functions used to interface with PCI bus and some other useful functions like interrupt set-up, PFI management and Internal Timebase and frequency output manager. REGCONST.H contains DAQ-STC and board registers address

BYTE find_NI_Device(void)
BYTE reMap(void)
void DAQ_STC_Windowed_Mode_Write(WORD address, WORD value)
WORD DAQ_STC_Windowed__Mode_Read(WORD address)
BYTE setIntClock(BYTE tbs, BYTE divBy2, BYTE divider)
void PFIprogramming(WORD pfi)
void INT_personalize(BYTE personal)
void INT_setup(BYTE ga, BYTE gb)
void bitfield(BYTE dim, DWORD value)
void TEST_bitfield(BYTE dim, DWORD value, char *str)
Immediate_Writex(addr, val)[macro]
Immediate_Readx(addr)[macro]

 

 

 

 

 

 

 

 

 

 

Back to Top

 

 

Function Description

BYTE find_NI_Device(void)

This function scans the PCI bus searching National Instruments boards and when one is found structure NIDevice_Info[x] is filled with board's data. When more than one NI is found structure is filled in right way but driver can manage only the first board that is loaded

This function return number of PCI boards found

You haven't to call this function because is called by reMap function

Back to PCI Interface Module section

BYTE reMap(void)

PCI E Series board are mapped direct to memory. In Shark OS memory are linearly organized so direct access over 1MB is immediate. Otherwise if you want re map board under 1MB memory you can do this through this function. No argument must be passed because into .h file there's two "#define" which define MITE base address and BOARD base address.

This function, like you see watching code, call find_NI_Device and if no boards is found returns 0. Otherwise if function terminates successfully returns 1

Call this function after Shark function pci_init() and before any other board related function

Back to PCI Interface Module section

void DAQ_STC_Windowed_Mode_Write(WORD address, WORD value)

DAQ-STC has more than 180 16-bit registers. Too memory is requested to map all registers on memory. Thus Windowed Memory is implemented. When you want read or write one DAQ-STC's register you must call this function passing register address and value you want write. It's important to notice that while windowed access uses much time that direct access it's important that during this operation interrupts are disabled to avoid collision, data losing or data modification

I think you don't need to call this function because it is called by function written in this driver. If you call this function pay attention about register you are going to manipulate and the mean of its bits because you can damage both board and external circuit
Parameter Description
WORD address

DAQ-STC register address. In file REGCONST.H you can find a symbolic name associated with register address

WORD value

Value you want write into DAQ-STC register

 

 

 

Back to PCI Interface Module section

WORD DAQ_STC_Windowed_Mode_Read(WORD address)

Like the function above this is used through windowed accessing to read a DAQ-STC register's value. Watch above to understand mean of parameter "address".

This function return value stored in register

Back to PCI Interface Module section

BYTE setIntClock(BYTE tbs, BYTE divBy2, BYTE divider)

This function sets the internal timebase to work with a software selectable frequency from 20MHz to 100 KHz. It's also enable frequency output system (FOUT) which can provide on pin 50 a square wave with base frequency of Internal Timebase also divided by "divider" value

Parameter Description
BYTE tbs This is the timebase divisor by 100. If you put this to 1 internal timebase is 200 KHz otherwise it is 20 MHz
BYTE divBy2 Further frequency divisor by 2. If sets to 1 internal timebase is divide by two otherwise it isn't divided
BYTE divider This third divider acts only on Frequency output system so on frequency you can get from pin 50. This divider can assume value from 0 to 15. If 0 frequency is divided by 16 otherwise is divided by the number specified into the parameter.

 

 

 

 

 

 

This function return 0 if there's an error into the parameters, otherwise return 1

Back to PCI Interface Module section

void PFIprogramming(WORD pfi)

With this function you can configure the PFI lines. PFI can be configured as a generic input line or as a specific output line. You can see in 6025E User Manual the meaning of each PFI line when is configured like output.

Parameter Description
pfi

This parameter must be programmed bit by bit. The first ten bit are connected to the PFI lines. If you set a bit related PFI line is configured as an output line otherwise PFI line is configured as an input. Bits from ten to eleven aren't used. Please pay attention when you are configuring the lines because you may damage both board and external circuit

 

 

 

 

 

Back to PCI Interface Module section

void INT_personalize(BYTE personal)

Use this function to select the logic level that will indicate an interrupt condition on IRQ_OUT pins and to enable or disable the possibility of duplicate selected interrupt to IRQ_OUT<0..1> pins

Parameter Description
personal

This parameter must be programmed bit by bit. If you set bit 0 signal duplication is enabled otherwise is disabled. With bit 1 you can select interrupt polarity: 0 stand for active high, 1 stand for active low (usually PC uses active low). Other bits aren't used

 

 

 

 

Back to PCI Interface Module section

void INT_setup(BYTE ga, BYTE gb)

Use this function to enable interrupt group and to select onto which line interrupt signal will be driven. Group A manage interrupt connected with AITM, IRQ_IN0 and TIMER 0. Otherwise Group B is connected with AOTM, IRQ_IN1 and TIMER 1.

Parameter Description
gA

Both parameters use the first three bits (0..2) to indicate onto which line drives interrupt signal. Fourth bit enable (if set) or disable (if clear) interrupt group

gB

 

 

 

Back to PCI Interface Module section

void bitfield(BYTE dim, DWORD value)

void TEST_bitfield(BYTE dim, DWORD value, char *str)

This two function are useful to print (not in graphic mode... I'm sorry) a register value bit by bit. I use this function to check registers value during operations set up. The second function differs from the first only for the little feature that prints the "str" string before prints register value.
Parameter Description
dim

Dimension in byte of the second parameter. Example: BYTE has dimension 1; WORD has dimension 2; and so on...

value

Value which will be printed on screen

str

only for TEST_bitfield

This string will be printed before printing value

 

 

 

 

Back to PCI Interface Module section

Immediate_Writex [macro]

Immediate_Readx [macro]

These two groups macro write or read directly into memory. The final x stand for "b" that means BYTE or for "w" that means WORD. With Immediate_Writex you must pass first address and second value which will be written into memory. Otherwise with Immediate_Readx only address must be passed.

Example: Immediate_Writeb(0x0C, 0xFF) writes at offset 0x0C value 0xFF

In REGCONST.H you must find address of the most useful board's registers.

Back to PCI Interface Module section

Analog Input Module

 

 

I'm sorry but driver's routine for ADC isn't tested yet

I hope It will be finished for the next snapshot

Back to Top

Analog Output Module

 

 

 

With this module you can program the Analog Output Timing Module (AOTM) of the DAQ-STC and the two DACs on board. Into DAQ-STC there are two timing module for output operations. I only program the first module leave the second module for the next snapshot. Timing module is important but could be substituted with SHARK timing functions and using only the function which access directly DACs output registers.

Files

Filename

click to view code

Description Functions
DAC.H

DAC.C

 

Contains variables and functions used to interface with the two 12-bit DACs present on PCI 6025 E. There are both functions used to program the DAQ-STC AOTM and to set up and use the DACs

void DAC_reset(void)
void DAC_boardInit(BYTE clock, WORD personal)
void DAC_trigger(WORD trigger)
void DAC_numSetup(DWORD n_updates, DWORD n_iter)
void DAC_update(BYTE source, BYTE ui)
void DAC_channel(BYTE multi, BYTE num)
void DAC_LDACSourceUpdate(BYTE pref)
void DAC_stopError(BYTE error)
void DAC_FIFOFlags(BYTE flags)
void DAC_enableInterrupts(WORD itr)
void DAC_arm(void)
void DAC_startOperation(void)
void DAC_Init(void)
void DAC_output(BYTE DAC_ID, WORD value)

 

 

 

 

 

 

 

 

 

 

 

Back to Top

 

 

Function Description

 

void DAC_reset(void)

Reset two DACs and into DAQ-STC the associated timing system

Call this function before any DAC's operation or set up

Back to DAC Interface Module

void DAC_boardInit(BYTE clock, WORD personal)

With this function the most common options, like source pin or polarity for the AOTM, can be selected.

This function must be called after DAC-reset but before any other operation.

Parameter Description
clock

Only the first two bit are used: bit 0 specifies if AI_TIMEBASE must be divided by 2 and bit 1 specifies if OUT_TIMEBASE must be divided by two. Other bits aren't used

personal bit 0..1 select the polarity of the UPDATE output signal
  • 0 High Z
  • 1 GND
  • 2 Enable active low
  • 3 Enable active high
  • bit 2..4 not used
    bit 5 specifies the pulse width of output update signal
  • 0 3-3.5 OUT_TIMEBASE period
  • 1 1-1.5 OUT_TIMBASE period
  • bit 6 is used to select the update signal timebase
  • 0 AO_UPDATE pulse width
  • 1 AO_UPDATE original
  • bit 7 not used
    bit 8 sets the DMA PIO control
  • 0 FIFO DATA interface mode
  • 1 un buffered control mode
  • bit 9 not used
    bit 10 if sets enable the TMRDACWR (TiMeR DAC WRite) which control the analog output FIFO
    bit 11 selects the FIFO flags polarity
  • 0 active low
  • 1 active high
  • bit 12 selects the TMRDACWR pulsewidth
  • 0 3 OUT_TIMEBASE period
  • 1 2 OUT_TIMEBASE period
  • bit 13 not used
    bit 14 selects the number of DAC packages
  • 0 dual-DAC mode
  • 1 single-DAC mode
  • bit 15 not used

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    Back to DAC Interface Module

    void DAC_trigger(WORD trigger)

    With this function it's possible to set which signal trigger the analog output operations

    Parameter Description
    trigger bit 0..4 START1 source select
  • bitfiled AO_START_1 pulse
  • 1..10 PFI 0..9
  • 11..17 RTSI 0..6
  • bit 5 edge detection
  • 0 disable
  • 1 enable
  • bit 6 synchronization
  • 0 disable
  • 1 enable
  • bit 7..12 NOT USED
    bit 13 START1 signal polarity
  • 0 active high
  • 1 active low
  • bit 14 synchronized with BC source
  • 0 disabled
  • 1 enabled
  • bit 15 continuos mode
  • 0 enabled
  • 1 disabled
  •  

     

     

     

     

     

     

     

     

     

     

     

    Back to DAC Interface Module

    void DAC_numSetup(DWORD n_updates, DWORD n_iter)

    With this function you can select the number of iterations that must be performed and the number of update that must be made into each iteration

    Parameter Description
    n_updates

    number of updates that must be made in each iteration

    n_iter

    number of iterations that must be made

     

     

     

    Back to DAC Interface Module

    void DAC_update(BYTE source, BYTE ui)

    Use this function to select where get the update and the UI event

    Parameter Description
    source bit 0..4 update source select
  • 0 internal timebase
  • 1..10 PFI 0..9
  • 11..17 RTSI 0..6
  • bit 5 polarity of update signal
  • 0 rising edge
  • 1 falling edge
  • bit 6..7 not used
    ui bit 0..4 ui source select
  • 0 internal timebase
  • 1..10 PFI 0..9
  • 11..17 RTSI 0..6
  • bit 5 polarity of ui source signal
  • 0 rising edge
  • 1 falling edge
  • bit 6..7 not used

     

     

     

     

     

     

     

     

     

     

     

    Back to DAC Interface Module

    void DAC_channel(BYTE multi, BYTE num)

    With this function you can select how many DACs you want update every UPDATE pulse

    Parameter Description
    multi If different from 0 multiple channels update is enabled
    num

    Number of channel updated every UPDATE pulse

    With PCI 6025 E only two DACs are available

     

     

     

     

    Back to DAC Interface Module

    void DAC_LDACSourceUpdate(BYTE pref)

    Use this function to set source and update mode for LDAC<0..1> signals

    Parameter Description
    pref bit 0 LDAC0 source
  • 0 LDAC0 will output on UPDATE signal
  • 1 LDAC0 will output on UPDATE2 signal
  • bit 1 DAC0 update mode
  • 0 DAC0 update immediately
  • 1 DAC0 timing update mode
  • bit 2 same as bit 0 but for LDAC1
    bit 3 same as bit 1 but for DAC1
    bit 4..7 not used

     

     

     

     

     

     

     

    Back to DAC Interface Module

    void DAC_stopError(BYTE error)

    With this function you can select under which error conditions AOTM must be stopped

    Parameter Description
    error bit 0 stop on BC_TC error
    bit 1 stop on BC_TC trigger error
    bit 2 stop on overrun error
    bit 3..7 not used

     

     

     

     

    Back to DAC Interface Module

    void DAC_FIFOFlags(BYTE flags)

    This function allows to select which FIFO flags can assert an Interrupt or DMA request

    Parameter Description
    flags bit 0..1 flags choice
  • 0 Empty FIFO
  • 1 less than HALF FULL FIFO
  • 2 less than FULL FIFO
  • 3 less than FULL FIFO but keep asserted until FIFO isn't full
  • bit 2..7 not used

     

     

     

     

     

    Back to DAC Interface Module

    void DAC_enableInterrupts(WORD itr)

    Through this function you can enable which signal will de driven onto an Interrupt Request Line.

    Parameter Description
    flags bit 0 BC_TC interrupt
    bit 1 START1 interrupt
    bit 2 UPDATE interrupt
    bit 3 START interrupt
    bit 4 not used
    bit 5 error interrupt
    bit 6 UC_TC interrupt
    bit 7 not used
    bit 8 FIFO flags interrupt
    bit 9..15 not used
    Sets each bit to enable related interrupt or clear to disable interrupt request generation signal

     

     

     

     

     

     

     

     

     

    Back to DAC Interface Module

    void DAC_arm(void)

    Use this function to arm counters into AOTM module of DAQ-STC. When AOTM is armed also the first values is preloaded into DACs

    Back to DAC Interface Module

    void DAC_startOperation(void)

    When software trigger is selected with this function analog output operation can be started. Otherwise is hardware trigger is selected call this function has no effects

    Back to DAC Interface Module

    void DAC_Init(void)

    This function must be called previous any operation and reset the DACs calling DAC_reset prepare the environment to work configuring the two available DACs

    Back to DAC Interface Module

    void DAC_output(BYTE DAC_ID, WORD value)

    This function writes directly into a DAC output register so "value" is immediately got out as analogic value

    Parameter Description
    DAC_ID bit 0 Identify DAC into write
  • 0 DAC0
  • 1 DAC1
  • value bit 0..11 value put in DAC register
    bit 12..15 not used

     

     

     

     

    Back to DAC Interface Module

    Digital lines Module

     

     

    With this module it's possible to manage the eight (DIO 0..7) digital lines provided by DAQ-STC and the additional 24 digital lines provided by OKI MSM82C55A Programmable Peripheral Interface

    Files

    Filename

    click to view code

    Description Functions
    DIO_PPI.H

    DIO_PPI.C

     

    Contains variables and functions used to interface with the eight plus twenty four digital lines provided from the board

    void DIO_init(void)
    void DIO_resetReg(void)
    void DIO_config(BYTE cfg)
    BYTE DIO_read(void)
    void DIO_write(BYTE out)

     

    void PPI_init(void)
    void PPI_resetReg(void)
    void PPI_config(BYTE cfg)
    BYTE PPI_read(BYTE port)
    void PPI_write(BYTE port, BYTE val)

     

     

     

     

     

     

     

     

     

    Back to Top

     

     

    Function Description

     

    void DIO_init(void)

    Initialize the eight digital lines provided by DAQ-STC

    Back to DIO_PPI Interface Module

    void DIO_resetReg(void)

    Force all digital lines as output and force their value to 0

    Back to DIO_PPI Interface Module

    void DIO_config(BYTE cfg)

    With this function each line of the eight provided by DAQ-STC can configured separately from the others

    Parameter Description
    cfg Each bit configures a digital line: bit 0 configures DIO 0... bit 7 configures DIO 7. If you set a bit related digital line is configured as input otherwise as output

     

     

     

    Back to DIO_PPI Interface Module

    BYTE DIO_read(void)

    Read DAQ-STC's digital lines configured as input. Where a line is configured as output value read is 0

    Back to DIO_PPI Interface Module

    void DIO_write(BYTE out)

    Puts on digital lines the "out" value. Only line configured as output can be accessed. Other lines during output operations are forced to 0

    Back to DIO_PPI Interface Module

    void PPI_init(void)

    Initialize the 24 digital lines provided by MSM82C55A

    Back to DIO_PPI Interface Module

    void PPI_resetReg(void)

    Force all digital lines as output and force their value to 0

    Back to DIO_PPI Interface Module

    void PPI_config(BYTE cfg)

    With this function you can configure MSM82C55A to work in one of its three available modes

    Parameter Description
    cfg bit 7 when sets tells chip that configuration words are going to come
    bit 5..6 set up port A mode: Mode 0 1 2
    bit 6 0 0 1
    bit 5 0 1 X
    bit 4 Sets direction of port A byte
  • 0 output
  • 1 input
  • bit 3 Sets direction of the higher first four bits of port C
  • 0 output
  • 1 input
  • bit 2 Sets mode for port B
  • 0 Mode 0
  • 1 mode 1
  • bit 1 Sets direction of port B byte
  • 0 output
  • 1 input
  • bit 0 Sets direction of the lowest first four bits of port C
  • 0 output
  • 1 input
  •  

     

     

     

     

     

     

     

     

     

     

     

     

     

    Back to DIO_PPI Interface Module

    BYTE PPI_read(BYTE port)

    Reads eight digital lines from MSM82C55A

    Parameter Description
    port Specifies which port must be read. Possible values are:
  • PPI_PORT_A
  • PPI_PORT_B
  • PPI_PORT_C
  •  

     

     

    Back to DIO_PPI Interface Module

    BYTE PPI_write(BYTE port, BYTE val)

    Writes into a MSM82C55A port the value specified with "val"

    Parameter Description
    port Specifies which port must be read. Possible values are:
  • PPI_PORT_A
  • PPI_PORT_B
  • PPI_PORT_C
  • val Specifies the value that must be sent out

     

     

     

     

     

    Back to DIO_PPI Interface Module

    General Purpose Timers/Counters

     

     

     

    This is the module that controls the General purpose 24-bit timers/counters provided by DAQ-STC. Differently from other modules there aren't function which must be combined to obtain that counters count but each function programs a counter to perform a specified action like counting events or measuring time. In this first snapshot Position sensing and pulse generation aren't implemented. I'm sorry but form my Thesis this features aren't useful. I hope I can put them in the next snapshot.

    Files

    Filename

    click to view code

    Description Functions
    TIMER.H

    TIMER.C

     

    Contains variables and functions used to interface with two general purpose counters/timers provided by DAQ-STC

    void TIM_reset(BYTE counter)
    void TIM_arm(BYTE counter)
    void TIM_disarm(BYTE counter)
    DWORD TIM_readCounter(BYTE counter)
    DWORD TIM_readHWSaveReg(BYTE counter)
    void TIM_eventCounting(BYTE counter, BYTE source, BYTE gate, BYTE interrupts, DWORD in)
    void TIM_bufferedEventCounting(BYTE counter, BYTE source, BYTE gate, BYTE cumulative, DWORD in)
    void TIM_timeMeasurement(BYTE counter, BYTE source, BYTE gate, BYTE type, BYTE interrupts, DWORD in)
    void TIM_timeMeasurement(BYTE counter, BYTE source, BYTE gate, BYTE type, BYTE type, DWORD in)

     

     

     

     

     

     

     

     

     

     

    Back to Top

    void TIM_reset(BYTE counter)

    This function must be called before any operation with timers. It resets the specified counter and the related DAQ-STC's registers

    Parameter Description
    counter Specifies which counter must be resected. Possible values are:
  • C0 (0) Counter 0
  • C1 (1) Counter 1
  • other values both counters
  •  

     

     

     

    Back to Timers/Counters Interface Module

    void TIM_arm(BYTE counter)

    This function must be called after all setting operation because making counters begin count. Parameter "counter" has the same meaning of previous function's parameter

    Back to Timers/Counters Interface Module

    void TIM_disarm(BYTE counter)

    Calling this function make counters stop counting (but counters aren't resected). See above for parameter "counter" meaning

    Back to Timers/Counters Interface Module

    DWORD TIM_readCounter(BYTE counter)

    Use this function to read counters value while they are counting without disturbing them

    Parameter Description
    counter Specifies which counter must be resected. Possible values are:
  • C0 (0) Counter 0
  • other values Counter 1
  •  

     

     

    It is not possible read both counters content at the same time

    Back to Timers/Counters Interface Module

    DWORD TIM_readHWSaveReg(BYTE counter)

    During buffered operation like buffered event counting or buffered time measurement, counters when an interrupt occurred save their values into Hardware Save Registers. With this function it's possible accessing and reading these registers

    Meaning of parameter "counter" is the same of previous function

    Back to Timers/Counters Interface Module

    void TIM_eventCounting(BYTE counter, BYTE source, BYTE gate, BYTE interrupts, DWORD in)

    This function sets up specified counter to perform a gated (if you want) events count. You must specify source line, gate line, which interrupts must be enabled and an initial value that will be loaded into the counter

    Parameter Description
    counter Specifies which counter must be resected. Possible values are:
  • C0 (0) Counter 0
  • other values Counter 1
  • source bit 0..4 Source selection
  • 0 IN_TIMEBASE_1
  • 1..10 PFI 0..9
  • 11..17 RTSI 0..6
  • 18 IN_TIMEBASE_2
  • 19 Other G_TC
  • bit 5 Source polarity
  • 0 counting rising edge
  • 1 counting falling edge
  • bit 6 Polarity of G_OUT output signal
  • 0 active high
  • 1 active low
  • bit 7 Counting direction
  • 0 counting down
  • 1 counting up
  • gate bit 0..4 Gate selection
  • 1..10 PFI 0..9
  • 11..17 RTSI 0..6
  • 18 IN_TIMEBASE_2
  • 19 UI2_TC
  • 20 other G_TC
  • 21 AI_START_1
  • 31 Logic low (counting isn't gated)
  • bit 5 gate polarity
  • 0 active low
  • 1 active high
  • bit 6..7 G_OUT mode
  • 1 one clock cycle output
  • 2 toggle on TC
  • 3 toggle on TC or gate
  • interrupts bit 0 TC Interrupt enable
    bit 1 Gate interrupt enable
    bit 2..7 not used
    in initial value loaded into counter

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    Back to Timers/Counters Interface Module

    void TIM_bufferedEventCounting(BYTE counter, BYTE source, BYTE gate, BYTE cumulative, DWORD in)

    Also this function performs an event counting but when a gate's event occurs DAQ-STC saves counter values into related Hardware Save registers and if counting is cumulative continues counting else restarts counting from 0 (pay attention: count restarts from 0 and not from your initial value "in")

    Parameter Description
    counter Specifies which counter must be resected. Possible values are:
  • C0 (0) Counter 0
  • other values Counter 1
  • source bit 0..4 Source selection
  • 0 IN_TIMEBASE_1
  • 1..10 PFI 0..9
  • 11..17 RTSI 0..6
  • 18 IN_TIMEBASE_2
  • 19 Other G_TC
  • bit 5 Source polarity
  • 0 counting rising edge
  • 1 counting falling edge
  • bit 6 Polarity of G_OUT output signal
  • 0 active high
  • 1 active low
  • bit 7 Counting direction
  • 0 counting down
  • 1 counting up
  • gate bit 0..4 Gate selection
  • 1..10 PFI 0..9
  • 11..17 RTSI 0..6
  • 18 IN_TIMEBASE_2
  • 19 UI2_TC
  • 20 other G_TC
  • 21 AI_START_1
  • 31 Logic low (counting isn't gated)
  • bit 5 gate polarity
  • 0 active low
  • 1 active high
  • bit 6..7 G_OUT mode
  • 1 one clock cycle output
  • 2 toggle on TC
  • 3 toggle on TC or gate
  • cumulative Specifies counting types:
  • 0 non cumulative (each gate event makes counter resetting)
  • 1 cumulative (counter never resected)
  • in initial value loaded into counter

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    Back to Timers/Counters Interface Module

    void TIM_timeMeasurement(BYTE counter, BYTE source, BYTE gate, BYTE type, BYTE itr, DWORD in)

    With this function you can perform a pulsewidth or a single period measurement. This function can be used only for one shot measurement so you can get only one pulsewidth measure or only one period measure. The next function, like you'll see, performs continue measurements

    Parameter Description
    counter Specifies which counter must be resected. Possible values are:
  • C0 (0) Counter 0
  • other values Counter 1
  • source bit 0..4 Source selection
  • 0 IN_TIMEBASE_1
  • 1..10 PFI 0..9
  • 11..17 RTSI 0..6
  • 18 IN_TIMEBASE_2
  • 19 Other G_TC
  • bit 5 Source polarity
  • 0 counting rising edge
  • 1 counting falling edge
  • bit 6 Polarity of G_OUT output signal
  • 0 active high
  • 1 active low
  • bit 7 Counting direction
  • 0 counting down
  • 1 counting up
  • gate bit 0..4 Gate selection
  • 1..10 PFI 0..9
  • 11..17 RTSI 0..6
  • 18 IN_TIMEBASE_2
  • 19 UI2_TC
  • 20 other G_TC
  • 21 AI_START_1
  • 31 Logic low (counting isn't gated)
  • bit 5 gate polarity
  • 0 active low
  • 1 active high
  • bit 6..7 G_OUT mode
  • 1 one clock cycle output
  • 2 toggle on TC
  • 3 toggle on TC or gate
  • type specifies which type of measure must be performed
  • 0 single period
  • other values pulsewidth
  • interrupts bit 0 TC Interrupt enable
    bit 1 Gate interrupt enable
    bit 2..7 not used
    in initial value loaded into counter

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    Back to Timers/Counters Interface Module

    void TIM_bufferdeTimeMeasurement(BYTE counter, BYTE source, BYTE gate, BYTE type, DWORD in)

    This function measures time continually. It can measure periods, semiperiods, or pulsewidths.

    Parameter Description
    counter Specifies which counter must be resected. Possible values are:
  • C0 (0) Counter 0
  • other values Counter 1
  • source bit 0..4 Source selection
  • 0 IN_TIMEBASE_1
  • 1..10 PFI 0..9
  • 11..17 RTSI 0..6
  • 18 IN_TIMEBASE_2
  • 19 Other G_TC
  • bit 5 Source polarity
  • 0 counting rising edge
  • 1 counting falling edge
  • bit 6 Polarity of G_OUT output signal
  • 0 active high
  • 1 active low
  • bit 7 Counting direction
  • 0 counting down
  • 1 counting up
  • gate bit 0..4 Gate selection
  • 1..10 PFI 0..9
  • 11..17 RTSI 0..6
  • 18 IN_TIMEBASE_2
  • 19 UI2_TC
  • 20 other G_TC
  • 21 AI_START_1
  • 31 Logic low (counting isn't gated)
  • bit 5 gate polarity
  • 0 active low
  • 1 active high
  • bit 6..7 G_OUT mode
  • 1 one clock cycle output
  • 2 toggle on TC
  • 3 toggle on TC or gate
  • type specifies which type of measure must be performed
  • 0 period
  • 1 semiperiods
  • other values pulsewidth
  • in initial value loaded into counter

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    Back to Timers/Counters Interface Module

    go to next page