Previous

Next

Bottom

Contents

Glossary

Index

 

Persistor CF1 User's Manual

PicoDAQ Example

May 1999

Revision 1.02

Persistor Instruments Inc.
© 1998 All rights reserved.

 

PicoDAQ...

PicoDAQ is an example program that builds a simple but working datalogger using the Persistor CF1 with a PRCPDAQ RecipeCard and running PicoDOS software. This document describes how to install and use the PicoDAQ application. You can load and run the precompiled picodaq.rhx or use the C source as the basis for your own custom logging application.

Dataloggers built from PicoDAQ have the following features:

PicoDAQ Requirements

You'll need the following hardware and software components to work with PicoDAQ.

To customize PicoDAQ, you'll also need the following software components.

PicoDAQ Quick Start

Assuming that you've already worked through the Persistor Instruments Inc. documentation and have successfully loaded and run PicoDOS, you presumably know how to transfer .RUN files from your computer to the CF1. Normally, you type 'G' <return> to immediately run the program, but this time, you want to save an image of the program onto the CompactFlash for future use with the command:

C\>SAVE PICODAQ.RUN
   

PicoDOS figures out where the program is in memory as well as how much to copy to flash, and the extension ".RUN" tells PicoDOS that this file is an executable program that can be run from the command line just by typing "PICODAQ" along with the appropriate arguments. You can verify the save by typing "DIR" and observing that a file named picodaq.run exists on the flash card. You can further verify the save by typing "picodaq" with no arguments. This will run PicoDAQ, but since there were no arguments, it will just complain that your not using it correctly and exit.

PicoDAQ Operation

For PicoDAQ to run properly, you have to supply it with appropriate arguments in the command line. To know what is appropriate, you have to know the proper format for the arguments, but first you have to know how these arguments affect PicoDAQ operation. PicoDAQ continuously samples all eight of the A-D converter channels in rapid succession once every millisecond and saves these readings to a ring buffer in RAM. It uses values you've passed in as arguments to determine how and when to save some or all of these measurements to files on the flash card.

For each channel that you want to record, you feed PicoDAQ a non-zero rate divisor (or a samples per seconds rate). Each time PicoDAQ reads a set of channels (1000 times per second), every non-zero rate divisor is decremented, and any that transition from one to zero have their latest measurement stored to their respective flash file, and the divisor reloaded with the original value. Each 12 bit measurement is stored by default as a right justified two byte integer with a range of 0 to 4095 for unipolar signals or -2048 to +2047 for bipolar signals.

Most cards cannot keep up with the maximum data rates that would occur when all channels are specified with a rate divisor value of one, which will record two bytes for each channel at a 1kHz rate, for an aggregate rate of 8,000 samples per second, and a total storage rate to the flash card of 16,000 bytes per second. At the maximum aggregate sampling rate, the flash cards would fill at just about 1MB per minute.

In actual use, 4,000 samples per second is about the most you'll be able to stream to the cards. Since there is some variation between cards, we provide a signal for you to monitor the speed at which the card will accept data using one of the CTM6 lines (CTD8. pin 25 by default) and an oscilloscope. The CTM6 puts out a square wave with a period of about 1 millisecond, and a high time that relates to the percentage of the buffer waiting to get onto the card. If you plan to run at or near the maximum, watch this signal to see that high time does not gradually become successively larger, but instead expands and contracts in a very repeatable fashion.

PicoDAQ does not require that you record all channels, or that all recorded channels store at the same rate. Any rate that can be derived by dividing 1kHz by an integer value between 1 and 65535 can be applied to any channel. This covers sampling rates from 1000 samples per second down to one sample per minute as shown below.

Rate Hz

Divisor

1 Ch B/S

8 Ch B/S

-H1000

-R1

2,000

16,000

-H500

-R2

1,000

8,000

-H200

-R5

400

3,200

-H100

-R10

200

1,600

-H10

-R100

20

160

-H1

-R1000

2

16

0.01667 (1/min)

-R60000

0.03333

0.2667

 

No matter which channels are selected to record, every millisecond all eight channels are measured, starting with channel zero and finishing with channel 7. Each channel takes approximately 8 microseconds to sample, so the worst case sampling skew from channel 0 to channel 7 is about 60 microseconds.

With no optional arguments specifying start and stop conditions, PicoDAQ will begin logging immediately and continue to log until the card fills up. In the command line, you can specify arguments to delay the start for some number of seconds; until a break signal is received from the RS232 port; or until one of the digital I/O lines (IRQ3 [A5]) goes low. Similarly, you can specify that sampling takes place for some fixed number of seconds, until a second break signal is received from the RS232 port, or until the digital I/O lines goes low again.

To simplify data recovery, each channel records its data to a separate file on the flash card, and the last character of the filename extension identifies the associated analog channel. To simplify recovery and prevent confusion, PicoDAQ also creates a text file with the extension ".PLJ" that contains a copy of the command string that defined the acquisition session. The first line of this job file can be copied to a batch file to conduct repeated experiments with identical parameters. The job file can also be parsed by playback software to export the data to spreadsheets or analysis programs.

A two channel experiment started with the command line "PICODAQ -FTESTDATA -H1000.1000" would generate three files named "TESTDATA.PLJ", "TESTDATA.PL0", and "TESTDATA.PL1". From PicoDOS, you can "TYPE" the job file to review the experiment parameters, and you can "DUMP" the data files to get a quick look at the recorded binary data.

