' this little program creates a stimulation protocol for trains of stimuli to a sequencer file var aus,ontime,repts,LoopA,LoopB,offtime,frequ,n,z,dacport,spike[10000],delay$,pulsedura,zaehl,logfilename$,pulseamp, log%; n:=1; frequ:=input("what is the stimulus frequency?",15); ' holds stimulus frequency ontime:=input("How long is the stimulus on for (in sec)?",6); ' holds the ontime of the train offtime:=input("How log is the pause between stimuli (in sec)?",4); ' hold the off time of the train repts:=input("How many repeats?",10); ' total number of trains dacport:=input("which DIGOUT port of the 1401? (0 (red channel) or 1 (yellow channel)",0); ' the port of the 1401 that is used for stimulation delay$:=input$("give character for start of sequencer","t"); 'character key to start stimulation in the sequencer pulsedura:=input("pulseduration for triggering the MASTER-8?",1); 'pulseduration in sequencer pulsedura:=pulsedura/1000; LoopA:=ontime*frequ; LoopB:=repts; aus:=1/frequ; 'Empty Logfile view(LogHandle()); EditSelectAll(); EditClear(); if dacport=0 then ' write the sequencer file Printlog("SET 0.5,1,0","\n"); Printlog(" ","VAR V1,LoopA=0"); Printlog(" ","VAR V2,LoopB=0"); 'Printlog(" ","DAC ",dacport,",0"); Printlog(" ","MOVI LoopA,",LoopA); Printlog(" ","MOVI LoopB,",LoopB); Printlog(" ","HALT"); Printlog("EA: '",delay$," DIGOUT [.......0]"); Printlog(" ","DIGOUT [.......1]"); Printlog(" ","DELAY s(",pulsedura,")-1"); Printlog(" ","DIGOUT [.......0]"); Printlog(" ","DELAY s(",aus,")-1"); Printlog(" ","DBNZ LoopA,EA"); Printlog(" ","DELAY s(",offtime,")-1"); Printlog(" ","MOVI LoopA,",LoopA); Printlog(" ","DBNZ LoopB,EA"); Printlog(" ","MOVI LoopB,",LoopB); Printlog(" ","HALT"); else ' write the sequencer file Printlog("SET 0.5,1,0","\n"); Printlog(" ","VAR V1,LoopA=0"); Printlog(" ","VAR V2,LoopB=0"); 'Printlog(" ","DAC ",dacport,",0"); Printlog(" ","MOVI LoopA,",LoopA); Printlog(" ","MOVI LoopB,",LoopB); Printlog(" ","HALT"); Printlog("EA: '",delay$," DIGOUT [......0.]"); Printlog(" ","DIGOUT [......1.]"); Printlog(" ","DELAY s(",pulsedura,")-1"); Printlog(" ","DIGOUT [......0.]"); Printlog(" ","DELAY s(",aus,")-1"); Printlog(" ","DBNZ LoopA,EA"); Printlog(" ","DELAY s(",offtime,")-1"); Printlog(" ","MOVI LoopA,",LoopA); Printlog(" ","DBNZ LoopB,EA"); Printlog(" ","MOVI LoopB,",LoopB); Printlog(" ","HALT"); endif; ' and save the file log%:=LogHandle(); 'get the logfile handle View(log%); ' show it FileSaveAs(logfilename$,1); ' save it