VI -90seconds
MEDState Notation Repository › Forums › Coding Help Archive › VI -90seconds
- This topic has 5 replies, 1 voice, and was last updated 9 years ago by
Med_Support.
-
AuthorPosts
-
May 10, 2013 at 1:16 pm #13032
Med_Support
Moderatorandersem
Hi all,
I am new to MedPC and notation. I can read code but have a hard time writing it. All I need is for the house light to turn on and pellets to be released on a variable interval of 90seconds. The session needs to end after 25 minutes or when 50 pellers are received. I do not need any responses recorded. This is just for acquisition purposes. Anyone able to help?
Eden
May 10, 2013 at 1:49 pm #13033Med_Support
ModeratorGary Bamberger
^LeftLever = 1 ^Pellet = 3 ^HouseLight = 7 LIST Z = 60", 70", 80", 90", 100", 110", 120" S.S.1, S1, #START: ON ^HouseLight; RANDD Y = Z ---> S2 S2, Y#T: ---> S3 S3, #R^LeftLever: ON ^Pellet; ADD D ---> S4 S4, 0.05": OFF ^Pellet; IF A >= 50 [@MaxPellets, @Cont] @Max: Z32 ---> S1 @Cont: RANDD Y = Z ---> S2 S.S.2, S1, #START: ---> S2 S2, 25': ---> STOPABORTFLUSH #Z32: ---> STOPABORTFLUSH
May 10, 2013 at 2:12 pm #13036Med_Support
Moderatorandersem
WOW! Thanks so much! Likely will be posting again for the next step in the experiment. What do the Z pulses do?
May 10, 2013 at 2:18 pm #13038Med_Support
ModeratorGary Bamberger
Z pulses are a way of communicating between State Sets. In this case when the maximum number of pellets have been delivered the Z32 pulse lets the other State Set know that this has happened and that the program should end.
May 13, 2013 at 11:13 am #13040Med_Support
Moderatorandersem
More questions for you Gary,
If there is no correct lever, do I need the response on the left lever code? Can I delete S3 altogether and then the pellets will automatically come out regardless of a response on a lever (there were not automatically coming out on a VI 90 with this code, the house light went on but no pellets)? Also, what is the code to get the levers to come out or go in?
Thanks again for your help!
May 13, 2013 at 12:08 pm #13042Med_Support
ModeratorGary Bamberger
A typical Variable Interval procedure is the program waits for the interval to pass and then reinforces the first/next response. If I understand you correctly what you are describing is a Variable Time procedure. That is where you wait a variable amount time to pass and then dispense a pellet. The lever is ignored. There is no punishment or reward for pressing the lever. In that case just remove the code for the Left Lever.
^Pellet = 3 ^HouseLight = 7 LIST Z = 60", 70", 80", 90", 100", 110", 120" S.S.1, S1, #START: ON ^HouseLight; RANDD Y = Z ---> S2 S2, Y#T: ON ^Pellet; ADD D ---> S4 S4, 0.05": OFF ^Pellet; IF A >= 50 [@MaxPellets, @Cont] @Max: Z32 ---> S1 @Cont: RANDD Y = Z ---> S2 S.S.2, S1, #START: ---> S2 S2, 25': ---> STOPABORTFLUSH #Z32: ---> STOPABORTFLUSH
To the program the lever is just an output. To get the lever to extend you just need to turn on the appropriate output (Ex: ON 1). To get the lever to retract you turn off the output (Ex: OFF 1).
If the pellet is not dispensing, then you need to either connect the pellet dispenser to output 3 or change the ^Pellet constant to match the output that your pellet is connected to. The same would be true for extending the lever.
Gary
-
AuthorPosts
- You must be logged in to reply to this topic.