forked from restrepd-zz/dropc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdropcInitializePortsNowMic.m
72 lines (45 loc) · 2.01 KB
/
dropcInitializePortsNowMic.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
function handles=dropcInitializePortsNowMic(handles)
% Initialize the DIO96H/50
%Create the digital I/O object dio
%The installed adaptors and hardware IDs are found with daqhwinfo
handles.dio = digitalio('mcc',1);
%Add FIRSTPORTA for odor valves:
addline(handles.dio,0:7,'out');
%Add FIRSTPORTB for control of background odor valve
addline(handles.dio,8:15,'out');
%Add FIRSTPORTCL FIRSTPORTCH
%FIRSTPORTCL 2-final valve 8-noise valve 4+1 Water
addline(handles.dio,16:23,'out');
%Add SECONDPORTA for lick detector
addline(handles.dio,24:31,'in');
%Add SECONDPORTB for photodiode detector
addline(handles.dio,32:39,'in');
%Add SECONDPORTCL SECONDPORTCH
addline(handles.dio,40:47,'in');
%Add THIRDPORTA
addline(handles.dio,48:55,'out');
%Add THIDPORTB for output to recording computer DT3010
addline(handles.dio,56:63,'out');
%Now initialize the DIO96H/50
dropcTurnValvesOffNow(handles);
%Turn off output to draq
putvalue(handles.dio.Line(57:64),uint8(255));
% Now get input from input ports
% Note: It is important that this be done without the animal in the cage
% because the program makes all decisions by comparing the values obtained
% here to the values during the experiment
%handles.dropcProg.photodiodeOn=getvalue(handles.dio.Line(33:40));
%handles.dropcProg.noLick=getvalue(handles.dio.Line(25:32));
%Turn off output to draq
handles.dropcDigOut.draqPortStatus=uint8(0);
dropcUpdateDraqPort(handles);
%Initialize microphone input
%Create analog input object
handles.ai=analoginput('winsound');
%Add channels
addchannel(handles.ai,1);
%Set frequency
set(handles.ai,'SampleRate',handles.dropcProg.freq)
%Set samples per trigger
dt=handles.dropcProg.shortTime+handles.dropcProg.noRAsegments*handles.dropcProg.dt_ra;
set(handles.ai,'SamplesPerTrigger',freq*dt)