beautypg.com

Sundance SMT326v2 User Manual

Page 22

background image

Release

Page 22 of 24

SMT326 DSP PC/ISA System User Guide

Document Name:

SMT326 Ugv2.doc

Original Date: 08/11/97

Product Name:

SMT326

Revision Date: 08/26/99

Author:

Graeme Parker – Fabio Ancona

if(channel < 16) mask=2;
else mask=0;
/*
Generate a DAC output using 4 freq inc's
Try 10,11,12,13 for an interesting output
*/

f1=f2=f3=f4=0;
/* printf("Enter freqs : ");
scanf("%d %d %d %d",&i1,&i2,&i3,&i4);
*/
i1=10;
i2=11;
i3=12;
i4=13;
while(1) {

while( ((*status) & 0x02) != mask); /* wait for next sample clock transition */

*fpga=((sin_table[f1]+sin_table[f2]+sin_table[f3]+sin_table[f4]) << 9);
/* printf("%08lX\n",((sin_table[f1]+sin_table[f2]+sin_table[f3]+sin_table[f4]) << 9));*/
f1+=i1;
f2+=i2;
f3+=i3;
f4+=i4;

f1=f1%256;
f2=f2%256;
f3=f3%256;
f4=f4%256;

while( ((*status) & 0x02) == mask); /* wait for next sample clock transition */

}

}

/*******************************************************************************
Functions

*******************************************************************************/
i2c_send_address(int add,int setnack)
{
volatile int delay;
*i2c_s1 = 0x40;
printf("1i2c_s1=%x\n",*i2c_s1);
for(delay=0;delay!=10000;delay++);
while((*i2c_s1 & 1) == 0);
*i2c_sn = add;
for(delay=0;delay!=10000;delay++);
for(delay=0;delay!=10000;delay++);
if(setnack == 1) *i2c_s1 = 0x44;
else *i2c_s1 = 0x45;
for(delay=0;delay!=10000;delay++);
printf("2i2c_s1=%x\n",*i2c_s1);
while((*i2c_s1 & 0x80) == 0x80){
printf("3i2c_s1=%x\n",*i2c_s1);
ch=getchar();
}
printf("5\n");