Hi everybody,
I use below source to use the ts9700,
While everything on the ADC part is perfect, there is no output on the
DAC side.
Could you please give me some advice on it.
Best Regards.
F. Ugurtan Erdem
*******************
#include <stdio.h>
#include <fcntl.h>
#include <sys/mman.h>
#define BASE 0x11C00000
#define ADBASE 0x160
#define ADCOMMAND ADBASE
#define ADDATA ADBASE + 2
#define DAC ADBASE + 4
#define ADREADYBIT 7
#define NUM_CHANNELS 5
typedef unsigned char byte;
main(){
byte *base;
volatile byte *adcommand;
volatile byte *lsb;
volatile byte *msb;
volatile byte *ldac;
volatile byte *hdac;
unsigned short int val;
int fd;
float volts;
int i,j;
fd = open ("/dev/mem" , O_RDWR|O_SYNC);
base = (byte *)mmap(0, getpagesize(), PROT_READ | PROT_WRITE,
MAP_SHARED, fd, BASE);
adcommand = base + ADCOMMAND;
lsb = base + ADDATA;
msb = base + ADDATA + 1;
ldac = base + DAC;
hdac = base + DAC + 1;
while (1) {
for (j=0; j<NUM_CHANNELS; j++)
{
*adcommand = j;
while(!(*adcommand & (1 << ADREADYBIT)));
volts = (256 * *msb + *lsb) * 2.5 / 4096;
val = 2000;
val |= (0x0 << 14);
*ldac = val;
*hdac = 0xFF;
printf ("%1.3f ",volts);
}
printf("\n");
usleep(100000);
}
}
***********************************
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/
|