Sensoray 2410 API Instrukcja Użytkownika Strona 33

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 39
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 32
Sensoray 24xx Programming Guide
29
Model 2426 Multi-Function I/O Module
7.3.2 s2426_ReadAout()
Function: Read the programmed analog output level.
Prototype:
BOOL s2426_ReadAout( SESSION sess, u32 *err, s16 *setpoint );
Returns: True if the operation was successful, otherwise False is returned and
err
will contain the associated error code.
Example:
// Read and display the programmed analog output level.
u32 err = ERR_NONE;
s16 setpoint;
if ( !s2426_ReadAout( sess, &err, &setpoint ) )
printf( "Error: %s\n", s24xx_ErrorText(err) );
else
printf( "Aout: %f Volts\n", (double)setpoint / 3276.8 );
7.3.3 s2426_ReadAdc()
Function: Read all eight digital input channels.
Prototype:
BOOL s2426_ReadAdc( SESSION sess, u32 *err, S2426_ADC_SAMPLE *samples, BOOL timestamps );
Returns: True if the operation was successful, otherwise False is returned and
err
will contain the associated error code.
Notes: This function returns sample data from the module’s eight analog input channels.
Example:
// Read and display the six external analog input channels.
int i;
u32 err = ERR_NONE;
S2426_ADC_SAMPLE samp[8]; // allocate space for 8 chans
if ( !s2426_ReadAdc( sess, &err, &samp, TRUE ) )
printf( "Error: %s\n", s24xx_ErrorText(err) );
else {
for ( i = 0; i < 6; i++ )
printf( "chan %d: %f at t=%d\n", i, samp[i].volts, samp[i].timestamp );
}
Argument Description
sess
Session handle obtained from
s24xx_SessionOpen()
.
err
Pointer to error code. See Section 4.3.1 for details.
setpoint
Pointer to buffer that will receive the current analog output level.
Argument Description
sess
Session handle obtained from
s24xx_SessionOpen()
.
err
Pointer to error code. See Section 4.3.1 for details.
samples
Pointer to an array of eight
S2426_ADC_SAMPLE
structures. These will be filled with
digitized sample data and, if desired, timestamps for those samples. Channels 0 through 5
measure external signals, while channels 6 and 7 measure on-board reference standards.
timestamps
Set to True to receive timestamps with digitized sample data.
Przeglądanie stron 32
1 2 ... 28 29 30 31 32 33 34 35 36 37 38 39

Komentarze do niniejszej Instrukcji

Brak uwag