' this little program creates a sinewave with user-defined parameters and lets the user ' stimulate a second DAC at certain times of the sinewave var howoften, frequ, stimtime, stimdura, stimampl, dacport2, ampli, kanal,n,z,dacport,spike[10000],delay$,pulsedura,zaehl,logfilename$,pulseamp, log%; n:=1; frequ:=input("What stimulus frequency?",0.5); ' holds sine frequency dacport:=input("which DAC port of the 1401 should produce the sinewave?",1); ' the port of the 1401 that is used for sinewave delay$:=input$("give character for start of sequencer","q"); 'character key to start stimulation in the sequencer ampli:=input("What is the maximum amplitude (at 90° of the sinewave)",1); 'amplitude of sinewave ampli:=ampli/5; 'correct for maximum voltage of 5Volt (1 = 5 Volt) dacport2:=input("which DAC port of the 1401 should produce electrical pulse?",0); ' the port of the 1401 that is used for electrical stimulation stimampl:=input("what is the amplitude of the electrical stimulus in Volt",1); ' amplitude of electrical stimulu stimdura:=input("What is the stimulus-duration in sec?",0.5); ' duration of electrical stimulus stimtime:=input("after how many stimuli do you want to start the electrical stimulus?",50); ' when should it start howoften:=input("how many electrical stimuli do you want to apply?",10); ' and how often stimtime:=stimtime*1/frequ; ' gives time for next electrical stimulus in seconds! 'Empty Logfile view(LogHandle()); EditSelectAll(); EditClear(); ' create sequencer file Printlog("SET 1,1,0","\n"); Printlog(" ","VAR V1,LoopA=0"); Printlog(" ","DAC ",dacport,",0"); Printlog(" ","DAC ",dacport2,",0"); Printlog(" ","MOVI LoopA,",howoften); Printlog(" ","HALT"); if dacport=1 then 'everything needs a "c" instead of a "d" Printlog("'",delay$," CSZ ",ampli) ; 'Set cosine amplitude Printlog("COFF 0","\n") ; 'cosine centre Printlog("CANGLE 90","\n") ; ' cosine phase Printlog("CRATE Hz(",frequ,")") ; 'set rate and start cosine off Printlog("EA:"," DELAY s(",stimtime,")-2"); Printlog("DAC ",dacport2,",",stimampl); Printlog("Delay s(",stimdura,")-1"); Printlog("DAC ",dacport2,",0"); Printlog("DBNZ LoopA,EA","\n"); Printlog("DELAY s(",stimtime,")-2"); Printlog("CRATE 0","\n") ; 'Stop cosine output Printlog("DAC 1,0","\n"); Printlog("DAC 0,0","\n"); endif; if dacport=0 then 'everything need the "d" instead of the "c" Printlog("'",delay$," DSZ ",ampli) ; 'Set cosine amplitude Printlog("DOFF 0","\n") ; 'cosine centre Printlog("DANGLE 90","\n") ; ' cosine phase Printlog("DRATE Hz(",frequ,")") ; 'set rate and start cosine off Printlog("EA:"," DELAY s(",stimtime,")-2"); Printlog("DAC ",dacport2,",",stimampl); Printlog("Delay s(",stimdura,")-1"); Printlog("DAC ",dacport2,",0"); Printlog("DBNZ LoopA,EA","\n"); Printlog("DELAY s(",stimtime,")-2"); Printlog("DRATE 0","\n") ; 'Stop cosine output Printlog("DAC 1,0","\n"); Printlog("DAC 0,0","\n"); endif; ' and save the file log%:=LogHandle(); 'get the logfile handle View(log%); ' show it FileSaveAs(logfilename$,1); ' save it