VI -90seconds

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #13032
    Med_Support
    Moderator
    andersem

    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

    #13033
    Med_Support
    Moderator
    Gary 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
    
    #13036
    Med_Support
    Moderator
    andersem

    WOW! Thanks so much! Likely will be posting again for the next step in the experiment. What do the Z pulses do?

    #13038
    Med_Support
    Moderator
    Gary 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.

    #13040
    Med_Support
    Moderator
    andersem

    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!

    #13042
    Med_Support
    Moderator
    Gary 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

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.