Start Command help
MEDState Notation Repository › Forums › Coding Help Archive › Start Command help
- This topic has 1 reply, 1 voice, and was last updated 8 years, 9 months ago by
Med_Support.
-
AuthorPosts
-
January 20, 2010 at 10:48 am #13155
Med_Support
Moderatormlr12
Hi,
I am having trouble with a conditioning program. The program starts on its own when loaded in MEDPC-IV with the exception that the house lights do not turn on. I would like the program to start only after I send the execution signal manually. Also, I would like house light to turn on immediately after the signal is iniated manually. I have posted my code below and I appreciate any advice you may have.
Sincerely,
mlr12
\outputs ^houselights=4 ^feeder=3 \inputs ^counter=3 DIM C=8 DIM D=8 DIM P=8 DIM N=8 LIST W=1",2",3",4",5",6",7",8",9",10",11",12",13",14",15",16",17",18",19",20" LIST U=30",90",150" S.S.1, \GENERAL CONTROL S1, #START:ON ^HOUSELIGHTS--->SX S.S.2, \TONE OPERATOR S1, 90":K3;Z8--->S2 \TRIAL COUNTER S2, .1": IF(Q=2)OR(Q=3)OR(Q=5)OR(Q=8) [@TRUE,@FALSE] @TRUE:--->S3 @FALSE:--->S10 S3, #T:K1;Z1--->S4 S4, 30":--->S5 \ITI HEAD INSERTION 1 MEASURED S5, 1":RANDI A=U--->S6 S6, A#T:K2;Z5--->S7 S7, 30":--->S8 \ITI HEAD INSERTION 2 MEASURED S8, 1": ~InitANL926;~; \ reset ANL-926 ~SetFreq(MG, BOX,3000);~; \ initialize frequency ~SetAmp(MG, BOX,80);~; \ initialize amplitude ~ToneOn(MG, BOX);~;K4;Z9--->S9 \ issue start stimulus S9, 90": ~ToneOff(MG, BOX);~;--->S1 S10, 30":--->S11 S11, 1":RANDI A=U--->S12 S12, 30":--->S13 S13, 1": ~InitANL926;~; \ reset ANL-926 ~SetFreq(MG, BOX,3000);~; \ initialize frequency ~SetAmp(MG, BOX,80);~; \ initialize amplitude ~ToneOn(MG, BOX);~;K5;Z2--->S14 \ issue start stimulus S14, 90": ~ToneOff(MG, BOX);~;--->S1 S.S.3 \ # OF HEAD INSERTIONS MEASURE S1, #R^COUNTER: ADD K; IF K>=2 [@TRUE,@FALSE] @TRUE: Z4;SET K=0--->S2 @FALSE:--->SX .2":SET K=O--->S1 S2, #R^COUNTER:--->S2 .2":--->S1 S.S.4 \ITI 1 #OF HEAD INSERTIONS MEASURE S1, #Z1:--->S2 S2, #Z4:ADD D(E)--->SX 30":ADD E--->S1 S.S.5 \ITI 2 #OF HEAD INSERTIONS MEASURE S1, #Z5:--->S2 S2, #Z4:ADD P(S)--->SX 30":ADD S--->S1 S.S.6 \CS # OF HEAD INSERTIONS MEASURE DURING TRIALS 2 5 6 8 ONLY S1, #Z9:--->S2 S2, #Z4:ADD C(B)--->SX 30":ADD B--->S1 S.S.7 \TIME INCREMENTS S1, #START:--->S2 S2, 0.1":SET T=T+.1--->SX S.S.8 \PELLET OPERATOR S1, #Z9:--->S2 S2, 30":--->S3 S3, .01":RANDI H=W;ADD J--->S4 S4, H#T:ON ^FEEDER;SET M=20"-H--->S5 S5, M#T:OFF ^FEEDER;IF J=3[@TRUE,@FALSE] @TRUE:SET J=0--->S1 @FALSE:--->S3 S.S.9 \PELLET OPERATOR S1, #Z2:--->S2 S2, .01":RANDI H=W;ADD J--->S3 S3, H#T:ON ^FEEDER;SET M=20"-H--->S4 S4, M#T:OFF ^FEEDER;IF J=4[@TRUE,@FALSE] @TRUE:SET J=0--->S1 @FALSE:--->S2 S.S.10 \TOTAL CS HEAD COUNTER DURING TRIALS 2 5 6 8 ONLY S1, #Z9:--->S2 S2, #Z4:ADD N(L)--->SX \CS response measure 90":ADD L--->S1 S.S.11 \TRIAL COUNTER S1, #Z8:ADD Q; SHOW 1, TRIAL, Q--->SX S.S.12 \SHUT OFF S1, .1":IF Q=9[@TRUE,@FALSE] @TRUE:OFF ^HOUSELIGHTS--->STOPABORTFLUSH @FALSE:--->S1
March 1, 2010 at 10:34 am #13156Med_Support
ModeratorGary Bamberger
If I understand you correctly you only want the program to start timing when you issue the START command. If you look at S.S.2 and S.S.3 you will see that they have no #START command. Those two State Sets start immediately when the program is loaded. If you add a new State that waits for the START command and then goes on with the rest of the program, it should do what you want. The modified program with the two State Sets waiting for the START command is posted below.
\ Outputs ^Feeder = 3 ^HouseLights = 4 \ Inputs ^Counter = 3 DIM C = 8 DIM D = 8 DIM P = 8 DIM N = 8 LIST W = 1",2",3",4",5",6",7",8",9",10",11",12",13",14",15",16",17",18",19",20" LIST U = 30",90",150" S.S.1, \ General Control S1, #START: ON ^HouseLights ---> SX S.S.2, \ Tone Operator S20, #START: ---> S1 S1, 90": K3; Z8 ---> S2 \ Trial Counter S2, 0.1": IF (Q = 2) OR (Q = 3) OR (Q = 5) OR (Q = 8) [@True, @False] @True: ---> S3 @False: ---> S10 S3, #T: K1; Z1 ---> S4 S4, 30": ---> S5 \ ITI Head Insertion 1 Measured S5, 1": RANDI A = U ---> S6 S6, A#T: K2; Z5 ---> S7 S7, 30": ---> S8 \ ITI Head Insertion 2 Measured S8, 1": ~InitANL926;~; \ Reset ANL-926 ~SetFreq(MG, BOX, 3000);~; \ Initialize Frequency ~SetAmp(MG, BOX, 80);~; \ Initialize Amplitude ~ToneOn(MG, BOX);~; \ Issue Start Stimulus K4; Z9 ---> S9 S9, 90": ~ToneOff(MG, BOX);~ ---> S1 S10, 30": ---> S11 S11, 1": RANDI A = U ---> S12 S12, 30": ---> S13 S13, 1": ~InitANL926;~; \ Reset ANL-926 ~SetFreq(MG, BOX, 3000);~; \ Initialize Frequency ~SetAmp(MG, BOX, 80);~; \ Initialize Amplitude ~ToneOn(MG, BOX);~; \ Issue Start Stimulus K5; Z2 ---> S14 S14, 90": ~ToneOff(MG, BOX);~ ---> S1 S.S.3, \ # of Head Insertions Measure S1, #START: ---> S2 S2, #R^Counter: ADD K; IF K >= 2 [@True, @False] @True: SET K = 0; Z4 ---> S3 @False: ---> SX 0.2": SET K = O ---> S2 S3, #R^Counter: ---> S3 0.2": ---> S2 S.S.4, \ ITI 1 # of Head Insertions Measure S1, #Z1: ---> S2 S2, 30": ADD E ---> S1 #Z4: ADD D(E) ---> SX S.S.5, \ ITI 2 # of Head Insertions Measure S1, #Z5: ---> S2 S2, 30": ADD S ---> S1 #Z4: ADD P(S) ---> SX S.S.6, \ CS # of Head Insertions Measure During Trials 2 5 6 8 Only S1, #Z9: ---> S2 S2, 30": ADD B ---> S1 #Z4: ADD C(B) ---> SX S.S.7, \ Time Increments S1, #START: ---> S2 S2, 0.1": SET T = T + 0.1 ---> SX S.S.8, \ Pellet Operator S1, #Z9: ---> S2 S2, 30": ---> S3 S3, 0.01": RANDI H = W; ADD J ---> S4 S4, H#T: ON ^Feeder; SET M = 20" - H ---> S5 S5, M#T: OFF ^Feeder; IF J = 3 [@True, @False] @True: SET J = 0 ---> S1 @False: ---> S3 S.S.9, \ Pellet Operator S1, #Z2: ---> S2 S2, 0.01": RANDI H = W; ADD J ---> S3 S3, H#T: ON ^Feeder; SET M = 20" - H ---> S4 S4, M#T: OFF ^Feeder; IF J = 4 [@True, @False] @True: SET J = 0 ---> S1 @False: ---> S2 S.S.10, \ Total CS Head Counter During Trials 2 5 6 8 Only S1, #Z9: ---> S2 S2, 90": ADD L ---> S1 #Z4: ADD N(L) ---> SX \ CS Response Measure S.S.11, \ Trial Counter S1, #Z8: ADD Q; SHOW 1,TRIAL,Q ---> SX S.S.12, \ Shut Off S1, 0.1": IF Q = 9 [@True, @False] @True: OFF ^HouseLights ---> STOPABORTFLUSH @False: ---> S1
-
AuthorPosts
- You must be logged in to reply to this topic.