All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
1.c
Go to the documentation of this file.
#include "stdio.h"
#include "../c_wrapper/pruio.h" // include header
int main(int argc, char **argv)
{
int i, n;
pruIo *io = pruio_new(PRUIO_DEF_ACTIVE, 0x98, 0, 1);
if (pruio_config(io, 1, 0x1FE, 0, 4)){ // upload (default) settings, start IO mode
printf("config failed (%s)\n", io->Errr);}
else {
/* now current ADC samples are available for AIN-0 to AIN-7 in array io->Adc->Value[] */
for(n = 1; n <= 13; n++) { // print some lines
for(i = 1; i < 9; i++) // all steps
printf(" %4X", io->Adc->Value[i]); // output one channel in hex
printf("\n"); // next line
}
}
/* we're done */
pruio_destroy(io); /* destroy driver structure */
return 0;
}
i
VAR i
The samples index.
Definition: triggers.bas:129
io
VAR io
create new driver UDT
Definition: 1.bas:21
pruIo::Adc
adcUdt * Adc
pointer to ADC device structure
Definition: pruio.h:404
pruIo
Wrapper structure for PruIo.
Definition: pruio.h:403
pruio_new
pruIo * pruio_new(uint16 Act, uint8 Av, uint32 OpD, uint8 SaD)
Wrapper function for the constructor PruIo::PruIo().
pruIo::Errr
char * Errr
pointer for error messages
Definition: pruio.h:411
pruio_destroy
void pruio_destroy(pruIo *Io)
Wrapper function for the destructor PruIo::~PruIo.
n
VAR n
The active channel number.
Definition: pwm_adc.bas:107
PRUIO_DEF_ACTIVE
activate all devices
Definition: pruio.h:385
adcUdt::Value
uint16 * Value
fetched ADC samples
Definition: pruio.h:133
main
int main(int argc, char **argv)
The main function.
Definition: 1.c:23
pruio_config
char * pruio_config(pruIo *Io, uint32 Samp, uint32 Mask, uint32 Tmr, uint16 Mds)
Wrapper function for PruIo::config().