Skip to main content

Example


The examples below list the register writes needed for common stimulation protocols. In Bonsai, each write can be sent to the device with a CreateMessage operator (from Bonsai.Harp), using the register address and type shown in the register summary, connected to the Device operator.

Constant current​

Drive the LED connected to LED0 with a constant current of 200 mA:

StepRegisterAddressTypeValue
1Led0MaxCurrent44Float250
2LedEnable41U80x01
3Led0Current37Float200

To turn the LED off, write 0 to Led0Current, or write 0x01 to LedDisable (address 42) to switch off the driver while keeping the configured current.

Pulse train​

Drive the LED connected to LED0 with a 20 Hz, 10 % duty cycle pulse train at 200 mA:

StepRegisterAddressTypeValueNotes
1PulseFrequencyLed049U82020 Hz
2PulseDutyCycleLed047U81010 % (5 ms on per 50 ms period)
3Dac0Voltage39Float10001000 mV / 5 = 200 mA
4PulseEnable46U80x01Start the pulse train in channel 0

To stop the pulse train, write 0x00 to PulseEnable.

note

Pulses act on the value of the Dac0Voltage register, which is why the current is configured in mV in step 3. See DAC voltage for details.

Ramp​

Ramp the LED connected to LED0 up to 200 mA over 2 s, and back down to 0 mA over 500 ms:

StepRegisterAddressTypeValueNotes
1PulseEnable46U80x00Ramps only work with pulses disabled
2RampConfig53U80x03LED0_UP and LED0_DOWN
3RampLed051U1620002000 ms
4Dac0Voltage39Float1000Ramp up to 200 mA
5RampLed051U16500500 ms
6Dac0Voltage39Float0Ramp down to 0 mA, after the ramp up ends