Even though the CF1 is a based on a Motorola processor, PicoDAQ defaults to storing the binary readings in the byte swapped format that is most natural for Windows and DOS computers. This can be changed to the native Motorola format with one of the command line arguments described ahead. Where simple data recovery is more important than maximum sampling speed and storage capacity, PicoDAQ also supports an ASCII storage mode which stores all of the readings as printable decimal numbers. ASCII files use the extension "PA0" to PA7" and their contents can be directly viewed using the PicoDOS "TYPE" command.

PicoDAQ Arguments

PicoDAQ requires a "-F<filename>" argument which may be followed by several optional arguments. All arguments are internally converted to upper case, so you can type in either. Below is the basic form of the command line:

PICODAQ -F<name> -R<ratelist> -H<spslist> -D<delay> -S<samplems> -I -P -B -M -A -V -?

-F<filename>
The filename argument is a standard eight character DOS filename with no extension. PicoDAQ always appends ".PL#" to the name, where # is the channel number (0-7) and additionally creates a text file with the same name, but with the extension ".PLJ" which contains a copy of the entire command line to help playback software interpret the data files.

The other parameters all start with a dash character (minus sign '-') followed immediately (no space) by a single character parameter descriptor, then followed (no space) by a decimal number. The meaning of the numeric values varies with the parameter descriptors as described for each argument.

-R<ratelist> (Channel Rate Divisors)
For each channel you wish to record, you must specify a rate divisor or use the alternate -H samples-per-second form described ahead. The channel number is implied by the order in the list, beginning with channel 0 and ending with channel 7. Channels that you wish to skip should be given the value zero. Each rate value should be separated by a single period (.) with no intervening spaces. The first space or comma ends the list, and if less than eight values are provided, the final channels with missing values are assumed to be skipped.Below is an example command line that would sample channels 0 and 1 at the maximum 1kHz rate, channels 2, 3, and 4 at 100Hz, and channel 5 once per second. The -R option can not be combined with the -H option.

PICODAQ FILENAME -R1.1.10.10.10.1000

-H<spslist> (Channel Rates in Hz)
As an alternate to the -R argument, you can specify the sampling rates in Hz, again with implied channel numbers and separated by periods. Below is the -H version of the example above which will yield the same sampling rates. PicoDAQ divides 1000 by the specified value to arrive at the rate, so values that are not an even submultiple of 1000 will not yield exact rates and obviously rates below 1Hz are not supported. The -H option can not be combined with the -R option.

PICODAQ FILENAME -H1000.1000.100.100.100.1

-D<delay> (Start Delay)
The -D descriptor adds a start delay from the time the command is entered until the sampling session begins. The value is the time in seconds to wait and may be anything from 0 to 65535. PicoDAQ will send a countdown to the RS232 while it waits out the delay. If no delay is specified, PicoDAQ defaults to no delay and begins logging immediately. The -D option can not be combined with the -I, or -B options.

-S<samplems> (Sample Duration)
The -S descriptor specifies how long PicoDAQ should continue to log data once started. The value is the time in seconds to log and may be anything from 0 to 65535 seconds (18 hours). PicoDAQ will of course stop logging if the flash card fills up before the requested duration completes. The -S option can not be combined with the -I, or -B options.

-I (I/O Start/Stop Pin)
The -I descriptor lets you start and stop logging by grounding IRQ3 which is pin A5 on the IO8 and pin 61 on the SquishyBus. PicoDAQ will wait for the IRQ3 pin to go low and stay low for 250ms to begin logging, and will conclude when the IRQ3 pin again goes low or the card fills up. Connecting a momentary pushbutton switch between ground and IRQ3 will let you remotely start and stop the recording. The -I option can not be combined with the -D, -S, or -B options.

-P (Bipolar Conversions)
The -P descriptor tells PicoDAQ to perform A-D conversions in bipolar mode with measurements from -2048 to +2047. The default is unipolar with measurements from 0 to 4095.

-B (Break Detect Start/Stop)
The -B descriptor lets you control the start and end of a recording session by sending a break sequence (>250ms) to the RS232 port. PicoDAQ waits for the first break to begin logging, and stops when it detects a second break or when the card fills up. The -B option can not be combined with the -D, -S, or -I options.

-M (Motorola Format)
The -M descriptor changes the binary recording format from Intel "little endian" used by DOS and Windows, to Motorola "big endian" format used by Macintosh computers and native to the CF1's 68332.

-A (ASCII Format)
The -A descriptor tells PicoDAQ to store all measurements as printable ASCII text. This format requires about three times as much storage as the default binary format and limits maximum aggregate sampling rates to about 2500 samples per second, but has the advantage of being directly importable to into any analysis program or text editor. Since the ASCII numeric values can range from one to five digits, the file sizes will vary from run to run and from channel to channel.

-V (Verbose Diagnostics)
The -V descriptor tells PicoDAQ to print diagnostic messages to help in debugging.

-? (Identify Program and Usage)
The -? descriptor tells PicoDAQ to print a brief description of the program and a usage summary.

Example Command Lines

The following command lines show how to construct simple logging experiments. These can be copied and pasted to the terminal window as PicoDOS commands, or saved to ".BAT" files for repeated use.

PICODAQ -FPL500I8 -H500.500.500.500.500.500.500.500 -D4000 -S30000 -V
PICODAQ -FPLASC8B -H1.5.10.50.100.500.1000.250 -B -A -V 
PICODAQ -FPL1KM4 -H1000.1000.1000.1000 -B -M -V 

 

Previous

Next

Top

Contents

Glossary

Index

Tel: 508-759-6434

Fax: 508-759-6436

Copyright (C) 1998 Persistor Instruments Inc. - All Rights Reserved