Guys, I am really lost with the TS-ADC16.. after fighting with this board the
whole week, I couldn't get the board working.... I wrote a short code in order
to test the ADC but couldn't get any coherent sample... My TS-ADC16 is working
with a TS-7200, just that... Please, I will really appreciate some help..
The code I am running, using the provided tsadclib1624.c and tsadclib1624.h is:
#include <sys/types.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <stdio.h>
# include "tsadclib1624.h"
#define NCANALES 6
#define RANGO_DAC DACRANGE_02VB
#define RANGO_ADC ADCRANGE_0010S
#define TBUFFER 10000
#define SAMPLINGRATE 200
#define NUMMUESTRAS 1
int main ( )
{
int16_t *Buffer_Muestras[NCANALES];
int8_t J,index;
int16_t TV_IMin = 0xffff;
int16_t *aBuffer;
for (index = 0; index < NCANALES; index++)
{
if ((aBuffer = malloc(TBUFFER+1)) == NULL) {
printf("Error malloc\n");
return ;
}
Buffer_Muestras[index] = aBuffer;
}
printf ( "\n\nInitialized: %s\n ",!tsadclib1624_init
(SBC_TS7200,NCANALES, TBUFFER)?"OK":"NOT OK");
if ( index=tsadclib1624_boardstatus (0) == 0x3e ) printf ( "
TS Board: TS-16\n");
printf ( "Buffer: %s\n ",tsadclib1624_buffers? "OK":"ERROR");
index =tsadclib16_dacset ( 0, 0, RANGO_DAC, TV_IMin );
do {
usleep ( 500000 );
tsadclib1624_sample ( 0, NCANALES, SAMPLINGRATE, NUMMUESTRAS,
RANGO_ADC, Buffer_Muestras, true );
tsadclib1624_pollResults ( 0, true );
for ( J=0; J<=NCANALES;J++) printf ( "%d ", Buffer_Muestras[J]
);
printf("\n");
} while ( 1 );
}
Then my output is:
Initialized: OK
TS Board: TS-16
Buffer: OK
.80528 90536 100544 110552 120560 130568 0
.80528 90536 100544 110552 120560 130568 0
.80528 90536 100544 110552 120560 130568 0
.80528 90536 100544 110552 120560 130568 0
.80528 90536 100544 110552 120560 130568 0
.80528 90536 100544 110552 120560 130568 0
.80528 90536 100544 110552 120560 130568 0
.80528 90536 100544 110552 120560 130568 0
.80528 90536 100544 110552 120560 130568 0
.80528 90536 100544 110552 120560 130568 0
.80528 90536 100544 110552 120560 130568 0
As you see, the data does not have sense.. in fact, the count difference
between channel 1 vs channel 0 = 10008
channel 2 - channel 1 = 10008, and so..
BTW, I have 0V in all ADC channels.... any idea about what the problem is?
Thanks in advance,
Marcos
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|