8112CV
/* #######################################################################
/* Sends control voltage in steps to the CV input of a mono-syntheziser */
/* #####################################################################*/
#include "windows.h"
#include <stdio.h>
#include <stdlib.h>
#include "dll2.h"
#define BASEVALUE 2000
/* Initialize card */
int InitCard()
{
int PASCAL res;
res=W_8112_Initial(CARD_1,0x380);
res=SetDA(0,BASEVALUE);
return(0);
}
/*set D/A output voltage */
int SetDA(int channel,unsigned int value)
{
int PASCAL res;
res=W_8112_DA(channel,value);
return(0);
}
/* Make suitable delay by calculation (machine specific) */
/* will make a new proc using internal counter later... */
int DelayIt()
{
int count=0;
printf("delaying\n");
while (count<25000000)
{
++count;
}
return(0);
}
/* increase notevalue */
int IncNote(unsigned int vc)
{
unsigned int value;
value=BASEVALUE+(vc*71);
return(value);
}
int main()
{
int vc=0;
int note=0;
InitCard();
printf("init ready\n");
/* increment in steps with delay in between */
while (vc<12)
{
vc++;
printf("value:%d\n",IncNote(note++));
SetDA(0,IncNote(note));
DelayIt();
}
getch();
return(0);
}