ts-7000
[Top] [All Lists]

[ts-7000] bad A/D performance problem on ts9700

To:
Subject: [ts-7000] bad A/D performance problem on ts9700
From: Doug Chapman <>
Date: Sun, 18 Dec 2005 13:24:11 -0800 (PST)
I just got my ts7260 (the new model) along with a ts9700 A/D converter
the other day.  I wrote some code to read the A/D off of the 9700 which
appears to give me proper values however it is really REALLY slow.  It
is taking .5 sec or more for each A/D conversion.  According to the
manual it should take 18ms.  Not sure if I am doing something wrong or
if there is something wrong with my board.

The following code demonstrates the issue.  It takes 10 samples and
calculates the time.  It takes 5 to 8 seconds to do 10 samples.

Anybody have any ideas what is going on here?

#include <stdio.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/time.h>

#define BASE 0x11C00000
#define ADBASE 0x160
#define ADCOMMAND ADBASE
#define ADREADYBIT 7

#define CHANNEL 0

#define NUM_SAMPLES 10
#define USEC_PER_SEC 1000000

typedef unsigned char byte;

main(){
    byte *base;
    volatile byte *adcommand;
    int fd;
    struct timeval now;
    long long start_usec;
    long long end_usec;
    int i;

    fd = open ("/dev/mem" , O_RDWR);
    if (fd < 0){
        perror ("open");
        exit(1);
    }

    base = (byte *)mmap(0, getpagesize(),
            PROT_READ | PROT_WRITE, MAP_SHARED, fd, BASE);
    if (base == MAP_FAILED){
        perror ("mmap");
        exit(1);
    }

    adcommand = base + ADCOMMAND;

    while (1){
        gettimeofday(&now,NULL);
        start_usec = now.tv_sec * USEC_PER_SEC + now.tv_usec;
        for (i=0; i<NUM_SAMPLES; i++){
            *adcommand = CHANNEL;
        perror ("mmap");
        exit(1);
    }

    adcommand = base + ADCOMMAND;

    while (1){
        gettimeofday(&now,NULL);
        start_usec = now.tv_sec * USEC_PER_SEC + now.tv_usec;
        for (i=0; i<NUM_SAMPLES; i++){
            *adcommand = CHANNEL;
            while(!(*adcommand & (1 << ADREADYBIT)))
                ;
        }
        gettimeofday(&now,NULL);
        end_usec = now.tv_sec * USEC_PER_SEC + now.tv_usec;

        printf ("%d samples took %f sec\n\n",NUM_SAMPLES,
                (double)(end_usec - start_usec) /
(double)USEC_PER_SEC);
    }

}




------------------------ Yahoo! Groups Sponsor --------------------~--> 
1.2 million kids a year are victims of human trafficking. Stop slavery.
http://us.click.yahoo.com/.QUssC/izNLAA/TtwFAA/CFFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU