A simple oscilloscope software application for BitScope.
The BitLib Scope application is a program built with BitLib that implements a single channel oscilloscope. It demonstrates many of the analog capture capabilities of BitScope.
The screenshot above shows the BitLib Scope when connected to the Sydney BitScope.
This BitScope captures waveforms generated by a WavePOD and is connected to the Internet.
You can connect with it using this application just as you can using BitScope DSO. The animation here shows the waveforms that are available.
This is possible because the BitLib Scope and BitScope DSO are very similar internally; both use the same Host/BitScope communication technology to control one or more BitScopes.
This works the same regardless of whether the BitScope is connected locally via USB or, as in this example, remotely via the Internet.
In the case of this application it is of course all implemented in BitLib.
It takes care of connecting with the BitScope (even half way around the world as this example shows) as well as the script programming required to trigger, capture and upload the waveform data for display.
The channel dialog selects which input source and channel to capture.
It also selects the coupling (AC/DC), prescaler enable and the input attenuation to be applied.
All these channel related parameters are accessed via two simple BitLib Channel Control Functions.
As the menu displayed here shows there are more than two channels. This is because BitScope captures on any (combination of) analog or logic channel(s).
That is, BitScopes have 10 or more channels in total comprising 2 or 4 analog and 8 logic channels.
BitLib enumerates the analog channels from 0 to 15 and the logic channels from 16 to 31. In the case of a dual analog channel model like BS325 there are 2 analog channels (0 and 1) and 8 logic channels (16 to 23).
BitScope is a mixed signal system so BitLib treats logic channels the same as analog but with only two values:
Consequently it is very easy to use BitLib to build a mixed signal application because all channels are presented the same way: as analog signals.
BitLib makes using BitScope's trigger very easy.
On each channel one specifies a trigger level and whether the trigger should occur on the rising or falling edge of the signal when it crosses that level.
The set up shown here triggers when the signal on the first channel falls below 0V.
There is a third trigger option; Forced.
In oscilloscope applications this is needed to implement auto-triggers and arbitrary waveform capture.
It can also be very handy when building spectrum analyzers, voltmeters and other data capture and analysis applications (e.g. WaveMeter).
These parameters are set using BL_SetupTrigger.
BitScope supports a range of other trigger parameters including logic bit patterns, trigger hold-off and filters as well as pre and post trigger delays settings.
BitLib makes these available via the API but this scope example does not make use of them. Full source code is provided though, so feel free to add them!
Analog and logic signal capture performed by BitScope is called a Trace.
The Trace Control specifies how fast and for how long BitScope should capture.
BitLib Scope provides a selection of rates and capture durations via the drop-down menus.
These are convenient to view the waveforms connected to the Sydney BitScope but library itself allows any values to be used subject to the physical limits of the BitScope.
Simply type in whatever values you want.
If BitLib determines that the values used are not supported by the BitScope, the nearest valid values will be substituted.
The trace parameters are set via two simple Trace Control Functions and the capture buffer size required (allocated by the application) is reported via BL_BufferSize.
When device constrained, the sample rate and capture duration actually used can also be obtained via the API.
BitScope Library Diagnostics
While the BitLib Scope is an example oscilloscope application built using BitLib it is also a good BitScope programming diagnostic tool.
By default BitLib Scope displays some information about the BitScope and the library operations performed in the Diagnostic Log in the main display.
In this example it shows that one BS301N model BitScope identified as RE52HO10 at the internet address sydney.bitscope.net was found.
This information is reported via the library's diagnostic BL_Log function.
This function allows the programmer to see what's happening in the library and between the PC and BitScope itself.
The information reported by default is relatively low volume and designed to provide general operational information.
However, if required the library can report everything down to the BitScope script level to help with debugging.
After using this for a while you should soon get the idea about how to write your own BitLib based software for BitScope.
The BitScope Connection
The key to connecting with BitScope when using any BitLib based application is the probe file.
It is specified via the probe file parameter shown here and is the same file used by the BitScope DSO (via its built-in SETUP dialog).
The probe file is a simple text file that tells the application which BitScope to connect to and how to connect to it. The syntax is very simple; it comprises one or more lines like this:
[connect to the SYDNEY BitScope via the Internet] UDP:sydney.bitscope.net
[connect to a USB BitScope via COM Port 3] USB:COM3
[connect to a serial BitScope via /dev/ttyS0 (linux)] TTY:/dev/ttyS0
[connect to a USB BitScope via /dev/ttyUSB0 (linux)] USB:/dev/ttyUSB0
[connect to a BitScope on your LAN using multicast] UDP:MULTICAST
See the probe file itself (any text editor can read it) for full details.
Copyright © 2023 BitScope Designs