Table of Contents

Rhs2116 Stimulating

The following excerpt from the HeadstageRhs2116 example workflow demonstrates the Rhs2116 stimulation functionality by streaming and saving data from the Rhs2116 device.

/workflows/hardware/rhs2116/rhs2116-stimulate.bonsai workflow

The DigitalInput operator generates a sequence of DigitalInputDataFrames. Although the digital inputs are sampled at 4 Mhz, these data frames are only emitted when the port status changes (i.e., when a pin, button, or switch is toggled). In the example workflow, the DigitalInput's DeviceName property is set to "BreakoutBoard/DigitalInput". This links the DigitalInput operator to the Breakout Board's digital inputs.

BreakoutButtonState is selected from the DigitalInputDataFrame. It is an enumerator with values that correspond to bit positions of the breakout board's digital port. Buttons connects to Condition which is inspectable with the F12 hotkey. Condition contains a HasFlags operator. Because HasFlags's Value property is set to "Triangle", it outputs "True" when the △ button is pressed. Condition passes BreakoutButtonState to Double when the its internal conditional statement is evaluated is true. Double emits a value of type double to Rhs2116StimulusTrigger anytime it receives an item in its upstream sequence.

When Rhs2116StimulusTrigger receives a double from the upstream sequence, a stimulus is triggered. The value of the double determines the duration of a precise hardware delay between triggering and actually delivering the stimulus. If the double is zero, there is no hardware delay. The stimulus waveform delivered is configured in the Headstage RHS2116 GUI. If the sequencer is busy or the stimulator is disarmed when the trigger occurs, stimulus won't be delivered. This can be checked using the Rhs2116TriggerData operator as demonstrated in the Rhs2116 Trigger Data page.

Rhs2116StimulusTrigger's DeviceName property is set to "HeadstageRhs2116/StimulusTrigger" to link this operator to the Rhs2116 devices on the Headstage Rhs2116.

Tip

For more details about configuring the Rhs2116 and its stimulation capabilities, read the datasheet.