Advanced configuration
These advanced configuration settings affect which data the Behavior device reports. By default, all events are enabled, but you can selectively disable certain events. The device can also transmit serial timestamps on the poke port P2 for logging and alignment on non-Harp devices. Refer to the connections article to set up the Breakout on P2 for the serial timestamp.
This article covers how to visualize the default event streams, select the active events, and transmit serial timestamps in Bonsai.
The complete workflow is shown below. Copy and paste it into Bonsai to get started immediately, or build each section by following the step-by-step instructions in the following sections.
Visualize analog data
This workflow uses AnalogData as an example to demonstrate how to disable a data stream that is enabled by default. First, visualize the AnalogData stream, which reports the analog inputs at 1 kHz (see Acquire analog data for more details):
- Insert a
SubscribeSubjectoperator namedBehavior Events. - Insert a
Parseoperator and configure theRegisterproperty toAnalogData. - Insert a
VisualizerWindowoperator.
Run the workflow. The visualizer immediately displays a rapid stream of AnalogData values because this event stream is enabled by default.
Enable event streams
The EventEnable register selects which event streams the device reports. All five are enabled by default: PortDI, PortDIO, Camera0, Camera1 and AnalogData. Write a new selection to choose the streams you want to keep; any event not specified is disabled.
- Insert a
KeyDownoperator and set theFilterproperty toA. - Insert a
CreateMessageoperator and configure the following properties:Payload- SelectEventEnablePayload.EventEnable- EnterPortDI, PortDIO, Camera0, Camera1to disable theAnalogDataevent and keep the rest.
- Insert a
MulticastSubjectoperator namedBehavior Commands.
Run the workflow and press A. The visualizer will stop showing any new AnalogData events.
Transmit serial timestamps
The EnableSerialTimestamp register enables the serial timestamp transmission, an auxiliary output that can be used by non-Harp devices to log Harp timestamps for time alignment.
At the start of every second, the device transmits its current time in whole seconds as a 32-bit unsigned integer in 4 bytes, least significant byte first. The transmission format is serial (UART) data at 1000 bps, with 8 data bits, no parity, and one stop bit.
Record this signal on a general purpose digital input port of an external device and decode it to align the data on the non-Harp device with other Harp data.
To enable the transmission:
- Insert a
KeyDownoperator and set theFilterproperty toS. - Insert a
CreateMessageoperator and configure the following properties:Payload- SelectEnableSerialTimestampPayload.EnableSerialTimestamp- SelectTimestampPort2. On older package versions, if this dropdown option is not visible, enter4(this value enables theSerialTimestampPort).
- Insert a
MulticastSubjectoperator namedBehavior Commands.
Run the workflow and press S. The timestamp transmission on the P2 serial line begins at the starting boundary of the next second of the Harp clock. Verify the signal on the digital input line on the external device, it should appear as a series of digital input transitions at one second intervals.
Note
The serial timestamp transmission is not the same as the Harp synchronization clock, which keeps connected Harp devices synchronized. The Behavior device does not generate the Harp synchronization clock and can only receive it. For a Harp synchronization clock generator, consider the Harp Timestamp Generator Gen3.
Documentation for release v3.4.0