Pulse Pal Internal Memory?

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pulse Pal Internal Memory?
#1
Hi all,
Having some issues sending large numbers of pulses through the PulsePal via Python. When sending pulses through the code we have is working very nicely up until approximately the 2000th pulse, the exact number changes each time. Both the pulse pal and and the python console hang until the device is physically reset, although the BNC LED is still on indicating that pulses should be going through, the oscilloscope says otherwise. Is there any reason ~2000 should be an issue, the only thing I can think of is that we are running into some internal memory issue with the Arduino? I'm fairly certain my code is fine as it works right up until this point and fine in isolation, but just in case here is an example of how I am triggering the pulse pal:

resolution = 100 # in usecs
time_between_stimulation = 0
width = np.array(range(100,1000,resolution))
voltage = np.array(range(5,5000,100))
pulse_shape = np.array(range(0,3))
stimulation_site = np.array(range(1,2))
stimulation_combinations =(list(itertools.product(width,voltage,pulse_shape,stimulation_site)))

def channel_trigger(channel):
    if channel == 1:
        myPulsePal.triggerOutputChannels(1, 0, 0, 0)
    if channel == 2:
        myPulsePal.triggerOutputChannels(0, 1, 0, 0)   
    if channel == 3:
        myPulsePal.triggerOutputChannels(1, 1, 0, 0)
    if channel == 4:
        myPulsePal.triggerOutputChannels(0, 0, 0, 1)
    
#Square pulse
def square_pulse(stim_par):
    divisions = int(stim_par[0]/resolution)
    voltages = [stim_par[1]*0.001]*divisions        
    step_width = round((resolution*0.000001),6)
    print 'sq',voltages
    if stim_par[3] == 1:
        myPulsePal.programOutputChannelParam(4, 1, step_width) 
        myPulsePal.programOutputChannelParam(14, 1, 1) # Set output channel 1 to use custom train 1
        myPulsePal.sendCustomWaveform(1, step_width, voltages) 
        channel_trigger(1)
        time.sleep(stim_par[0]*0.000001)
        time.sleep(time_between_stimulation)
    if stim_par[3] == 2:
        myPulsePal.programOutputChannelParam(4, 2, step_width) 
        myPulsePal.programOutputChannelParam(14, 2, 1) # Set output channel 2 to use custom train 1
        myPulsePal.sendCustomWaveform(1, step_width, voltages) 
        channel_trigger(2)
        time.sleep(stim_par[0]*0.000001)
        time.sleep(time_between_stimulation)        
    if stim_par[3] == 3:
        myPulsePal.programOutputChannelParam(4, 1, step_width) 
        myPulsePal.programOutputChannelParam(4, 2, step_width) 
        myPulsePal.programOutputChannelParam(14, 1, 1) # Set output channel 1 to use custom train 1
        myPulsePal.programOutputChannelParam(14, 2, 1) # Set output channel 2 to use custom train 1
        myPulsePal.sendCustomWaveform(1, step_width, voltages)
        channel_trigger(3)
        time.sleep(stim_par[0]*0.000001)
        time.sleep(time_between_stimulation)        
    return

for combination in range(0,len(stimulation_combinations)):
    #Square pulse
    print combination
    if stimulation_combinations[combination][2]==0:
        TTL_trigger()
        square_pulse(stimulation_combinations[combination])
        TTL_trigger()
        square_pulse(stimulation_combinations[combination])
        TTL_trigger()
        square_pulse(stimulation_combinations[combination])

       #Ramp 
    if stimulation_combinations[combination][2]==1:
        TTL_trigger()
        ramp_pulse(stimulation_combinations[combination])
        TTL_trigger()
        ramp_pulse(stimulation_combinations[combination])
        TTL_trigger()
        ramp_pulse(stimulation_combinations[combination])

    #Triangle
    if stimulation_combinations[combination][2]==2:
        TTL_trigger()
        triangle_pulse(stimulation_combinations[combination])
        TTL_trigger()
        triangle_pulse(stimulation_combinations[combination])
        TTL_trigger()
        triangle_pulse(stimulation_combinations[combination])

Any help would be appreciated.
Best wishes,
Gareth York
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)