Navigation: Quick Start >

Interval Timing of Data

 

 

 

 

Interval Timing of Data allows precise timing of plotted data. This may be used to send data to be plotted based on actual microcontroller clock intervals, including storage of data on the controller and 'dumped' afterwards to be plotted on a defined interval or time.

 

Four means are available: Interval Data, Timed Data, Interval Timing (Obsolete) and setting a Dump Interval

 

Interval Data

In this mode, Interval Timing is enabled (See the Main Interface's "Data" Menu) and data is sent with an interval defined. In code, !intervalData may be set to 1 or 0.  This is an easier implementation of the Interval Timing.
 

Data is sent with the first parameter the time since the prior data:
intervaltime, data, data, data

 

0.5, 10, 20, 30  // plots the data of 10, 20 30  0.5 seconds since the last data.

 

Note that time may be a floating point, such as 0.015 or a suffixed value such as 15m (for 15 millisecond) down to 1nS. G, M, k, m, u and n may be used.

 

It may be used with data other than analog as well, such as, but each occurrence will advance the interval timer.
0.5, %1001

0.5, !plot.drawLine...

 

Once enabled, analog strings MUST start with the interval time.

 

Note, a negative value may be used to plot backwards in time, if you have a desire...

 

If enabled then disabled, it is required to reset the plots.

 

This setting is cleared on a opening a new interface.

 

Timed Data

In this mode, Timed Data is enabled (See the Main Interface's "Data" Menu) and data is sent with an interval defined. In code, !timedData may be set to 1 or 0.
 

Data is sent with the first parameter the time to plot the data in seconds.

time, data, data, data

 

7.5, 10, 20, 30  // plots the data of 10, 20 30  at 7.5 seconds on the X-Axis.

 

Note that time may be a floating point, such as 0.015 or a suffixed value such as 15m (for 15 millisecond) down to 1nS. G, M, k, m, u and n may be used.

 

It may be used with data other than analog as well, such as, but each occurrence will advance the time.
0.5, %1001

0.5, !plot.drawLine...

 

Once enabled, analog strings MUST start with the time.

 

Note, you may jump forward and back in time if desired or use the X-Axis as a different value.

 

If enabled then disabled, it is required to reset the plots.

 

This setting is cleared on a opening a new interface.

 

 

Interval Timing (Obsolete)

In this mode, Interval Timing is enabled (See the Main Interface's "Data" Menu) and data is sent with an interval defined. In code, !intervalTiming may be set to 1 or 0.

In it's basic form, send a string of analog data with the interval since the last data set defined.

!i interval:Analog Data String

 

!i 15mS: 10, 20, 30

 

Note that time may be a floating point, such as 0.015 or a suffixed value such as 15m (for millisecond) down to 1nS.

 

Each line sent may have a unique time since the prior data set.

 

NOTE: All plots need to be reset after enabling Interval Timing.

 

If enabled then disabled, it is required to reset the plots.

 

This setting is cleared on a opening a new interface.

 

This partial code shows enabling this mode and sending data based on the Arduino's clock.

 

unsigned long time;

 

void setup() {

  Serial.begin(128000); // MATCH BAUD RATE

  delay(1000);          // Allow serial to stabilize

  Serial.flush();     // Clear out old data

  Serial.println(""); // send CR+LF to help MPJ be ready for new data

  Serial.println("Starting data...");   // Send text message, press F7 on MPJ to see

  Serial.println("!intervalTiming=1\n!plot.reset");  // Enable Interval Timing and reset the plot

  time = micros();                  // update last time

}

 

void loop() {

  int value1 = analogRead(0);

  int value2 = analogRead(1);

  unsigned long  elapsedTime = micros() - time; 

  unsigned long time = micros();                  // update last time

                // send analog data as !i time: num,num,num

  Serial.print("!i ");

  Serial.print(elapsedTime);    // get time elapsed since last

 

  Serial.print("u:");               // Indicate micro

  Serial.print(value1);               // replace with your value

  Serial.print(",");

  serial.println(value2);       // replace with your value

 

It is allowable to send !i 15n: as a unique, individual line, but it must be sent prior to each data set.

 

Dump Interval

With Dump Interval, the interval is defined and all plotted data will be plotted with that defined timebase.

 

The interval may be set with the "Main" menu or in code:
!dumpInterval = 15m

 

Time may be a floating point, .015 or use a suffix, 15m, down to 1 nanosecond (1n).

 

Whenever new analog data arrives, it will be plotted with that interval between them for each ANALOG data set. Digital data will be based on analog intervals.

 

The interval may be changed as desired during plotting.

 

This is a good method to store data rapidly on the controller or other controller local memory and dump at 'slower baud rates to the MPJ.

 

Use !dumpInterval =0 to disable.

 

NOTE: The plots must be reset when dumping is first enabled.

 

 

 

 

 

 

 

Copyright © 2024 SelmaWare Solutions, LLC