Link here

DA 24/7 Forth Demo 2

Forth demonstration code for the DA 24/7 Data Acquisition Wildcard: acquiring multiple data samples

The 24/7 Data Acquisition Wildcard™ is a complete analog front end, offering exceptional 24-bit resolution, excellent stability, and remarkable noise rejection for instrumentation applications. Ideal for high resolution, low frequency measurements and data logging, this analog-to-digital converter (ADC) accepts low level signals directly from transducers, amplifies and conditions them, and converts them with 24 bits of resolution with no missing codes performance.

This Forth language demonstration program provides examples of how to invoke the 24/7 ADC to acquire multiple samples and store the resulting data to memory.

DA 24/7 Forth Demo 2

\ ---------------------------------------------------------------------
\                          Example 2
\ ---------------------------------------------------------------------
 
\ This second sample routine demonstrates how to use AD24_Multiple.
\ This routine takes 10 samples from a single channel at 10 hz and
\ stores the samples to the pad area.  Returns TRUE if successful,
\ FALSE if a timeout occurred in AD24_Multiple, an invalid calibration
\ coefficient was passed to Start_Conversion, or an invalid Wildcard
\ number was passed to Init_AD24.
DECIMAL
: Sample_Routine2 ( -- flag )
  MODULE0 Init_AD24                   \ 24/7 Data Acquisition Wildcard is
                                      \ the first Wildcard on the stack
  IF
    Use_Onboard_Ref                   \ Use on-board reference
    SELF_CAL
    1920                              \ 10 Hz -> 19200 / 10 = 1920
    GAIN_1
    BIPOLAR
    WORD_24BIT                  \ 24 bit resolution
    BO_OFF
    CH_0_1
    Start_Conversion                  \ This must be called before
                                                \ getting a sample
    IF                                          \ If a conversion was
                                      \ successfully started,
      10 PAD AD24_Multiple            \ Get 10 samples, store to pad
    ELSE
      FALSE                      \ Invalid calibration coefficient
    ENDIF
  ELSE
    FALSE                      \ Invalid Wildcard number
  ENDIF
 
    10 0 DO                                               \ Loop 10 times
        PAD                                                              \ Start from pad
        4 I *                                                     \ Multiply i by 4.  i is the loop counter
        0 XD+                                                      \ Add the addresses
        X@ D. CR                                               \ Fetch the value. print. newline.
    LOOP
;



See also →
24/7 Data Acquisition Wildcard Users Guide
24/7 Data Acquisition Wildcard Glossary
DA 24/7 C Demo 1
DA 24/7 C Demo 2
DA 24/7 C Demo 3
DA 24/7 Forth Demo 1
DA 24/7 Forth Demo 3

 
This page is about: Forth Language Demo Program, Code Examples, Acquire Multiple Data Samples – This Forth language demonstration program provides examples of how to invoke the 24/7 ADC to acquire multiple data samples and store them to memory.
 
 
Navigation