ts-7000
[Top] [All Lists]

Re: [ts-7000] TS7200 + TS9700

To:
Subject: Re: [ts-7000] TS7200 + TS9700
From: Christos Eleftheriadis <>
Date: Mon, 5 Dec 2005 11:46:48 +0100
Hello Cliff,

I am using the TS9700 with the TS7200...

Accordning to the pdf on the files section the Base address is
0x11C00000 for both platforms (7200 and 7250)

and this the base address I use in my programs
I am running NetBSD and I have achieved around 38Ksps

Are you running Linux ?
I think that all the includes are the same so this litle prog can run directly

Maybe you can post your maximum sampling speed...



below is a small program that reads the ADC ch0 for 25000 times and then prints the first 10 results

---------------------------------------------

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

int main(){
unsigned long i;
int k;
int bit_7;
volatile unsigned short *RESULT_REG;

volatile unsigned char *base;
volatile short *iptr;
iptr = (short *)malloc(sizeof(unsigned short));


int fd = open("/dev/mem", O_RDWR);
base = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0x11C00160 );

i = 0;
bit_7=0;

RESULT_REG = (unsigned short *)(base + 0x02); // two byte read

printf("Start loop\n");
*base = 0x00;

while ( i < 25000 ) {

        do {
                bit_7 = *base & 0x80;
        } while (bit_7 == 0);

        iptr[i] = *RESULT_REG;
        *base = 0x00;
        i++;
        }

printf("End loop\n");
k = 0;
while ( k < 10){
fprintf(stdout, "%1.13f\n", iptr[k]*0.0006103515625);
k++;
}

return(0);
}





On 12/4/05, Cliff Blackburn <> wrote:
I am trying to get the Analog TS9700 Board to interface with my TS7250 Arm board but have hit a wall.

Here is the code I tried using to access the Analog board. I am really only concernd with the DAC at this point.

#define PC8BITIO 0x11E00000
#define PC16BITIO 0x21E00000
#define PC8BITMEM 0x11A00000
#define PC16BITMEM 0x21A00000
Tpc104::Tpc104()
{
fd = open("/dev/mem", O_RDWR);
if(fd == 1)
throw( "Unable to open /dev/mem");

pc8io = (unsigned char *)mmap(0 , getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd, PC8BITIO);
pc16io = (unsigned short *)mmap( 0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd, PC16BITIO);

if(pc8io == MAP_FAILED || pc16io == MAP_FAILED)
throw("Unable to map memory" );
}

//-------------------------------------------------------------------

Tpc104::~Tpc104()
{
close(fd);
}

//-------------------------------------------------------------------

void Tpc104::outp(int port, unsigned char data)
{
printf("Writing 0x%X,0x%X\n ", (port+PC8BITIO), data);
*(pc8io + port) = data;
}

//-------------------------------------------------------------------

void Tpc104::outpw(int port, unsigned short data)
{
printf( "Writing 0x%X,0x%X\n", port+PC16BITIO, data);
*(pc16io + port) = data;
}
The Tdac inherits the above class.

#define MAX_CHANNELS 4
#define DAC_BASE 0x160
#define DAC_STATUS DAC_BASE+6
#define DAC_DATA DAC_BASE+4
#define DAC_LSB DAC_BASE+4
#define DAC_MSB DAC_BASE+4

void Tdac::set(int channel, unsigned short
 val)
{
channel &= 0x3; // Only allow ch 0-3
// channels[channel] = val; // Save previous value
val |= (channel << 14); // Setup port to write

//while(!(inp(DAC_STATUS) & 0x80));

/*outp(DAC_LSB, val & 0xFF);
outp(DAC_MSB, (val & 0xFF00) >> 8);
*/
outpw(DAC_DATA, val);

printf("Setting DAC #%i to B", channel);
printbin(val);
}

In my main I create a Tdac object and then call

dac.set(0,0xAAA);

I have coded the same style for the LED's and the LCD DIO and it works correctly. I have also tried this using the PC8/16MEM but still nothing.

I also tried simplifying the above code so all did was write a single value to the port after remapping the memory and still nothing.

Does anybody notice anything I did wrong above or something I didn't do?

I would like to see some sample code on the PC104 using an ARM Processor if anybody has anything. Iv'e seen lots of code for intel based boards but they have quite a bit different access methods.

Thanks for any help,
Cliff


SPONSORED LINKS
Computer internet security Linux os Computer internet business
Computer internet access Computer internet help Single board


YAHOO! GROUPS LINKS

  •  Visit your group "ts-7000" on the web.
     
  •  To unsubscribe from this group, send an email to:
     =Unsubscribe
     
  •  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.





YAHOO! GROUPS LINKS

  •  Visit your group "ts-7000" on the web.
     
  •  To unsubscribe from this group, send an email to:
     =Unsubscribe
     
  •  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



<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