SpecView.FastCount Variable

<< Click to Display Table of Contents >>

Navigation:  Editing a SpecView Project > Editing GDWs - Graphical Display Windows >

SpecView.FastCount Variable

Previous pageReturn to chapter overviewNext page

 

The SpecView Pre-Defined Variable called 'SpecView.FastCount' is a count up counter that counts accurately and continuously at rates up to 100 times per second.

This counter can be used as the basis for a Strategy Controller Event that needs to be checked frequently.

 

VariablesList_FastCount

 

SpecView.FastCount can be reset to Zero by writing Zero to it, but writing other values will have no effect.

 

The counter will count up to 4294967295 and then reset.  At a rate of 10 counts per second, this will take about 13.5 years. At 100 per second, it will take about 500 days.  The SpecView.FastCount counter is set to Zero whenever SpecView enters Runtime Mode.

 

The rate at which the counter counts is determined by a value in SETTINGS.INI

SpecView.FastCount will only have a value if this rate is set, otherwise it will show N/R.

 

In the [RUNTIME] section, add a line:

FastCountRate=MS

 

Where MS is a number of milliseconds.

Typical values might be:

FastCountRate=500      Twice per second

FastCountRate=100        10 times per second

FastCountRate=50        20 times per second

 

Note that when using the SpecView.FastCount as a Strategy Controller event, such as: 'Watch for SpecView.FastCount Changed by 0', it is possible for the Strategy Controller to miss counts if the computer is very busy and the FastCountRate is very fast.  Although the Event might not trigger for every change of SpecView.FastCount, the number in SpecView.FastCount will increment at the correct rate.

 

A typical use of the SpecView.FastCount counter is to write values to a file using the Line Writer to generate a form of 'Log File' faster than the current maximum logging rate of 1 second.

 

To do this, proceed as follows:

 

When writing a line with the Line Writer, it is useful to have a better idea of the time interval, since SpecView.Time is only accurate to 1 second.  By setting the FastCountRate=100 will give a 10th of a second counter.

 

It is possible to extract the 1/10ths of a second from this as follows:

 

Create a SpecView Integer user variable set to -1 (e.g. SpecView.MinusOne) and Two SpecView Text user variables. (SpecView.RawCount and SpecView.LastDigit).

 

In the Strategy Controller, create an event that does 'Watch for SpecView.FastCount Changed by 0'

Which has the following actions:

1) Copy SpecView.FastCount   to   SpecView.RawCount

2) Math Function SpecView.RawCount  MINUS SpecView.MinusOne into SpecView.LastDigit

The 1/10th digit will be in SpecView.LastDigit and this can be put into the lines written to the file.

 

SpecView Variables