<!--{{{-->
<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml' />
<!--}}}-->
Background: #fff
Foreground: #000
PrimaryPale: #8cf
PrimaryLight: #18f
PrimaryMid: #04b
PrimaryDark: #014
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
/*{{{*/
body {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}

a {color:[[ColorPalette::PrimaryMid]];}
a:hover {background-color:[[ColorPalette::PrimaryMid]]; color:[[ColorPalette::Background]];}
a img {border:0;}

h1,h2,h3,h4,h5,h6 {color:[[ColorPalette::SecondaryDark]]; background:transparent;}
h1 {border-bottom:2px solid [[ColorPalette::TertiaryLight]];}
h2,h3 {border-bottom:1px solid [[ColorPalette::TertiaryLight]];}

.button {color:[[ColorPalette::PrimaryDark]]; border:1px solid [[ColorPalette::Background]];}
.button:hover {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::SecondaryLight]]; border-color:[[ColorPalette::SecondaryMid]];}
.button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::SecondaryDark]];}

.header {background:[[ColorPalette::PrimaryMid]];}
.headerShadow {color:[[ColorPalette::Foreground]];}
.headerShadow a {font-weight:normal; color:[[ColorPalette::Foreground]];}
.headerForeground {color:[[ColorPalette::Background]];}
.headerForeground a {font-weight:normal; color:[[ColorPalette::PrimaryPale]];}

.tabSelected{color:[[ColorPalette::PrimaryDark]];
	background:[[ColorPalette::TertiaryPale]];
	border-left:1px solid [[ColorPalette::TertiaryLight]];
	border-top:1px solid [[ColorPalette::TertiaryLight]];
	border-right:1px solid [[ColorPalette::TertiaryLight]];
}
.tabUnselected {color:[[ColorPalette::Background]]; background:[[ColorPalette::TertiaryMid]];}
.tabContents {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::TertiaryPale]]; border:1px solid [[ColorPalette::TertiaryLight]];}
.tabContents .button {border:0;}

#sidebar {}
#sidebarOptions input {border:1px solid [[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel {background:[[ColorPalette::PrimaryPale]];}
#sidebarOptions .sliderPanel a {border:none;color:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:hover {color:[[ColorPalette::Background]]; background:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:active {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::Background]];}

.wizard {background:[[ColorPalette::PrimaryPale]]; border:1px solid [[ColorPalette::PrimaryMid]];}
.wizard h1 {color:[[ColorPalette::PrimaryDark]]; border:none;}
.wizard h2 {color:[[ColorPalette::Foreground]]; border:none;}
.wizardStep {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];
	border:1px solid [[ColorPalette::PrimaryMid]];}
.wizardStep.wizardStepDone {background:[[ColorPalette::TertiaryLight]];}
.wizardFooter {background:[[ColorPalette::PrimaryPale]];}
.wizardFooter .status {background:[[ColorPalette::PrimaryDark]]; color:[[ColorPalette::Background]];}
.wizard .button {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryLight]]; border: 1px solid;
	border-color:[[ColorPalette::SecondaryPale]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryPale]];}
.wizard .button:hover {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Background]];}
.wizard .button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::Foreground]]; border: 1px solid;
	border-color:[[ColorPalette::PrimaryDark]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryDark]];}

.wizard .notChanged {background:transparent;}
.wizard .changedLocally {background:#80ff80;}
.wizard .changedServer {background:#8080ff;}
.wizard .changedBoth {background:#ff8080;}
.wizard .notFound {background:#ffff80;}
.wizard .putToServer {background:#ff80ff;}
.wizard .gotFromServer {background:#80ffff;}

#messageArea {border:1px solid [[ColorPalette::SecondaryMid]]; background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]];}
#messageArea .button {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::SecondaryPale]]; border:none;}

.popupTiddler {background:[[ColorPalette::TertiaryPale]]; border:2px solid [[ColorPalette::TertiaryMid]];}

.popup {background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]]; border-left:1px solid [[ColorPalette::TertiaryMid]]; border-top:1px solid [[ColorPalette::TertiaryMid]]; border-right:2px solid [[ColorPalette::TertiaryDark]]; border-bottom:2px solid [[ColorPalette::TertiaryDark]];}
.popup hr {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::PrimaryDark]]; border-bottom:1px;}
.popup li.disabled {color:[[ColorPalette::TertiaryMid]];}
.popup li a, .popup li a:visited {color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:active {background:[[ColorPalette::SecondaryPale]]; color:[[ColorPalette::Foreground]]; border: none;}
.popupHighlight {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
.listBreak div {border-bottom:1px solid [[ColorPalette::TertiaryDark]];}

.tiddler .defaultCommand {font-weight:bold;}

.shadow .title {color:[[ColorPalette::TertiaryDark]];}

.title {color:[[ColorPalette::SecondaryDark]];}
.subtitle {color:[[ColorPalette::TertiaryDark]];}

.toolbar {color:[[ColorPalette::PrimaryMid]];}
.toolbar a {color:[[ColorPalette::TertiaryLight]];}
.selected .toolbar a {color:[[ColorPalette::TertiaryMid]];}
.selected .toolbar a:hover {color:[[ColorPalette::Foreground]];}

.tagging, .tagged {border:1px solid [[ColorPalette::TertiaryPale]]; background-color:[[ColorPalette::TertiaryPale]];}
.selected .tagging, .selected .tagged {background-color:[[ColorPalette::TertiaryLight]]; border:1px solid [[ColorPalette::TertiaryMid]];}
.tagging .listTitle, .tagged .listTitle {color:[[ColorPalette::PrimaryDark]];}
.tagging .button, .tagged .button {border:none;}

.footer {color:[[ColorPalette::TertiaryLight]];}
.selected .footer {color:[[ColorPalette::TertiaryMid]];}

.sparkline {background:[[ColorPalette::PrimaryPale]]; border:0;}
.sparktick {background:[[ColorPalette::PrimaryDark]];}

.error, .errorButton {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Error]];}
.warning {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryPale]];}
.lowlight {background:[[ColorPalette::TertiaryLight]];}

.zoomer {background:none; color:[[ColorPalette::TertiaryMid]]; border:3px solid [[ColorPalette::TertiaryMid]];}

.imageLink, #displayArea .imageLink {background:transparent;}

.annotation {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border:2px solid [[ColorPalette::SecondaryMid]];}

.viewer .listTitle {list-style-type:none; margin-left:-2em;}
.viewer .button {border:1px solid [[ColorPalette::SecondaryMid]];}
.viewer blockquote {border-left:3px solid [[ColorPalette::TertiaryDark]];}

.viewer table, table.twtable {border:2px solid [[ColorPalette::TertiaryDark]];}
.viewer th, .viewer thead td, .twtable th, .twtable thead td {background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::Background]];}
.viewer td, .viewer tr, .twtable td, .twtable tr {border:1px solid [[ColorPalette::TertiaryDark]];}

.viewer pre {border:1px solid [[ColorPalette::SecondaryLight]]; background:[[ColorPalette::SecondaryPale]];}
.viewer code {color:[[ColorPalette::SecondaryDark]];}
.viewer hr {border:0; border-top:dashed 1px [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::TertiaryDark]];}

.highlight, .marked {background:[[ColorPalette::SecondaryLight]];}

.editor input {border:1px solid [[ColorPalette::PrimaryMid]];}
.editor textarea {border:1px solid [[ColorPalette::PrimaryMid]]; width:100%;}
.editorFooter {color:[[ColorPalette::TertiaryMid]];}

#backstageArea {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::TertiaryMid]];}
#backstageArea a {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstageArea a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; }
#backstageArea a.backstageSelTab {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
#backstageButton a {background:none; color:[[ColorPalette::Background]]; border:none;}
#backstageButton a:hover {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstagePanel {background:[[ColorPalette::Background]]; border-color: [[ColorPalette::Background]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]];}
.backstagePanelFooter .button {border:none; color:[[ColorPalette::Background]];}
.backstagePanelFooter .button:hover {color:[[ColorPalette::Foreground]];}
#backstageCloak {background:[[ColorPalette::Foreground]]; opacity:0.6; filter:'alpha(opacity=60)';}
/*}}}*/
/*{{{*/
* html .tiddler {height:1%;}

body {font-size:.75em; font-family:arial,helvetica; margin:0; padding:0;}

h1,h2,h3,h4,h5,h6 {font-weight:bold; text-decoration:none;}
h1,h2,h3 {padding-bottom:1px; margin-top:1.2em;margin-bottom:0.3em;}
h4,h5,h6 {margin-top:1em;}
h1 {font-size:1.35em;}
h2 {font-size:1.25em;}
h3 {font-size:1.1em;}
h4 {font-size:1em;}
h5 {font-size:.9em;}

hr {height:1px;}

a {text-decoration:none;}

dt {font-weight:bold;}

ol {list-style-type:decimal;}
ol ol {list-style-type:lower-alpha;}
ol ol ol {list-style-type:lower-roman;}
ol ol ol ol {list-style-type:decimal;}
ol ol ol ol ol {list-style-type:lower-alpha;}
ol ol ol ol ol ol {list-style-type:lower-roman;}
ol ol ol ol ol ol ol {list-style-type:decimal;}

.txtOptionInput {width:11em;}

#contentWrapper .chkOptionInput {border:0;}

.externalLink {text-decoration:underline;}

.indent {margin-left:3em;}
.outdent {margin-left:3em; text-indent:-3em;}
code.escaped {white-space:nowrap;}

.tiddlyLinkExisting {font-weight:bold;}
.tiddlyLinkNonExisting {font-style:italic;}

/* the 'a' is required for IE, otherwise it renders the whole tiddler in bold */
a.tiddlyLinkNonExisting.shadow {font-weight:bold;}

#mainMenu .tiddlyLinkExisting,
	#mainMenu .tiddlyLinkNonExisting,
	#sidebarTabs .tiddlyLinkNonExisting {font-weight:normal; font-style:normal;}
#sidebarTabs .tiddlyLinkExisting {font-weight:bold; font-style:normal;}

.header {position:relative;}
.header a:hover {background:transparent;}
.headerShadow {position:relative; padding:4.5em 0 1em 1em; left:-1px; top:-1px;}
.headerForeground {position:absolute; padding:4.5em 0 1em 1em; left:0px; top:0px;}

.siteTitle {font-size:3em;}
.siteSubtitle {font-size:1.2em;}

#mainMenu {position:absolute; left:0; width:10em; text-align:right; line-height:1.6em; padding:1.5em 0.5em 0.5em 0.5em; font-size:1.1em;}

#sidebar {position:absolute; right:3px; width:16em; font-size:.9em;}
#sidebarOptions {padding-top:0.3em;}
#sidebarOptions a {margin:0 0.2em; padding:0.2em 0.3em; display:block;}
#sidebarOptions input {margin:0.4em 0.5em;}
#sidebarOptions .sliderPanel {margin-left:1em; padding:0.5em; font-size:.85em;}
#sidebarOptions .sliderPanel a {font-weight:bold; display:inline; padding:0;}
#sidebarOptions .sliderPanel input {margin:0 0 0.3em 0;}
#sidebarTabs .tabContents {width:15em; overflow:hidden;}

.wizard {padding:0.1em 1em 0 2em;}
.wizard h1 {font-size:2em; font-weight:bold; background:none; padding:0; margin:0.4em 0 0.2em;}
.wizard h2 {font-size:1.2em; font-weight:bold; background:none; padding:0; margin:0.4em 0 0.2em;}
.wizardStep {padding:1em 1em 1em 1em;}
.wizard .button {margin:0.5em 0 0; font-size:1.2em;}
.wizardFooter {padding:0.8em 0.4em 0.8em 0;}
.wizardFooter .status {padding:0 0.4em; margin-left:1em;}
.wizard .button {padding:0.1em 0.2em;}

#messageArea {position:fixed; top:2em; right:0; margin:0.5em; padding:0.5em; z-index:2000; _position:absolute;}
.messageToolbar {display:block; text-align:right; padding:0.2em;}
#messageArea a {text-decoration:underline;}

.tiddlerPopupButton {padding:0.2em;}
.popupTiddler {position: absolute; z-index:300; padding:1em; margin:0;}

.popup {position:absolute; z-index:300; font-size:.9em; padding:0; list-style:none; margin:0;}
.popup .popupMessage {padding:0.4em;}
.popup hr {display:block; height:1px; width:auto; padding:0; margin:0.2em 0;}
.popup li.disabled {padding:0.4em;}
.popup li a {display:block; padding:0.4em; font-weight:normal; cursor:pointer;}
.listBreak {font-size:1px; line-height:1px;}
.listBreak div {margin:2px 0;}

.tabset {padding:1em 0 0 0.5em;}
.tab {margin:0 0 0 0.25em; padding:2px;}
.tabContents {padding:0.5em;}
.tabContents ul, .tabContents ol {margin:0; padding:0;}
.txtMainTab .tabContents li {list-style:none;}
.tabContents li.listLink { margin-left:.75em;}

#contentWrapper {display:block;}
#splashScreen {display:none;}

#displayArea {margin:1em 17em 0 14em;}

.toolbar {text-align:right; font-size:.9em;}

.tiddler {padding:1em 1em 0;}

.missing .viewer,.missing .title {font-style:italic;}

.title {font-size:1.6em; font-weight:bold;}

.missing .subtitle {display:none;}
.subtitle {font-size:1.1em;}

.tiddler .button {padding:0.2em 0.4em;}

.tagging {margin:0.5em 0.5em 0.5em 0; float:left; display:none;}
.isTag .tagging {display:block;}
.tagged {margin:0.5em; float:right;}
.tagging, .tagged {font-size:0.9em; padding:0.25em;}
.tagging ul, .tagged ul {list-style:none; margin:0.25em; padding:0;}
.tagClear {clear:both;}

.footer {font-size:.9em;}
.footer li {display:inline;}

.annotation {padding:0.5em; margin:0.5em;}

* html .viewer pre {width:99%; padding:0 0 1em 0;}
.viewer {line-height:1.4em; padding-top:0.5em;}
.viewer .button {margin:0 0.25em; padding:0 0.25em;}
.viewer blockquote {line-height:1.5em; padding-left:0.8em;margin-left:2.5em;}
.viewer ul, .viewer ol {margin-left:0.5em; padding-left:1.5em;}

.viewer table, table.twtable {border-collapse:collapse; margin:0.8em 1.0em;}
.viewer th, .viewer td, .viewer tr,.viewer caption,.twtable th, .twtable td, .twtable tr,.twtable caption {padding:3px;}
table.listView {font-size:0.85em; margin:0.8em 1.0em;}
table.listView th, table.listView td, table.listView tr {padding:0px 3px 0px 3px;}

.viewer pre {padding:0.5em; margin-left:0.5em; font-size:1.2em; line-height:1.4em; overflow:auto;}
.viewer code {font-size:1.2em; line-height:1.4em;}

.editor {font-size:1.1em;}
.editor input, .editor textarea {display:block; width:100%; font:inherit;}
.editorFooter {padding:0.25em 0; font-size:.9em;}
.editorFooter .button {padding-top:0px; padding-bottom:0px;}

.fieldsetFix {border:0; padding:0; margin:1px 0px;}

.sparkline {line-height:1em;}
.sparktick {outline:0;}

.zoomer {font-size:1.1em; position:absolute; overflow:hidden;}
.zoomer div {padding:1em;}

* html #backstage {width:99%;}
* html #backstageArea {width:99%;}
#backstageArea {display:none; position:relative; overflow: hidden; z-index:150; padding:0.3em 0.5em;}
#backstageToolbar {position:relative;}
#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em;}
#backstageButton {display:none; position:absolute; z-index:175; top:0; right:0;}
#backstageButton a {padding:0.1em 0.4em; margin:0.1em;}
#backstage {position:relative; width:100%; z-index:50;}
#backstagePanel {display:none; z-index:100; position:absolute; width:90%; margin-left:3em; padding:1em;}
.backstagePanelFooter {padding-top:0.2em; float:right;}
.backstagePanelFooter a {padding:0.2em 0.4em;}
#backstageCloak {display:none; z-index:20; position:absolute; width:100%; height:100px;}

.whenBackstage {display:none;}
.backstageVisible .whenBackstage {display:block;}
/*}}}*/
/***
StyleSheet for use when a translation requires any css style changes.
This StyleSheet can be used directly by languages such as Chinese, Japanese and Korean which need larger font sizes.
***/
/*{{{*/
body {font-size:0.8em;}
#sidebarOptions {font-size:1.05em;}
#sidebarOptions a {font-style:normal;}
#sidebarOptions .sliderPanel {font-size:0.95em;}
.subtitle {font-size:0.8em;}
.viewer table.listView {font-size:0.95em;}
/*}}}*/
/*{{{*/
@media print {
#mainMenu, #sidebar, #messageArea, .toolbar, #backstageButton, #backstageArea {display: none !important;}
#displayArea {margin: 1em 1em 0em;}
noscript {display:none;} /* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */
}
/*}}}*/
<!--{{{-->
<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date'></span>)</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser excludeLists'></span></div>
<!--}}}-->
To get started with this blank [[TiddlyWiki]], you'll need to modify the following tiddlers:
* [[SiteTitle]] & [[SiteSubtitle]]: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)
* [[MainMenu]]: The menu (usually on the left)
* [[DefaultTiddlers]]: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened
You'll also need to enter your username for signing your edits: <<option txtUserName>>
These [[InterfaceOptions]] for customising [[TiddlyWiki]] are saved in your browser

Your username for signing your edits. Write it as a [[WikiWord]] (eg [[JoeBloggs]])

<<option txtUserName>>
<<option chkSaveBackups>> [[SaveBackups]]
<<option chkAutoSave>> [[AutoSave]]
<<option chkRegExpSearch>> [[RegExpSearch]]
<<option chkCaseSensitiveSearch>> [[CaseSensitiveSearch]]
<<option chkAnimate>> [[EnableAnimations]]

----
Also see [[AdvancedOptions]]
<<importTiddlers>>
Once data has been captured with a [[Trace]], then the data must be collected.

Data collection is done with the function [[BL_Acquire]]. To select a channel from which to collect data, use the function [[BL_ChannelSelect]]. BL_Acquire will read data from BitScope's internal buffers. Call BL_Acquire as many times as is necessary.

Note that in [[Streaming]] mode, [[BL_Acquire]] is also used to collect the data. In this case, data will be discarded upon a BL_Acquire call. See [[Streaming]] for more details.
{{{function BL_Acquire(ASize : Integer; AData : PDouble) : Boolean;}}}

BL_Acquire allows you to collect the data captured by the BitScope. The data is returned in volts, and in a standard capture, the number of samples captured was generated by the function [[BL_BufferSize]]. The number of samples generated should be specified as the argument ASize. The AData argument is a pointer to the first element in an array of doubles of length ASize. This function will return true if the data acquisition was performed successfully. In a standard capture, BL_Acquire will read data from the BitScope's internal buffers.

If using a multi-channel or chop mode, all the channel data has been stored after a BL_Trace call has completed. To access the data channels, you will need to switch channel with [[BL_ChannelSelect]]. For example, if we wish to capture chop channels ChA and ChB:
{{{
BL_ChannelSelect(0);
BL_Acquire(size,<POINTER TO ChA ARRAY>)
BL_ChannelSelect(1);
BL_Acquire(size,<POINTER TO ChB ARRAY>)
}}}

Note that in [[Streaming]] mode, the BitScope's internal buffers are not used, and the data is streamed to the hard drive. In this case, data can be extracted with BL_Acquire, one packet at a time. The size of the packet is arbitrary, so variable ASize can be any number, you do not need to use BL_BufferSize. In streaming mode, BL_Acquire will wait until ASize bytes have been loaded into the buffer. If more than one channel is enabled in Streaming mode, then each channel must be collected in sequence, otherwise data will be discarded. See [[Streaming]] for more details.
{{{function BL_BufferSize : Integer;}}}

BL_BufferSize returns the length of the return buffer. This value is dependent on values passed to [[BL_SampleRate]] and [[BL_CaptureTime]]. This function should always be called after [[BL_SampleRate]] and [[BL_CaptureTime]], and before [[BL_Acquire]].

As a rule of thumb, with no pre-trigger or delay options, BL_BufferSize will be calculated as BL_CaptureTime*BL_SampleRate. For example, a capture time of 1mS at a sample rate of 20MS/sec will result in 1x10^-3 * 20x10^6 = 20000 samples.  

Note that BL_BufferSize is not necessary when using [[Streaming]] modes.
{{{function BL_Calibrate(AHandle : Integer) : Boolean;}}}

BL_Calibrate will obtain internal calibration information on each channel of the BitScope. When this call is made, the library will perform a trace on each channel, for each range and each prescale. The data captured will be the zero offset calibration. Note that when a calibration is performed, ALL inputs should be ground referenced.

NOTE: There should be no signal attached to any input when calling this function. This function is designed as a stand-alone setup function. A trace on every channel for every input setting may take a few seconds. To remove a DC offset use the offset parameter in [[BL_SetupChannel]] call.

The results will be written to a file 'bitlib.cal' which will live in the standard install locations. If an error occurred in the calibration process, it is best to delete the calibration file bitlib.cal from your system. The calibration file can be found in the following locations... 

On Windows:
{{{
C:\Documents and Settings\<user>\Local Settings\Application Data\BitScope\state\bitlib.cal
}}}
where <user> is your current username.

On Linux:
{{{
~/.bitscope/state/bitlib.cal
}}}
Perform the calibration procedure again to re-create this file.


{{{function BL_CaptureTime(ACaptureTime : Integer) : Integer;}}}

Allows you to select the total capture duration, which includes pre and post trigger data. Here the return value is the time (in uS) that has been set inside the BitScope, which may be different to your requested capture time. The set value may be different if you have selected a value that may result in a problem e.g. a capture time that is too large. 

An argument of 0 will return the current setting of the capture time. 
An argument of -1 will choose the maximum possible capture time depending on the sample rate and pretrigger settings. Note that once this function is called, the return buffer size should be checked with [[BL_BufferSize]].

When selecting trace parameters, the most common problem is buffer overrun, where the BitScope does not have enough memory to capture your requested amount of data. In this event, this function will automatically choose a lower capture time, and give a warning that you will need to reduce the capture time or the sample rate.

NOTE: The final [[BL_BufferSize]] is calculated from BL_CaptureTime and the other [[Trace Setup]] functions such as [[BL_PreTrigger]] and [[BL_SampleRate]].
{{{function BL_ChannelCount(AHandle : Integer; ASrc : Integer; AAD : Integer) : Integer;}}}

BL_ChannelCount tells you the number of different channels that exist on the connected BitScope at AHandle, at a given source ASrc, and a given analog or digital value AAD. This function is largely used for the [[BL_RangeValue]] and [[BL_RangeReference]] functions.

The parameters are defined as follows
{{{
AHandle: BitScope index
ASrc: 0=POD, 1=BNC, 2=BNC Prescale 1, 3=BNC Prescale 2, 4=GND
AAD: analog=0,digital=1
}}}
NOTE: [[Reference Function|Reference Functions]] [[BL_SourcesCount]] should be used to ensure arguments are correct.
{{{function BL_ChannelEnable(ACh : Integer; AIsPOD: Boolean; AEnable : Boolean) : Boolean;}}}

BL_ChannelEnable enables a channel for capture or streaming. Channels need to be enabled before any [[BL_Trace]] call is made on the BitScope. Channels should be disabled if they are not in use. The number of channels that are able to be set can be obtained from the function [[BL_ChannelCount]].

NOTE: Only one logic channel needs to be enabled/disabled for all logic channels to be enabled/disabled. 

In streaming mode, if a channel is enabled, the data will be streamed. Data must then be collected with BL_Acquire from each channel. See [[Streaming]] for more details.
{{{function BL_ChannelSelect(ACh : Integer) : Boolean;}}}

BL_ChannelSelect allows you to select which channel to capture data from. Returns true if a valid channel was chosen. BL_ChannelSelect is also used to choose which channel to collect data from.

You can access the digital logic triggers through the 8 channels up from 16. For example, on a BS310, there are 2 analog channels 0 and 1. The 8 logic channels are 16,17,18,19,20,21,22,23 where 23 is the most significant bit.

Note that on a BS50, the logic channels may only be accessed in [[BL_Mode]](3), logic mode.

Note that in any multi-channel mode, for example, BL_Mode(1) CHOP mode, BL_Mode(4) MultiChannel mode, or BL_Mode(5) [[Streaming]], [[BL_ChannelSelect]] is used to select the dump channel. Use [[BL_Acquire]] to dump one channel at a time. 

Note that on a BS50, channel B on the BNC is ChA with a 10x prescale.
{{{procedure BL_Close;}}}

BL_Close closes ALL the links opened in the application. It should be called before closing the program. Note that only the links will be closed.
{{{function BL_Count(AHandle : Integer = -1) : Integer;}}}

When called with no argument or an argument of -1, BL_Count will return the number of successful BitScope links. With a valid handle, BL_Count will return the number of characters in the communication buffer. When this number is non-zero, [[BL_Receive]] can be used to extract the characters.
{{{function BL_Error(AHandle : Integer = -1) : Integer;}}}

This function is not yet implemented.
{{{function BL_GetRegister(AReg : PChar) : PChar;}}}

BL_GetRegister will return the hex value of any register in a connected BitScope. The register must be given as a 2 character hex string i.e. '2a'. The value returned will also be a 2 character string. BL_GetRegister is useful for debugging.
{{{function BL_GetTraceState() : Integer;}}}

BL_GetTraceState returns the state of the [[BL_Trace]] call if in asynchronous mode. The return value is an integer which represents an enumerated type:
{{{
TComStatus = (csIdle=0,csArmed=1,csCaptured=2,csTimedOut=3);
}}}
Once BL_Trace has been called with ASync = true this function can be repeatedly called to check the state of the BitScope.

NOTE: Asynchronous capture should always be used if using infinite timeouts in BL_Trace.
{{{function BL_Halt(AHandle : Integer) : Boolean;}}}

BL_Halt is only necessary in streaming mode, BL_Mode(5). BL_Halt stops the streaming capture from [[BL_Trace]]. BL_Halt will clear the BitLib buffers, so be sure to collect all the data before calling BL_Halt. The variable AHandle is the index of the connected BitScope.
{{{procedure BL_Initialize;}}}

BL_Initialize() must be called first before any other BitLib function. This is a procedure that
 simply initializes the classes inside the library. It should be called once only in the life of your program. Note that a [[BL_Close]] only closes BitScope links, it does not unload the library. If BL_Close is called, you do not need to call BL_Initialize again.
{{{function BL_Log() : PChar;}}}

BL_Log() will return the next line in the debug log. Ideally, this function should be called on the idle event in your program. If no new debug message is present, then a null pointer will be returned.  

The debug messages are written to a circular buffer, so if you do not need the log functionality, then you do not need to call BL_Log. If you do not call BL_Log, then old log messages will simply be overwritten, and the log will not affect your program.

Log messages are written in the following form:

Severity : Message

The "Severity" string will be one of 'DEBUG','INFO','WARNING','ERROR', in increasing order of importance. "Message" will be a string descriptor of the message. If necessary, use a regular expression to parse the message and remove the severity string.

The Delphi demo uses this function. View the Delphi demo code for an example of how to use BL_Log.
{{{function BL_Mode(AMode : Integer) : Boolean;}}}

BitLib operates in different modes. Modes 0-4 are very similar and deal with simple captures. Mode 5 deals with the streaming feature on selected BitScopes. Note that not all modes are available on all BitScopes. 

BL_Mode selects the mode of capture. The modes are defined as follows:

0) Single Channel - one channel (All scopes apart from 100, 120, 325, 442, 445)
1) Chop             - two channels (All 2 channel scopes apart from 100, 120, 325, 442, 445)
2) Mixed            - Ch A and Logic (50, 100, 120, 325)
3) Logic             - Logic only (50 only)
4) MultiChannel   - Analog channels (100, 120, 325 and 442/5 only)
5) [[Streaming]]      - Streaming capture (100, 120, 320, 325 and 445 only)

All modes follow a similar setup. After [[initializing|Initialization]] and selecting a BitScope, the first call should be BL_Mode. This sets up the BitScope with the appropriate buffers, clock rates etc.

After BL_Mode has been set you can proceed to configuring the BitScope with [[Channel Setup]], [[Trigger Setup]] and [[Trace Setup]] functions.

!!!Mode 0: Single Channel
BL_Mode(0) will result in single capture mode. The channel to trace and dump from is selected by BL_ChannelSelect. This mode is the default capture mode for the 50, 300, 310, 320 models.

!!!Mode 1: Chop
An argument of 1 selects CHOP mode. In chop mode, the data is captured from both channels. A call to [[BL_ChannelSelect]] switches between the channel from which to dump. That is, BL_ChannelSelect should be called before a [[BL_Acquire]] call. Chop modes apply to older BitScopes and the 300, 310, 320 models and the 440, 441 models. For example, on a BS310 in BL_Mode(1):

After a capture you would write:
{{{
BL_ChannelSelect(0);
BL_Acquire(returnPts,<POINTER TO ChA ARRAY>)
BL_ChannelSelect(1);
BL_Acquire(returnPts,<POINTER TO ChB ARRAY>)
}}}
In CHOP mode on 50,30x,31x,4xx BitScopes, you may only choose sample rates that are below 200kS/sec. Note that this does not apply to the BS320.

!!!Mode 2: Mixed
Mode 2 is Mixed mode, where both the logic and analog channels can be captured. Mixed mode is available to the BS50, BS100, BS120 the BS325 only. In this mode, channel A and the logic channels are available. Note that in Mixed mode on the BS50, the fast clock sample rates and the buffer size are divided by 2. This implies that 20MS/sec is the fastest clock rate available.

!!!Mode 3: Logic
Mode 3 is Logic mode, which enables you to capture and trigger from the 8 logic channels, running from 16..23. (23=MSB) The analog channels are not available in this mode. This mode is only available to the BS50. To capture logic on other BitScopes, use Mixed mode (2).

!!!Mode 4: MultiChannel
Mode 4 is MultiChannel mode. In this case all enabled analog channels are captured upon a trace call. This mode is only available to BS100, BS120, BS325, BS442 and BS445. Captured channels can be accessed in the same way as chop mode, with a BL_ChannelSelect call switching between the dump channels.

!!!Mode 5: Streaming
Mode 5 is [[Streaming]] mode, which is available to BitScopes that support streaming, namely BS100, BS120, BS320, BS325 and BS445. Streaming mode works similarly to Mode 4, though capture is continuous, so the [[BL_CaptureTime]] functionality is not necessary. Channels must be enabled with [[BL_ChannelEnable]] to setup for streaming mode. Once [[BL_Trace]] is called, the streaming will start, and buffers will begin to fill with data. [[BL_Acquire]] can then be called as many times as is necessary, collecting the data that streams from the enabled channels. The function [[BL_Halt]] should be used to stop the streaming capture. In streaming mode, sample rates are restricted to <= 20kS/sec. See [[Streaming]] for more details.
{{{function BL_Name(AHandle : Integer; AStr : PChar) : PChar;}}}

BL_Name returns the link name of the attached BitScope. AStr needs to point to an existing
 string which will be filled with the link name on exit. The return value is AStr.
{{{function BL_Open(AProbe : PChar; AOpenAll : Boolean = False) : Boolean;}}}

BL_Open must be called before any attempt is made to communicate to the attached BitScope. It reads a [[probe file|Probe File]] (specified by the argument AProbe) and attempts to open the links listed in the probe file.  The default probe file is 'bitscope.prb' and is located in the standard locations (see [[Probe File]]). Note that no path should be given to BL_Open. All probe files live in the standard location. If a probe file does not exist, then it will be created in the local probe file directory.

Alternatively, you can specify a specific probe file link. AProbe can also be a single probe file link, or a list of links with each link separated by a comma or carriage return.

If AOpenAll is set to true, then BL_Open will attempt to open all links specified in the file or list AProbe. If AOpenAll is set to false, then BL_Open will return once the first successful link is found.

If successful in opening any link, the function will return true. It will return false if no links or no probe file was found. 

The number of links that were successfully opened can be checked with [[BL_Count]] and other [[ID Functions]].

NOTE: Each call to BL_Open will close all the previous links. BL_Open is used for opening a list of links in a probe file. To dynamically open links use [[BL_OpenLink]].
{{{function BL_OpenLink(ALinkStr : PChar) : Integer;}}}

BL_OpenLink opens a single link, and will return the address of the BitScope link. If a link is already open or is invalid BL_OpenLink will return -1.

A link is specified according to the [[Probe File]] protocols.

Unlike [[BL_Open]], BL_OpenLink can be called multiple times without closing links. 
{{{function BL_PreTrigger(APreTrigger : Integer) : Integer;}}}

BL_PreTrigger sets the amount of data to be captured before the trigger. The argument APreTrigger specifies the pretrigger time in uS.  Note that this pretrigger time is included in the BL_CaptureTime value i.e. a setting of 400uS capture time and 50uS pretrigger will result in 400uS of data returning, with 50uS pretrigger and 350uS post trigger in the return buffer.

The pre-trigger value must be less than or equal to the [[BL_CaptureTime]].

NOTE: The final [[BL_BufferSize]] is calculated from BL_PreTrigger and the other [[Trace Setup]] functions such as [[BL_CaptureTime]] and [[BL_SampleRate]].
{{{function BL_RangeReference(AHandle : Integer; ACh : Integer; ASrc : Integer; AIndex : Integer; AAD : Integer ) : Double;}}}

BL_RangeReference tells you the mid point voltage level given a particular [[attenuation range]] value. The range value is specified by the channel ch, source src, BitScope index handle, and either analog or digital. Currently there are 4 ranges on every analog BitScope channel. All analog channels will currently return 0V, and all digital channels will return 2.5V as the mid point. This may change in the future however. 

The attenuation range controls the sensitivity of the analog to digital converter in the BitScope. The attenuation range that is currently selected for a channel can be changed with the function [[BL_SetupChannel]].

The parameters to BL_RangeReference are defined as follows
{{{
AHandle: BitScope index
ACh: channel index
ASrc: 0=POD, 1=BNC, 2=BNC Prescale 1, 3=BNC Prescale 2, 4=GND
AIndex: ranges (usually 0..3)
AAd: analog/digital
}}}
NOTE: other [[Reference Functions]] such as [[BL_ChannelCount]], [[BL_SourcesCount]] and [[BL_RangesCount]] should be used to ensure arguments are correct.
{{{function BL_RangeValue(AHandle : Integer; ACh : Integer; ASrc : Integer; AIndex : Integer; AAD : Integer ) : Double;}}}

BL_RangesValue tells you the peak to peak voltage range given a particular [[attenuation range]] value. The range value is specified by the channel ACh, source ASrc, BitScope index AHandle, and either analog or digital AAD. Currently there are 4 ranges on every BitScope channel. The attenuation range is the sensitivity of the analog to digital converter in the BitScope. The attenuation range can be changed with the function [[BL_SetupChannel]].
{{{
AHandle: BitScope index
ACh: channel index
ASrc: 0=POD, 1=BNC, 2=BNC Prescale 1, 3=BNC Prescale 2, 4=GND
AIndex: attenuation range (0..3)
AAd: analog/digital
}}}
NOTE: other [[Reference Functions]] such as [[BL_ChannelCount]], [[BL_SourcesCount]] and [[BL_RangesCount]] should be used to ensure arguments are correct.
{{{function BL_RangesCount(AHandle : Integer; ACh : Integer; ASrc : Integer; AAD : Integer) : Integer;}}}

BL_RangesCount tells you the number of different range values that exist depending on the channel ACh, source ASrc, BitScope index AHandle, and either analog or digital AAD. Currently there are 4 ranges on every analog BitScope channel, but this may change in the future.

This function is largely used for the [[BL_RangeValue]] and [[BL_RangeReference]] functions.

The parameters are defined as follows:
{{{
AHandle: BitScope index
ACh: channel index
ASrc: 0=POD, 1=BNC, 2=BNC Prescale 1, 3=BNC Prescale 2, 4=GND
AAD: analog=0,digital=1
}}}
NOTE: other [[Reference Functions]] such as [[BL_ChannelCount]] and [[BL_SourcesCount]] should be used to ensure arguments are correct.
{{{function BL_Receive(AHandle : Integer; AStr : PChar; ASize : Integer; ATimeOut : Integer = 0) : Boolean;}}}

BL_Receive collects ASize characters from the BitScope communications buffer. Before BL_Receive is 
called, check that [[BL_Count]](AHandle) returns a non-zero value. The BL_Count call determines how many characters are waiting to be read.

Once BL_Receive executes, the result is written into character array pointed to by AStr.
{{{function BL_SampleRate(ASampleRate : Double) : Double;}}}

Allows you to select the BitScope sample rate. Here the return value is the sample rate that has been set, which may be different to your requested sample rate, if you have selected an illegal value. Legal sample rate values differ depending on the BitScope version, but range from 40MHz to 10kHz.

An argument of 0 will return the current setting for the sample rate.
An argument of -1 will select the fastest possible sample rate for the current capture time settings. 

Note that if your capture time or sample rate is too high, then BitScope may not have enough buffer memory to capture. In this event, this function will select a lower sample rate and send a warning to the log to reduce your sample rate or capture time. 

The sample rate chosen will affect the return buffer size. You should always check the return buffer size with the function [[BL_BufferSize]]. 

NOTE: If you are using a BS50 in Mixed mode (BL_Mode 2), fast clock sample rates are divided by 2.

NOTE: The final [[BL_BufferSize]] is calculated from BL_SampleRate and the other [[Trace Setup]] functions such as [[BL_PreTrigger]] and [[BL_CaptureTime]].
{{{function BL_SelectBitScope(AHandle : Integer = -1) : Integer;}}}

BL_SelectBitScope allows you to select a BitScope that has been opened. All functions such as [[BL_SetupTrigger]], [[BL_SampleRate]], etc will now be directed to the selected BitScope. The return value will be the index of the selected BitScope. If BL_SelectBitscope is called with no argument (or -1), then the handle of the current selected BitScope will be returned.
{{{BL_Send(AHandle : Integer; AStr : PChar; ALayer : Integer = 0 );}}}

Send a string to a BitScope at address AHandle. The ALayer argument of 0 communicates to the BitScope. ALayer=1 communicates to the DWG on the BS100. The DWG has a different set of commands and registers. If the command AStr sent requires return characters i.e. A,S,?,p... etc then these can be read with the function BL_Receive.
{{{function BL_SetAddress(AAddr : Integer) : Boolean;}}}

BL_SetAddress will set the memory address for the start point of a capture or replay. The default address is zero. The function will return True if the memory address is valid. Once [[BL_Trace]] is called, data will be written to memory starting at address AAddr.

This function is useful for the [[Waveform Generator]], where you might wish to pre-load several different waveforms into different areas of memory.
{{{function BL_SetRegister(AReg : PChar; AValue : PChar) : Boolean;}}}

BL_SetRegister allows you to override certain register values in the BitScope. This is particularly useful in setting up a more complicated trigger. The two input values are strings register and value. Both inputs are in hex, and should be 2 characters long. e.g. to set register 0x0a to the value 0xff, you should call:
{{{
BL_SetRegister('0a','ff');
}}}
After each [[BL_Trace]] call, your override command will be reset, and you will need to call [[BL_SetRegister]] again to override a register again.

WARNING: Overriding the registers could cause unexpected results.
{{{function BL_SetTriggerDelay(ADelayTime : Integer) : Integer;}}}

This sets the trigger delay. That is the time in uS between the trigger point and when BitScope should begin capturing data.

NOTE: The argument must be an even number.
{{{function BL_SetupChannel(AChannel : Integer; AIsPOD : Boolean; ACoupling : Integer; ARange : Integer; AOffset : Double; APreScale : Integer) : Boolean;}}}

BL_SetupChannel allows you to set up any of the Bitscope channels. The function returns true if the values entered were valid. The arguments are as follows:

!!!AChannel 
AChannel is the channel to configure.
Analog channels have values 0..15
Digital channels have values 16..23 (23=MSB,16=LSB)
However, BL_SetupChannel is not relevant to the digital channels, as the digital channels have no coupling or attenuation ranges.
NOTE: Not all analog channels will be valid. On a BS50 say, you will have one analog BNC channel.

!!!AIsPOD  
AIsPOD allows you to select the POD or BNC for the channel. true - POD, false - BNC.

!!!ACoupling
ACoupling allows you to specify the coupling 
0 = AC
1 = DC

!!!ARange
ARange selects the Bitscope [[attenuation range]] (0..3).

!!!AOffset
AOffset sets the signal offset in volts.

!!!APreScale 
Prescaling is only avaliable in certain BitScopes. The prescaler will boost the input signal to give you 4 more attenuation ranges. The available prescale sizes are:
*x10: BS310, BS311, BS320, BS100, BS442
*x20: BS325, BS326, BS120, BS445
You may also select a ground prescaler value. The APreScale argument corresponds to

0 = BNCx1 (No Prescale)
1 = BNC Prescaler
2 = GND
{{{function BL_SetupReplay(ACh : Integer = 1) : Boolean;}}}

BL_SetupReplay initializes the BitScope to use the [[Waveform Generator]]. BL_SetupReplay will prepare to replay the uploaded waveform (uploaded with [[BL_Write]]) on the BNC output ACh. The 3xx series BitScopes can only replay the waveform on BNC channel B.

BL_SetupReplay should be called before setting up the [[BL_SampleRate]] and [[BL_CaptureTime]]
parameters. The boolean returned indicates the success of the setup.

After this function is called, a call to [[BL_Trace]] (with appropriate [[trigger|Trigger Setup]] and [[trace|Trace Setup]] setup) will place the waveform on the BNC output. 

For BS50, the waveform is replayed on ChA. For all other wavegen BitScopes, waveforms will be replayed through BNC ChB.

For BS325, it is possible to output the waveform on the logic POD. This can be done by calling BL_SetupReplay(16). This will output the waveform on the logic channels. Note that with the logic output enabled, you can still output on BNC ChB. To do this, simply call 
{{{
BL_SetupReplay(1);
BL_SetupReplay(16);
}}}
The waveform will then be played on ChB and logic simultaneously.

On two channel scopes it is still possible to capture on ChA while replaying waveforms on ChB. This can be done by setting up a standard capture on ChA and then calling BL_SetupReplay(1). The WaveGen demo application is setup with this configuration.

NOTE: To have the waveform appear on the output, on some BitScopes you will need to switch
the 'WaveForm generator' switch on the front panel of your BitScope to '50 ohm'.

NOTE: Wavegenerator functionality has been disabled on the SYDNEY demo Bitscope unit.

{{{function BL_SetupTrigger(AChannel : Integer; ALevel : Double; AEdge : Integer) : Boolean;}}}

BL_SetupTrigger() allows you to set up the trigger for the Bitscope. AChannel selects the channel to trigger from. ALevel selects the trigger level in volts. AEdge selects the type of trigger, Fall=0, Rise=1. 

To disable the trigger, you will need to set a force a trigger event. To set a force trigger event set the [[BL_Trace]] timeout to 0.

BL_SetupTrigger returns a true if all argument values are valid.

It is also possible to trigger of the digital logic channels. The digital channels are the 8 channels from 16..23. The digital logic channels on all bitscopes are given channel numbers 16,17,18,19,20,21,22,23 where 23 is the most significant bit.

In this version of the library, you can only trigger on one channel at a time. 

See [[Trigger Setup]] for more information on triggering.
{{{function BL_SourcesCount(AHandle : Integer; AAD : Integer) : Integer;}}}

BL_SourcesCount tells you the number of different source values that exist on a particular BitScope. The number of sources will vary depending on the BitScope index AHandle, and either analog (0) or digital (1) AAD.

The input source values are enumerated as follows:
{{{
InputSources = 0=POD, 1=BNC, 2=BNC Prescale 1, 3=BNC Prescale 2, 4=GND
}}}

BL_SourcesCount will return the number of these sources that are available. For example, a BL_SourcesCount value of 2 implies that this AAD value has input sources POD and BNC.

This function is largely used for the [[BL_RangeReference]] and [[BL_RangeValue]] functions.

{{{function BL_Trace(ATimeOut : Integer; ASync : Boolean = False) : Boolean;}}}

BL_Trace performs the data trace in Bitscope. The ATimeout argument is the time in mS that Bitscope should wait for a trigger event. If no trigger is seen, the function will return false. To set an indefinite trigger set ATimeout to -1. The function will return true when a trigger event is seen. To produce a force trigger event, the ATimeout argument should be set to 0. You can also set a never trigger condition, by entering -2. Here a trigger will never occur, which may be useful for the [[Waveform Generator]]. Note that when using the negative ATimeout arguments, BL_Trace will block, and if no trigger event is seen, then BL_Trace will never return. You should always use asynchronous capture for negative timeout arguments. See below.

NOTE: if the timeout you request is shorter than the specified [[BL_CaptureTime]] then the internal timeout will be set to this [[BL_CaptureTime]].

The argument ASync allows you to select the asynchronous trace mode. This is a non-blocking call to trace a signal from the selected BitScope. Once the asynchronous trace has been called, the state of the trace call can be obtained through the function [[BL_GetTraceState]].
{{{function BL_Update(AHandle : Integer; AForce : Boolean = False) : Boolean;}}}

BL_Update is used to flush the register cache and update the BitScope. If the argument AForce is False, then only the registers that have changed in BitLib will be updated. If AForce is true, then all registers will be updated.

You can use this command to refresh the state of the BitScope. For example, say you wished to enable the LED on the front panel of the BitScope. Calling [[BL_ChannelEnable]] will prepare an instruction to enable the LED, but the instruction will not be sent until [[BL_Update]] is called. So
{{{
BL_ChannelEnable(0,False,True); // enable BNC channel 0
BL_Update(0,False); // update registers to turn on LED immediately...
}}}
Note that it is not strictly necessary for you to call BL_Update. The BitLib registers will be updated automatically when [[BL_Trace]] and [[BL_Acquire]] are called.
{{{function BL_Version(ATarget : Integer = 0) : PChar;}}}

BL_Version() returns the version number of the connected BitScope or the current version of the software as a string. An argument of 0 will return the Bitscope version number as a string. For example, if the BitScope connected is a BS300 then '300' will be returned. An argument of 1 will return the software version.
{{{function BL_WaveLevel(AVpp : Double) : Double;}}}

BL_WaveLevel sets the peak to peak voltage of the wavegen output. AVpp is the peak to peak voltage requested for the output waveform. The waveform may clip if this request is outside the wavegen output specifications. If your chosen voltage is outside the range of the BitScope, the voltage will be set to the nearest possible value. The return value is the actual value of the peak to peak output voltage.
{{{function BL_WaveOffset(AVdc : Double) : Double;}}}

BL_WaveOffset sets the DC offset voltage of the wavegen output. AVdc is the offset voltage requested for the output waveform. The waveform may clip if this request is outside the wavegen output specifications. If your chosen voltage is outside the range of the BitScope, the voltage will be set to the nearest allowable value. The return value is the actual DC offset that was set.
{{{function BL_Write(AAddr : Integer; ADataPtr : PInteger; ASize : Integer; ARepeatCount : Integer) : Boolean;}}}

BL_Write uploads a waveform into the memory of a BitScope for use with the [[Waveform Generator]]. Arguments are defined as follows: AAddr is the address in memory to start writing. ADataPtr is the pointer to an array of integers of size ASize that the user wishes to write into memory. The elements in the array ADataPtr can have values from 0..255). ARepeatCount defines the number of times this waveform is to be written into memory.

The boolean returned indicates the success of the upload.

For example, if to write the array arr:=[0,1,2,3] into memory 100 times, starting at address 0xff, you would write:
{{{
BL_Write(255,<ptr_to_arr>,4,100);
}}}
and to use a waveform with 1024 characters to fill up the 128K of a 310's memory you would write
{{{
BL_Write(0,<ptr_to_arr>,1024, 128);
}}}
where <ptr_to_arr> is the pointer to your waveform array arr. Here the waveform write is repeated 128 times to fill the 128K. Of course this could be written in one large BL_Write call from a 128K array i.e.
{{{
BL_Write(0,<ptr_to_128K_arr>,128*1024,1); 
}}}
WARNING: filling up the entire contents of the 128K memory may take a few minutes. 

To replay a waveform from a point other than the default address 0, then use the function [[BL_SetAddress]] to set the start address of the capture/replay.

NOTE: To play the waveform continuously, then you will need to ensure that the samples at the start and the end of the BitScope buffer have the correct period to prevent glitches.

NOTE: Wavegenerator functionality has been disabled on the SYDNEY demo Bitscope unit.

The BitScope Connection Manager is an application that searches your system for connected BitScopes.

The Connection Manager manages the [[Probe File]] for use with other applications. It also allows you to test and configure BitScopes.

The Connection Manager can be downloaded from the website www.bitscope.com.
The Setup functions configure the main functionality of BitScope. 

The address of a BitScope is then assigned with [[BL_Open]] or [[BL_OpenLink]] and an opened BitScope selected using [[BL_SelectBitScope]]. All subsequent setup and trace calls are directed to this BitScope until another is selected.

BL_SelectBitScope with no argument will return the currently selected BitScope.

Each BitScope has several modes of operation. To switch between these modes use [[BL_Mode]]. 

Depending on the mode, BitLib functions will behave differently. Once the BitLib library is [[initialized|Initialization]] and a valid BitScope selected, BL_Mode should be called at least once before any other setup and trace functions are used. See [[BL_Mode]] for more information. 
This entry shows the BitLib function definitions in C. 

If you are using C, please use the provided BitLib header file bitlib.h.

NOTE: bool is defined as an unsigned char

!!![[Initialization]]
void [[BL_Initialize]](void);
bool [[BL_Open]](char* _probe, bool _open_all);
int [[BL_OpenLink]](const char* _link_str);
!!![[Log|BL_Log]]
char* [[BL_Log]](void);
!!![[ID Functions]]
int [[BL_Count]](int _handle);
char* [[BL_Version]](int _target);
char* [[BL_Name]](int _handle, char* _str);
!!![[BitScope Setup]]
int [[BL_SelectBitScope]](int _handle);
bool [[BL_Mode]](int _mode);
!!![[Channel Setup]]
bool [[BL_ChannelSelect]](int _ch);
bool [[BL_ChannelEnable]](int _ch, bool _is_pod, bool _enable);
bool [[BL_SetupChannel]](int _ch, bool _is_pod, int _coupling, int _range, double _offset, int _prescale);
!!![[Trigger Setup]]
bool [[BL_SetupTrigger]](int _ch, double _level, int _edge);
int [[BL_SetTriggerDelay]](int _delay_time);
!!![[Trace Setup]]
bool [[BL_SetAddress]](int _addr);
double [[BL_SampleRate]](double _sample_rate);
int [[BL_CaptureTime]](int _capture_time);
int [[BL_PreTrigger]](int _pretrigger);
int [[BL_BufferSize]](void);
!!![[Trace]]
bool [[BL_Trace]](int _timeout, bool _sync);
int [[BL_GetTraceState]](void);
bool [[BL_Halt]](int _handle);
!!![[Acquire]]
bool [[BL_Acquire]](int _size, double* _data);
!!![[Close|BL_Close]]
void [[BL_Close]](void);
!!![[Register Functions]]
bool [[BL_SetRegister]](char* _reg, char* _value);
char* [[BL_GetRegister]](char* _reg);
bool [[BL_Update]](int _handle, bool _force);
!!![[Waveform Generator]]
double [[BL_WaveLevel]](double _vpp);
double [[BL_WaveOffset]](double _vdc);
bool [[BL_Write]](int _addr, int* _data, int _size, int _repeat_count);
bool [[BL_SetupReplay]](int _ch);
!!![[Calibration|BL_Calibrate]]
bool [[BL_Calibrate]](int _handle);
!!![[Reference|Reference Functions]]
int [[BL_SourcesCount]](int _handle, int _ad);
int [[BL_ChannelCount]](int _handle, int _src, int _ad);
int [[BL_RangesCount]](int _handle, int _ch, int _src,int _ad);
double [[BL_RangeValue]](int _handle, int _ch, int _src, int _index, int _ad);
double [[BL_RangeReference]](int _handle, int _ch, int _src, int _index, int _ad);
!!![[Low Level|Low Level Functions]]
void [[BL_Send]](int _handle, char* _str, int _layer);
bool [[BL_Receive]](int _handle, char* _str, int _size, int _timeout);
int [[BL_Error]](int _handle);
To capture or trigger from a channel it must be enabled and configured correctly. 

First, the relevant channels must be enabled using the [[BL_ChannelEnable]] function. 

Only when a channel is enabled may it be configured for capture.

In [[Streaming]] mode it also means that data will be collected from that channel.

Next, to setup the channel parameters use the function [[BL_SetupChannel]]. This changes the AC/DC coupling, the offset, prescale, and [[attenuation range]] parameters.

Finally, in BL_Mode 1 or 2 (single or chop) before a [[Trace]] the correct //trace channel// must be selected using [[BL_ChannelSelect]]. In [[BL_Mode]] 4 (multi-channel mode) a channel only needs to be enabled (with [[BL_ChannelEnable]]); selecting it is not necessary. 

Note#1: BL_ChannelSelect is also used by the [[Acquire]] functions; it selects the acquisition channel for chop or multi-channel encoded data dumps.

Note#2: the number of channels on a BitScope and the number of inputs it supports varies by BitScope model. For example, a BS325 has 2 analog channels and 8 logic channels. Each analog channel has two separate inputs BNC and POD and when BNC is selected, prescaled waveform. The channels are independent but the inputs are not. It is not possible to capture from the BNC and POD inputs on the same channel at the same time. The number of channels and inputs on your BitScope can be found using the [[Reference Functions]].

Background: #fff
Foreground: #000
PrimaryPale: #8cf
PrimaryLight: #3af
PrimaryMid: #008
PrimaryDark: #014
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #000
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
config.options.chkAnimate             = false;
To connect to a BitScope, you will need to use the [[probe file|Probe File]] functionality. The probe file is a file that stores links to BitScopes. Each link is defined in the following way 
{{{
PROTOCOL:ADDRESS
}}}
where PROTOCOL is one of UDP, USB, TTY or NIL. ADDRESS is the IP address or com port of the BitScope. For more information on links, see [[Probe File]].

In BitLib, you can connect to a BitScope with a probe file with 2 functions [[BL_Open]] or [[BL_OpenLink]]. Firstly BL_Open will take the name of a probe file and attempt to open all the links inside the probe file. The function will return true if any BitScope was opened successfully. Note that the probe file name that is entered is a filename only, with no path. The path of the probe file is fixed, and lives in 2 places on your system. See [[Probe File]] for details. As an example, let us take a simple BitLib program where we open a link and close the link:
{{{
BL_Initialize(); // This must be called once before using the library
BL_Open("bitscope.prb",true); // open all the links in the file bitscope.prb
BL_Close(); // close the opened links
}}}
Here the second argument of BL_Open is set to true. This argument determines whether to return after the first successful link or to open all links listed in the probe file. Here we have selected to open all the links listed in bitscope.prb. It is also possible to send BL_Open a list of links separated by carriage returns. For example:
{{{
BL_Initialize(); // This must be called once before using the library
BL_Open("USB:COM4\n UDP:sydney.bitscope.net\n USB:COM5",false); // open links in the file 
BL_Close(); // close the opened links
}}}
Here BL_Open will attempt to open each of the three links, but will return once the first successful link is found.

The second way to connect to a BitScope is with the function BL_OpenLink. This will attempt to open a single link and return the BitLib address. If the open was unsuccessful BL_OpenLink will return -1. For example
{{{
BL_Initialize();
index=BL_OpenLink("USB:/dev/ttyUSB0");
printf("Link opened at %d.",index);
BL_Close();
}}}

Also note that [[BL_Close]] will close all the opened BitScope links.
[[Getting Started]]
/***
|Name|DisableWikiLinksPlugin|
|Source|http://www.TiddlyTools.com/#DisableWikiLinksPlugin|
|Version|1.6.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Description|selectively disable TiddlyWiki's automatic ~WikiWord linking behavior|
This plugin allows you to disable TiddlyWiki's automatic ~WikiWord linking behavior, so that WikiWords embedded in tiddler content will be rendered as regular text, instead of being automatically converted to tiddler links.  To create a tiddler link when automatic linking is disabled, you must enclose the link text within {{{[[...]]}}}.
!!!!!Usage
<<<
You can block automatic WikiWord linking behavior for any specific tiddler by ''tagging it with<<tag excludeWikiWords>>'' (see configuration below) or, check a plugin option to disable automatic WikiWord links to non-existing tiddler titles, while still linking WikiWords that correspond to existing tiddlers titles or shadow tiddler titles.  You can also block specific selected WikiWords from being automatically linked by listing them in [[DisableWikiLinksList]] (see configuration below), separated by whitespace.  This tiddler is optional and, when present, causes the listed words to always be excluded, even if automatic linking of other WikiWords is being permitted.  

Note: WikiWords contained in default ''shadow'' tiddlers will be automatically linked unless you select an additional checkbox option lets you disable these automatic links as well, though this is not recommended, since it can make it more difficult to access some TiddlyWiki standard default content (such as AdvancedOptions or SideBarTabs)
<<<
!!!!!Configuration
<<<
<<option chkDisableWikiLinks>> Disable ALL automatic WikiWord tiddler links
<<option chkAllowLinksFromShadowTiddlers>> ... except for WikiWords //contained in// shadow tiddlers
<<option chkDisableNonExistingWikiLinks>> Disable automatic WikiWord links for non-existing tiddlers
Disable automatic WikiWord links for words listed in: <<option txtDisableWikiLinksList>>
Disable automatic WikiWord links for tiddlers tagged with: <<option txtDisableWikiLinksTag>>
<<<
!!!!!Revisions
<<<
2008.07.22 [1.6.0] hijack tiddler changed() method to filter disabled wiki words from internal links[] array (so they won't appear in the missing tiddlers list)
2007.06.09 [1.5.0] added configurable txtDisableWikiLinksTag (default value: "excludeWikiWords") to allows selective disabling of automatic WikiWord links for any tiddler tagged with that value.
2006.12.31 [1.4.0] in formatter, test for chkDisableNonExistingWikiLinks
2006.12.09 [1.3.0] in formatter, test for excluded wiki words specified in DisableWikiLinksList
2006.12.09 [1.2.2] fix logic in autoLinkWikiWords() (was allowing links TO shadow tiddlers, even when chkDisableWikiLinks is TRUE).  
2006.12.09 [1.2.1] revised logic for handling links in shadow content
2006.12.08 [1.2.0] added hijack of Tiddler.prototype.autoLinkWikiWords so regular (non-bracketed) WikiWords won't be added to the missing list
2006.05.24 [1.1.0] added option to NOT bypass automatic wikiword links when displaying default shadow content (default is to auto-link shadow content)
2006.02.05 [1.0.1] wrapped wikifier hijack in init function to eliminate globals and avoid FireFox 1.5.0.1 crash bug when referencing globals
2005.12.09 [1.0.0] initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.DisableWikiLinksPlugin= {major: 1, minor: 6, revision: 0, date: new Date(2008,7,22)};

if (config.options.chkDisableNonExistingWikiLinks==undefined) config.options.chkDisableNonExistingWikiLinks= true;
if (config.options.chkDisableWikiLinks==undefined) config.options.chkDisableWikiLinks=true;
if (config.options.txtDisableWikiLinksList==undefined) config.options.txtDisableWikiLinksList="DisableWikiLinksList";
if (config.options.chkAllowLinksFromShadowTiddlers==undefined) config.options.chkAllowLinksFromShadowTiddlers=true;
if (config.options.txtDisableWikiLinksTag==undefined) config.options.txtDisableWikiLinksTag="excludeWikiWords";

// find the formatter for wikiLink and replace handler with 'pass-thru' rendering
initDisableWikiLinksFormatter();
function initDisableWikiLinksFormatter() {
	for (var i=0; i<config.formatters.length && config.formatters[i].name!="wikiLink"; i++);
	config.formatters[i].coreHandler=config.formatters[i].handler;
	config.formatters[i].handler=function(w) {
		// supress any leading "~" (if present)
		var skip=(w.matchText.substr(0,1)==config.textPrimitives.unWikiLink)?1:0;
		var title=w.matchText.substr(skip);
		var exists=store.tiddlerExists(title);
		var inShadow=w.tiddler && store.isShadowTiddler(w.tiddler.title);
		// check for excluded Tiddler
		if (w.tiddler && w.tiddler.isTagged(config.options.txtDisableWikiLinksTag))
			{ w.outputText(w.output,w.matchStart+skip,w.nextMatch); return; }
		// check for specific excluded wiki words
		var t=store.getTiddlerText(config.options.txtDisableWikiLinksList);
		if (t && t.length && t.indexOf(w.matchText)!=-1)
			{ w.outputText(w.output,w.matchStart+skip,w.nextMatch); return; }
		// if not disabling links from shadows (default setting)
		if (config.options.chkAllowLinksFromShadowTiddlers && inShadow)
			return this.coreHandler(w);
		// check for non-existing non-shadow tiddler
		if (config.options.chkDisableNonExistingWikiLinks && !exists)
			{ w.outputText(w.output,w.matchStart+skip,w.nextMatch); return; }
		// if not enabled, just do standard WikiWord link formatting
		if (!config.options.chkDisableWikiLinks)
			return this.coreHandler(w);
		// just return text without linking
		w.outputText(w.output,w.matchStart+skip,w.nextMatch)
	}
}

Tiddler.prototype.coreAutoLinkWikiWords = Tiddler.prototype.autoLinkWikiWords;
Tiddler.prototype.autoLinkWikiWords = function()
{
	// if all automatic links are not disabled, just return results from core function
	if (!config.options.chkDisableWikiLinks)
		return this.coreAutoLinkWikiWords.apply(this,arguments);
	return false;
}

Tiddler.prototype.disableWikiLinks_changed = Tiddler.prototype.changed;
Tiddler.prototype.changed = function()
{
	this.disableWikiLinks_changed.apply(this,arguments);
	// remove excluded wiki words from links array
	var t=store.getTiddlerText(config.options.txtDisableWikiLinksList,"").readBracketedList();
	if (t.length) for (var i=0; i<t.length; i++)
		if (this.links.contains(t[i]))
			this.links.splice(this.links.indexOf(t[i]),1);
};
//}}}
[[BitLib|Operating BitLib]] is a programming library for all current model BitScopes. 

It abstracts the BitScope Virtual Machine into a [[functional API|C Function API]] that supports [[connecting to BitScope|Connection To BitScope]], [[setting up trigger conditions|Trigger Setup]], [[performing a waveform capture|Trace Setup]] and [[acquiring captured data|Acquire]] as well as more specialized functions such as [[generating signals|Waveform Generator]] and [[capturing continuous waveforms|Streaming]].

To use this document, simply click links in the text or on the menu on the right or use the //search box// (below right) to find all entries containing a search term. 

Click //close// in the top right corner of an an entry to close it. To see all references to the current entry click //more// and then //references//. Click //edit// to add notes to any entry (you can only do this on a local copy of this file).

To get started, select a function from the menu on the right or read [[Operating BitLib]], [[Pascal Function API]] or [[Connection To BitScope]].
To get started with this blank [[TiddlyWiki]], you'll need to modify the following tiddlers:
* [[SiteTitle]] & [[SiteSubtitle]]: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)
* [[MainMenu]]: The menu (usually on the left)
* [[DefaultTiddlers]]: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened
You'll also need to enter your username for signing your edits: <<option txtUserName>>
The ID functions are used for identification of BitScopes, and also to check that the [[BL_Open]] and [[BL_OpenLink]] functions opened the correct BitScopes.

The function [[BL_Count]] with no argument shows the number of BitScopes that are successfully connected. Addresses are assigned sequentially from 0, so BitScopes should have addresses from 0 to BL_Count-1.

The address can then be used to extract the version number with function [[BL_Version]], for example, a BS325 will return the version string "325". [[BL_Name]] will return the BitScope link name that can be used in a [[Probe File]].
Initializing BitLib comprises two parts: initializing the library and connecting to BitScope.

The library is initialized using [[BL_Initialize]] which should be called before any other BitLib function. It should only be called once!

Connecting to BitScopes is done through the functions [[BL_Open]] and [[BL_OpenLink]]. 
Please see [[Connection To BitScope]] for information on BitScope connections.

To extract ID information from the connected BitScopes, use the [[ID Functions]] to view values such the link name, address etc.
The functions [[BL_Send]] and [[BL_Receive]] allow low-level byte code communication with the BitScope. Using the register set it is possible to set any register in the BitScope. You can also send special commands such as the ID string command '?' or the halt command '!'.

It is not recommended that you use the low level communication, as BitLib is designed to avoid the BitScope byte code by creating a useful function set. Low level communication should be used for simple commands or minor register tweaking only.

BL_Error is not yet implemented.
[[Getting Started]]
[[Pascal Function API]]
[[C Function API]]
[[Initialization]]
[[Connection To BitScope]]
[[Operating BitLib]]
[[Log Functions|BL_Log]]
[[ID Functions]]
[[BitScope Setup]]
[[Channel Setup]]
[[Trigger Setup]]
[[Trace Setup]]
[[Trace Functions|Trace]]
[[Acquire Functions|Acquire]]
[[Close Functions|BL_Close]]
[[Reference Functions]]
[[Register Functions]]
[[Low Level Functions]]
[[Troubleshooting]]
This entry provides a general outline to the BitLib functionality. The BitLib library can connect to multiple BitScopes and can be used on any current model BitScope.

!!Overview
Each BitScope has several modes of operation, though each mode follows the procedure:

Initialize -> Setup -> Trace -> Acquire -> Close.

In the [[Initialize|Initialization]] stage, the library objects will be constructed and you can connect to your BitScopes. The [[Setup|BitScope Setup]] stage is where the [[trigger|Trigger Setup]], [[channel|Channel Setup]] and [[capture|Trace Setup]] parameters are set. At the [[Trace]] stage, the BitScope is told to commence the main capture or wavegen operation, and [[Acquire]] is where the data is collected. The Setup, Trace and Acquire stages can be looped and repeated as many times as necessary.

!!Initialize
Initially, [[BL_Initialize]] should be called to [[initialize|Initialization]] the library. This function should be called once only. BL_Initialize builds the internal structure of the library.

Next you will need to [[connect|Connection To BitScope]] to your BitScopes. [[BL_Open]] or [[BL_OpenLink]] allows you to specify the location of your BitScope. This can be done over USB, serial, or ethernet. Usually, links should be specified according to the [[Probe File]] protocols.

You can test and obtain information from the open links with the [[ID Functions]].

!!Setup
There are several parts of the BitScope that need to be setup in order to Capture correctly. You will need to configure the [[BitScope Setup]], the [[Channel Setup]], the [[Trigger Setup]], and the [[Trace Setup]] in that order.

Firstly, [[BitScope Setup]], selects the BitScope to talk to and configures the mode. First choose a BitScope to talk to with the function [[BL_SelectBitScope]]. Once a BitScope is selected, you should choose a mode. 

There are several modes in BitLib, which can be selected with the function [[BL_Mode]]. Note that the initialization and connection procedure is the same for all modes on all BitScopes. Once a BL_Mode is chosen, however, the BitScope will function differently. After initializing and selecting a BitScope, the next call should be BL_Mode. This sets up the BitScope with the appropriate buffers, clock rates etc.

The [[Channel Setup]] and [[Trigger Setup]] functions control the channel and trigger for the next capture. After setting up these parameters, it is not necessary to configure them at every capture, as the setup information will be retained.

The [[Trace Setup]] functions control the capture parameters. This is where the sample rate and capture time is set. With the trace setup functions, the buffer size will be calculated and returned to you via the call [[BL_BufferSize]]. This value should then be used to ensure that the correct number of samples are collected in the [[Acquire]] stage.

!!Trace
Once the setup functions have been executed, the [[trace|Trace]] commands start the BitScope capture cycle. In a standard capture [[mode|BL_Mode]], the BitScope will begin its trigger search and upon a trigger event, will then capture data into its buffers. In a [[Waveform Generator]] mode, the BitScope will begin replaying the buffer out the BNC input. In a [[streaming|Streaming]] mode, the BitScope will begin streaming data to your hard drive.

!!Acquire
Once a trace is complete, BitLib will be at the [[Acquire]] stage. At the Acquire stage, you can extract the data from the BitScope buffers. In a normal capture mode, data is extracted with [[BL_Acquire]]. The size of the capture buffer is defined by the setup parameters, and is given by the function [[BL_BufferSize]]. The channel to collect is set with the function [[BL_ChannelSelect]]. In a normal capture mode the data can be collected as many times as is necessary. In a streaming mode, BL_Acquire will read a packet of data and then remove it. See [[Streaming]] for more details.

!!Closing
Once your program is complete, or you no longer need the BitScope links, you should close the links with [[BL_Close]]. Note that this will not close the library, only the links. To reconnect, another call to [[BL_Open]] or [[BL_OpenLink]] is necessary. Another call to [[BL_Initialize]] is not necessary.

!!Example
In this simple pseudo-code example, let us assume there is a BitScope connected at the IP address 192.168.1.73, and we wish to capture a signal on BNC ChA. We will choose a rising edge trigger and capture 1mS of data at 40MS/sec

{{{
//initialize
BL_Initialize()      // initialize library
index=BL_OpenLink("UDP:192.168.1.73")          // open BitScope links 

//setup bitscope
BL_SelectBitScope(index);
BL_Mode(0);            // mode of operation

// setup channel
BL_ChannelEnable(0,false,true); // enable channel
BL_SetupChannel(0,false,0,3,0.0,0);  // setup channel parameters
BL_ChannelSelect(0); // channel select

// setup trigger
BL_SetupTrigger(0,0.0,1); // fall=0,rise=1

// setup trace
BL_CaptureTime(1000);   // setup capture time
BL_SampleRate(40.0);    // setup sample rate
BL_PreTrigger(0);    // request time before trigger
size=BL_BufferSize();    // collect the size of the return buffer

//trace
BL_Trace(5000)         <- capture from enabled channels

//collect
BL_ChannelSelect(0) <- select capture channel
BL_Acquire(size,array)       <- collect the data

// close links
BL_Close()         <- close the link
}}}
<!--{{{-->
<div class='header' macro='gradient horz #5af #2af'>
<div class='headerShadow'></div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<div id='sidebar'>
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'>
</div><div id='sidebarTabs' refresh='macro' force='true' macro='slider chkSideBarTabs SideBarTabs "index »" "display lists of tiddlers"'></div>
<!-- <div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div> -->
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
This entry lists the BitLib function definitions. 

Click on the function name to open the function definition in a new entry. 
If you prefer, you can view the [[function definitions in C|C Function API]].

In Object Pascal (i.e. Delphi) the functions are defined as follows:

!!![[Initialization]]
procedure [[BL_Initialize]];
function [[BL_Open]](AProbe : PChar; AOpenAll : Boolean = False) : Boolean;
function [[BL_OpenLink]](ALinkStr : PChar) : Integer;
!!![[Log|BL_Log]]
function [[BL_Log]]() : PChar;
!!![[ID Functions]]
function [[BL_Count]](AHandle : Integer = -1) : Integer;
function [[BL_Version]](ATarget : Integer = 0) : PChar;
function [[BL_Name]](AHandle : Integer; AStr : PChar) : PChar;
!!![[BitScope Setup]]
function [[BL_SelectBitScope]](AHandle : Integer = -1) : Integer;
function [[BL_Mode]](AMode : Integer) : Boolean;
!!![[Channel Setup]]
function [[BL_ChannelSelect]](ACh : Integer) : Boolean;
function [[BL_ChannelEnable]](ACh : Integer; AIsPOD: Boolean; AEnable : Boolean) : Boolean;
function [[BL_SetupChannel]](AChannel : Integer; AIsPOD : Boolean; ACoupling : Integer; ARange : Integer; AOffset : Double; APreScale : Integer) : Boolean;
!!![[Trigger Setup]]
function [[BL_SetupTrigger]](AChannel : Integer; ALevel : Double; AEdge : Integer) : Boolean;
function [[BL_SetTriggerDelay]](ADelayTime : Integer) : Integer;
!!![[Trace Setup]]
function [[BL_SetAddress]](AAddr : Integer) : Boolean;
function [[BL_SampleRate]](ASampleRate : Double) : Double;
function [[BL_CaptureTime]](ACaptureTime : Integer) : Integer;
function [[BL_PreTrigger]](APreTrigger : Integer) : Integer;
function [[BL_BufferSize]] : Integer;
!!![[Trace]]
function [[BL_Trace]](ATimeOut : Integer; ASync : Boolean = False) : Boolean;
function [[BL_GetTraceState]]() : Integer;
function [[BL_Halt]](AHandle : Integer) : Boolean;
!!![[Acquire]]
function [[BL_Acquire]](ASize : Integer; AData : PDouble) : Boolean;
!!![[Close|BL_Close]]
procedure [[BL_Close]];
!!![[Registers|Register Functions]]
function [[BL_SetRegister]](AReg : PChar; AValue : PChar) : Boolean;
function [[BL_GetRegister]](AReg : PChar) : PChar;
function [[BL_Update]](AHandle : Integer; AForce : Boolean = False) : Boolean;
!!![[Waveform Generator]]
function [[BL_WaveLevel]](AVpp : Double) : Double;
function [[BL_WaveOffset]](AVdc : Double) : Double;
function [[BL_Write]](AAddr : Integer; ADataPtr : PInteger; ASize : Integer; ARepeatCount : Integer) : Boolean;
function [[BL_SetupReplay]](ACh : Integer = 1) : Boolean;
!!![[Calibration|BL_Calibrate]]
function [[BL_Calibrate]](AHandle : Integer) : Boolean;
!!![[Reference|Reference Functions]]
function [[BL_SourcesCount]](AHandle : Integer; AAD : Integer) : Integer;
function [[BL_ChannelCount]](AHandle : Integer; ASrc : Integer; AAD : Integer) : Integer;
function [[BL_RangesCount]](AHandle : Integer; ACh : Integer; ASrc : Integer; AAD : Integer) : Integer;
function [[BL_RangeValue]](AHandle : Integer; ACh : Integer; ASrc : Integer; AIndex : Integer; AAD : Integer ) : Double;
function [[BL_RangeReference]](AHandle : Integer; ACh : Integer; ASrc : Integer; AIndex : Integer; AAD : Integer ) : Double;
!!![[Low Level|Low Level Functions]]
procedure [[BL_Send]](AHandle : Integer; AStr : PChar; ALayer : Integer = 0 );
function [[BL_Receive]](AHandle : Integer; AStr : PChar; ASize : Integer; ATimeOut : Integer = 0) : Boolean;
function [[BL_Error]](AHandle : Integer = -1) : Integer;

This file configures the BitScope Link Library to connect with BitScope devices via RS-232, USB or UDP IP networks. This file may be edited manually but this is not recommended unless you know what you are doing. 

The probe file specifies the links that a BitScope application will attempt to connect to. BitLib uses the probe file to manage links. If you do not know the correct probe file link for your BitScope, then you should run the [[BitScope Connection Manager]] application to locate the BitScope on your system. The BitScope Connection Manager is free and available for download at www.bitscope.com.

!!Probe File Locations
The probe file is located in different places, depending on the operating system. There are normally 2 probe files on your system, a global and a local probe file. Only the local probe file should be modified in normal circumstances.

!!!On Windows
On Windows installations, the probe file is located in the following locations:
{{{
C:\Documents and Settings\<user>\Local Settings\Application Data\BitScope\BitScope.prb
}}}
where <user> is your user name on your windows installation.

The global probe file is located at
{{{
<INSTALLATION DIRECTORY>\BitScope.prb
}}}
where <INSTALLATION DIRECTORY> is the location chosen when you installed a BitScope application. The default is
{{{
C:\Program Files\BitScope\BitScope.prb
}}}

!!!On Linux
On linux systems copies of the probe file are created or installed in two places, the local probe file is 
{{{
~/.bitscope/config/bitscope.prb
}}}
and the global probe file is located at
{{{
/etc/bitscope/bitscope.prb
}}}

Note that the local probe file is the probe file used by the BitLib function [[BL_Open]]. If this file does not exist, you should use the [[Connection Manager|BitScope Connection Manager]] application to locate your BitScopes and correctly configure your system. 

!!Probe File Syntax

Whitespace, blank lines or lines including '#' are ignored.

The remaining lines each define a single "link". Each link specifies a connection method and identifies a device.

The complete syntax of a LINK is:

LINK => SERIAL|NETWORK|NONE

SERIAL => UDP:ADDRESS(:PORT)?(:ID)?(:BC)?
NETWORK => (TTY|USB):DEVICE(:BC)?
NONE => NIL:BC(:PRODUCT)?(:VENDOR)?

TTY => serial connection method
USB => USB/Serial connection method
UDP => User Datagram Protcol (network) method
NIL => No connection method (simulate device)
 
DEVICE => serial or USB device (eg, /dev/ttyUSB0)
ADDRESS => IP address or host name or "MULTICAST"
PRODUCT => Device identifier (up to 8 alpha numeric)
VENDOR => Device vendor identifier (8 alpha-mueric)
PORT => IP port number (4 hex digits)
ID => BitScope LIA ID (4 hex digits)
BC => byte-code revision ID (eg, BC000301)

For example, to connect to a serial BitScope:
{{{
TTY:/dev/ttyS2
}}}
a USB BitScope:
{{{
USB:/dev/ttyUSB1
}}}
a serial BitScope, but only if it's a BS311
{{{
TTY:/dev/ttyS2:BS031100
}}}
a network BitScope via multicast
{{{
UDP:MULTICAST
}}}
or (if there are more than one BitScope on the local net) and you want to use port numbers to differentiate them
{{{
UDP:MULTICAST:4321
UDP:MULTICAST:4322
}}}
or using different IP addresses with unicast:
{{{
UDP:192.168.1.2
UDP:192.168.1.5
}}}
or if your BitScope has the hostname LABSCOPE
{{{
UDP:LABSCOPE
}}}
or to connect with our demo BS300N on the Internet
{{{
UDP:sydney.bitscope.net
}}}
!!Probe Defaults

These are reasonable defaults for a typical Windows host.
{{{
UDP:MULTICAST
USB:COM3
USB:COM4
USB:COM5
USB:COM6
USB:COM7
USB:COM8
USB:COM9
UDP:SYDNEY
TTY:COM1
TTY:COM2
NIL:BS032500
}}}
These are reasonable defaults for a typical Linux host.
{{{
USB:/dev/ttyUSB0
UDP:MULTICAST
USB:/dev/ttyUSB1
USB:/dev/ttyUSB2
UDP:SYDNEY
TTY:/dev/ttyS0
TTY:/dev/ttyS1
NIL:BS032500
}}}
The reference functions will show you information about the number of inputs, channels and values for [[attenuation ranges|attenuation range]] for the connected BitScopes. The reference functions are defined as follows:

{{{function BL_SourcesCount(AHandle : Integer; AAD : Integer) : Integer;}}}
{{{function BL_ChannelCount(AHandle : Integer; ASrc : Integer; AAD : Integer) : Integer;}}}
{{{function BL_RangesCount(AHandle : Integer; ACh : Integer; ASrc : Integer; AAD : Integer) : Integer;}}}
{{{function BL_RangeValue(AHandle : Integer; ACh : Integer; ASrc : Integer; AIndex : Integer; AAD : Integer ) : Double;}}}
{{{function BL_RangeReference(AHandle : Integer; ACh : Integer; ASrc : Integer; AIndex : Integer; AAD : Integer ) : Double;}}}

Each function has an argument AHandle which should be passed the BitLib address. The address will have been assigned by the function [[BL_Open]] or [[BL_OpenLink]]. All functions also have an analog or digital argument AAD. AAD is enumerated as follows:
{{{
AAD = (Analog=0,Digital=1);
}}}

[[BL_SourcesCount]] returns the number of input sources available on the BitScope at address AHandle. The input sources are enumerated as follows:
{{{
InputSources = 0=POD, 1=BNC, 2=BNC Prescale 1, 3=BNC Prescale 2, 4=GND
}}}
For example, if BL_SourcesCount returns 2 then only POD and BNC inputs are available.

[[BL_ChannelCount]] returns the number of channels available for the given input source on BitScope AHandle. The argument ASrc is an input source given by the enumeration above.

[[BL_RangesCount]] returns the number of different [[attenuation ranges|attenuation range]] for a given channel and input source on BitScope AHandle. For all current BitScopes, this function will return 4 for all analog channels. This may change in the future.

[[BL_RangeReference]] and [[BL_RangeValue]] return the reference and peak to peak voltage of the attenuation range specified by the given parameters. The reference voltage is the mid point of the attenuation range. The minimum value of the attenuation range can be calculated as BL_RangeReference-BL_RangeValue/2, and the maximum value can be calculated as BL_RangeReference+BL_RangeValue/2.

!!!Examples
To print out the peak to peak voltage of all attenuation ranges for BNC ChA, then you may write something like
{{{
scope=0; // address 0
ad=0;  // analog=0
ch=0;
src=1;  // BNC=1

range_count=BL_RangesCount(scope,ch,src,ad);

for(i=0;i<range_count;i++) {
  printf("range: %d val: %f",i,BL_RangeReference(scope,ch,src,i,ad));
}
}}}
To write all possible analog attenuation ranges on BitScope at address 0, then you may write something like 
{{{
scope=0;
ad=0;

src_count=BL_SourcesCount(scope,ad);

for(i=0;i<src_count;i++) {
  ch_count=BL_ChannelCount(scope,i,ad);
  for(j=0;j<ch_count;j++){
    range_count=BL_RangesCount(scope,j,i,ad);
    for(k=0;k<range_count;k++) {
       printf("src: %d ch: %d range: %d val: %f",i,j,k,BL_RangeReference(scope,j,i,k,ad));
    }
  }
}
}}}
Each BitScope has an internal set of byte code registers that control the functionality of the BitScope. BitLib abstracts the register level programming to define developer level functions and concepts.

It is possible, however, to bypass the BitLib internal structure to access the byte registers. The functions [[BL_SetRegister]] and [[BL_GetRegister]] allow users to override the BitLib calls to set BitScope registers. One common use for overriding registers is setting up a trigger mask, where one might wish to override the trigger mask register. See [[Trigger Setup]] for more details.

WARNING: It is not recommended that you override the registers as it could cause unpredictable behavior.
<<search>><<closeAll>><<permaview>><<newTiddler>><<slider chkSliderOptionsPanel OptionsPanel 'options »' 'Change TiddlyWiki advanced options'>>

BitScope Programmer's Library
BitLib API
Streaming mode is a BitScope mode in which data is not collected in the internal BitScope buffers, but is streamed out to the computer.

Streaming mode defined as [[BL_Mode]] 5 and is not available on all BitScopes. BitScopes with a streaming feature include BS100, BS120, BS320, BS325, BS326, BS445. 

Streaming mode is slightly different to regular capture modes. If a channel is enabled with [[BL_ChannelEnable]], the data will be streamed. In this case, a [[BL_Trace]] call will start streaming the data from the outputs of the BitScope into the attached computer. BL_Trace only needs to be called once. Setup functions such as [[Trigger Setup]] are not relevant, as data is streamed continuously. Functions that are relevant include the [[Channel Setup]] functions and the sample rate function [[BL_SampleRate]].

NOTE: Streaming mode has sample rates restricted to <= 20kS/sec

Once BL_Trace has been called, the data may be extracted. To extract the data as it appears, use the [[BL_Acquire]] call. Each call to BL_Acquire will acquire the next streaming packet, can be called as many times as necessary. For example, say we wish to stream from BNC ChA:
{{{
BL_Mode(5); // streaming mode

BL_ChannelEnable( 0,False,True); // enable BNC ch 0

BL_Trace(0);  // start stream...

BL_ChannelSelect(0)         // switch dump buffer to CH0.

while(not stopped){
  BL_Acquire(1024,Data_Ptr);  // collect 1K samples from 0 each time
}

BL_Halt(0);   // Send signal to stop streaming data.
}}}

Note that if more than one channel is enabled, data must be collected from each channel in order. If data is not collected, the data will be lost and a warning will be displayed on the [[log|BL_Log]]. For example, say we wish to stream from BNC ChA (channel 0) and the logic channel (channel 16):
{{{
BL_Mode(5); // streaming mode

BL_ChannelEnable( 0,False,True); // enable BNC ch 0

BL_ChannelEnable(16,False,True); // enable logic channel 0

BL_Trace(0);  // start stream...

BL_ChannelSelect(0)         // switch dump buffer to CH0.

BL_Acquire(1024,Data_Ptr);  // run 1: collect 1K samples from 0

BL_ChannelSelect(16)        // switch dump buffer to CH16.

BL_Acquire(1024,Data_Ptr);  // run 1: collect 1K samples from 16

BL_ChannelSelect(0)

BL_Acquire(1024,Data_Ptr);  // run 2: collect 1K samples from 0

BL_ChannelSelect(0)

BL_Acquire(1024,Data_Ptr);  <- warning! you did not collect
                                           data from all channels. Ch 16
                                           discarded.

BL_Halt(0);   // Send signal to stop streaming data.
}}}

/*{{{*/
body{font-family:Verdana, Helvetica, sans-serif;}

#mainMenu {position:relative;}
#displayArea {margin-left: 1em;}

/* Size and style of the header title bar */
.header {height: 6em;}
.siteTitle {position: relative; bottom: 1em; font-weight:bold;font-family:Arial, Helvetica, sans-serif;}
.siteSubtitle {position: relative; bottom: 2em;}h1,h2,h3,h4,h5,h6 {font-weight:bold; text-decoration:none;}

/* headings */
h1,h2,h3 {padding-bottom:1px; margin-top:0.2em;margin-bottom:0.5em;}
h4,h5,h6 {margin-top:1em;}
h1 {font-size:2.35em;}
h2 {font-size:1.65em;}
h3 {font-size:1.1em;}
h4 {font-size:1em;}
h5 {font-size:.9em;}

/*Tiddly title font format */
.title {font-size:2.35em;font-weight:bold;border-bottom:1px solid #333;font-family:Arial, Helvetica, sans-serif;}

/* Tiddly font format */
.tiddlyLinkExisting {font-weight:normal;}

/*
This aligns the "index" button in the sidetabs 
*/
#sidebarTabs .button {
	margin:0em 0.2em;
	padding:0.2em 0.3em;
	display:block;
}

/* 
The following main menu tabs change the 
appearance of the mainmenu, underline, block text etc
*/
#mainMenu .tiddlyLink, #mainMenu a.button{
 display: block;
 border-bottom: 1px solid #aaa;
 padding:0em 0em;
 text-decoration: none;
 width: 13em;
 margin-top: -1em;
}

#mainMenu a:hover {
 color: #000 !important;
 background-color: #bcd !important;
}

/*}}}*/


/*{{{*/
body {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}

a {color:[[ColorPalette::PrimaryMid]];}
a:hover {background-color:[[ColorPalette::PrimaryMid]]; color:[[ColorPalette::Background]];}
a img {border:0;}

h1,h2,h3,h4,h5,h6 {color:[[ColorPalette::SecondaryDark]]; background:transparent;}
h1 {border-bottom:2px solid [[ColorPalette::TertiaryLight]];}
h2,h3 {border-bottom:1px solid [[ColorPalette::TertiaryLight]];}

.button {color:[[ColorPalette::PrimaryDark]]; border:1px solid [[ColorPalette::Background]];}
.button:hover {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::SecondaryLight]]; border-color:[[ColorPalette::SecondaryMid]];}
.button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::SecondaryDark]];}

.header {background:[[ColorPalette::PrimaryMid]];}
.headerShadow {color:[[ColorPalette::Foreground]];}
.headerShadow a {font-weight:normal; color:[[ColorPalette::Foreground]];}
.headerForeground {color:[[ColorPalette::Background]];}
.headerForeground a {font-weight:normal; color:[[ColorPalette::PrimaryPale]];}

.tabSelected{color:[[ColorPalette::PrimaryDark]];
	background:[[ColorPalette::TertiaryPale]];
	border-left:1px solid [[ColorPalette::TertiaryLight]];
	border-top:1px solid [[ColorPalette::TertiaryLight]];
	border-right:1px solid [[ColorPalette::TertiaryLight]];
}
.tabUnselected {color:[[ColorPalette::Background]]; background:[[ColorPalette::TertiaryMid]];}
.tabContents {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::TertiaryPale]]; border:1px solid [[ColorPalette::TertiaryLight]];}
.tabContents .button {border:0;}

#sidebar {}
#sidebarOptions input {border:1px solid [[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel {background:[[ColorPalette::PrimaryPale]];}
#sidebarOptions .sliderPanel a {border:none;color:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:hover {color:[[ColorPalette::Background]]; background:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:active {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::Background]];}

.wizard {background:[[ColorPalette::PrimaryPale]]; border:1px solid [[ColorPalette::PrimaryMid]];}
.wizard h1 {color:[[ColorPalette::PrimaryDark]]; border:none;}
.wizard h2 {color:[[ColorPalette::Foreground]]; border:none;}
.wizardStep {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];
	border:1px solid [[ColorPalette::PrimaryMid]];}
.wizardStep.wizardStepDone {background:[[ColorPalette::TertiaryLight]];}
.wizardFooter {background:[[ColorPalette::PrimaryPale]];}
.wizardFooter .status {background:[[ColorPalette::PrimaryDark]]; color:[[ColorPalette::Background]];}
.wizard .button {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryLight]]; border: 1px solid;
	border-color:[[ColorPalette::SecondaryPale]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryPale]];}
.wizard .button:hover {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Background]];}
.wizard .button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::Foreground]]; border: 1px solid;
	border-color:[[ColorPalette::PrimaryDark]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryDark]];}

.wizard .notChanged {background:transparent;}
.wizard .changedLocally {background:#80ff80;}
.wizard .changedServer {background:#8080ff;}
.wizard .changedBoth {background:#ff8080;}
.wizard .notFound {background:#ffff80;}
.wizard .putToServer {background:#ff80ff;}
.wizard .gotFromServer {background:#80ffff;}

#messageArea {border:1px solid [[ColorPalette::SecondaryMid]]; background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]];}
#messageArea .button {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::SecondaryPale]]; border:none;}

.popupTiddler {background:[[ColorPalette::TertiaryPale]]; border:2px solid [[ColorPalette::TertiaryMid]];}

.popup {background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]]; border-left:1px solid [[ColorPalette::TertiaryMid]]; border-top:1px solid [[ColorPalette::TertiaryMid]]; border-right:2px solid [[ColorPalette::TertiaryDark]]; border-bottom:2px solid [[ColorPalette::TertiaryDark]];}
.popup hr {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::PrimaryDark]]; border-bottom:1px;}
.popup li.disabled {color:[[ColorPalette::TertiaryMid]];}
.popup li a, .popup li a:visited {color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:active {background:[[ColorPalette::SecondaryPale]]; color:[[ColorPalette::Foreground]]; border: none;}
.popupHighlight {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
.listBreak div {border-bottom:1px solid [[ColorPalette::TertiaryDark]];}

.tiddler .defaultCommand {font-weight:bold;}

.shadow .title {color:[[ColorPalette::TertiaryDark]];}

.title {color:[[ColorPalette::SecondaryDark]];}
.subtitle {color:[[ColorPalette::TertiaryDark]];}

.toolbar {color:[[ColorPalette::PrimaryMid]];}
.toolbar a {color:[[ColorPalette::TertiaryLight]];}
.selected .toolbar a {color:[[ColorPalette::TertiaryMid]];}
.selected .toolbar a:hover {color:[[ColorPalette::Foreground]];}

.tagging, .tagged {border:1px solid [[ColorPalette::TertiaryPale]]; background-color:[[ColorPalette::TertiaryPale]];}
.selected .tagging, .selected .tagged {background-color:[[ColorPalette::TertiaryLight]]; border:1px solid [[ColorPalette::TertiaryMid]];}
.tagging .listTitle, .tagged .listTitle {color:[[ColorPalette::PrimaryDark]];}
.tagging .button, .tagged .button {border:none;}

.footer {color:[[ColorPalette::TertiaryLight]];}
.selected .footer {color:[[ColorPalette::TertiaryMid]];}

.sparkline {background:[[ColorPalette::PrimaryPale]]; border:0;}
.sparktick {background:[[ColorPalette::PrimaryDark]];}

.error, .errorButton {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Error]];}
.warning {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryPale]];}
.lowlight {background:[[ColorPalette::TertiaryLight]];}

.zoomer {background:none; color:[[ColorPalette::TertiaryMid]]; border:3px solid [[ColorPalette::TertiaryMid]];}

.imageLink, #displayArea .imageLink {background:transparent;}

.annotation {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border:2px solid [[ColorPalette::SecondaryMid]];}

.viewer .listTitle {list-style-type:none; margin-left:-2em;}
.viewer .button {border:1px solid [[ColorPalette::SecondaryMid]];}
.viewer blockquote {border-left:3px solid [[ColorPalette::TertiaryDark]];}

.viewer table, table.twtable {border:2px solid [[ColorPalette::TertiaryDark]];}
.viewer th, .viewer thead td, .twtable th, .twtable thead td {background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::Background]];}
.viewer td, .viewer tr, .twtable td, .twtable tr {border:1px solid [[ColorPalette::TertiaryDark]];}

.viewer pre {border:1px solid [[ColorPalette::SecondaryLight]]; background:[[ColorPalette::SecondaryPale]];}
.viewer code {color:[[ColorPalette::SecondaryDark]];}
.viewer hr {border:0; border-top:dashed 1px [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::TertiaryDark]];}

.highlight, .marked {background:[[ColorPalette::SecondaryLight]];}

.editor input {border:1px solid [[ColorPalette::PrimaryMid]];}
.editor textarea {border:1px solid [[ColorPalette::PrimaryMid]]; width:100%;}
.editorFooter {color:[[ColorPalette::TertiaryMid]];}

#backstageArea {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::TertiaryMid]];}
#backstageArea a {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstageArea a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; }
#backstageArea a.backstageSelTab {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
#backstageButton a {background:none; color:[[ColorPalette::Background]]; border:none;}
#backstageButton a:hover {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstagePanel {background:[[ColorPalette::Background]]; border-color: [[ColorPalette::Background]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]];}
.backstagePanelFooter .button {border:none; color:[[ColorPalette::Background]];}
.backstagePanelFooter .button:hover {color:[[ColorPalette::Foreground]];}
#backstageCloak {background:[[ColorPalette::Foreground]]; opacity:0.6; filter:'alpha(opacity=60)';}
/*}}}*/
/*{{{*/
* html .tiddler {height:1%;}

body {font-size:.75em; font-family:arial,helvetica; margin:0; padding:0;}

h1,h2,h3,h4,h5,h6 {font-weight:bold; text-decoration:none;}
h1,h2,h3 {padding-bottom:1px; margin-top:1.2em;margin-bottom:0.3em;}
h4,h5,h6 {margin-top:1em;}
h1 {font-size:1.35em;}
h2 {font-size:1.25em;}
h3 {font-size:1.1em;}
h4 {font-size:1em;}
h5 {font-size:.9em;}

hr {height:1px;}

a {text-decoration:none;}

dt {font-weight:bold;}

ol {list-style-type:decimal;}
ol ol {list-style-type:lower-alpha;}
ol ol ol {list-style-type:lower-roman;}
ol ol ol ol {list-style-type:decimal;}
ol ol ol ol ol {list-style-type:lower-alpha;}
ol ol ol ol ol ol {list-style-type:lower-roman;}
ol ol ol ol ol ol ol {list-style-type:decimal;}

.txtOptionInput {width:11em;}

#contentWrapper .chkOptionInput {border:0;}

.externalLink {text-decoration:underline;}

.indent {margin-left:3em;}
.outdent {margin-left:3em; text-indent:-3em;}
code.escaped {white-space:nowrap;}

.tiddlyLinkExisting {font-weight:bold;}
.tiddlyLinkNonExisting {font-style:italic;}

/* the 'a' is required for IE, otherwise it renders the whole tiddler in bold */
a.tiddlyLinkNonExisting.shadow {font-weight:bold;}

#mainMenu .tiddlyLinkExisting,
	#mainMenu .tiddlyLinkNonExisting,
	#sidebarTabs .tiddlyLinkNonExisting {font-weight:normal; font-style:normal;}
#sidebarTabs .tiddlyLinkExisting {font-weight:bold; font-style:normal;}

.header {position:relative;}
.header a:hover {background:transparent;}
.headerShadow {position:relative; padding:4.5em 0 1em 1em; left:-1px; top:-1px;}
.headerForeground {position:absolute; padding:4.5em 0 1em 1em; left:0px; top:0px;}

.siteTitle {font-size:3em;}
.siteSubtitle {font-size:1.2em;}

#mainMenu {position:absolute; left:0; width:10em; text-align:right; line-height:1.6em; padding:1.5em 0.5em 0.5em 0.5em; font-size:1.1em;}

#sidebar {position:absolute; right:3px; width:16em; font-size:.9em;}
#sidebarOptions {padding-top:0.3em;}
#sidebarOptions a {margin:0 0.2em; padding:0.2em 0.3em; display:block;}
#sidebarOptions input {margin:0.4em 0.5em;}
#sidebarOptions .sliderPanel {margin-left:1em; padding:0.5em; font-size:.85em;}
#sidebarOptions .sliderPanel a {font-weight:bold; display:inline; padding:0;}
#sidebarOptions .sliderPanel input {margin:0 0 0.3em 0;}
#sidebarTabs .tabContents {width:15em; overflow:hidden;}

.wizard {padding:0.1em 1em 0 2em;}
.wizard h1 {font-size:2em; font-weight:bold; background:none; padding:0; margin:0.4em 0 0.2em;}
.wizard h2 {font-size:1.2em; font-weight:bold; background:none; padding:0; margin:0.4em 0 0.2em;}
.wizardStep {padding:1em 1em 1em 1em;}
.wizard .button {margin:0.5em 0 0; font-size:1.2em;}
.wizardFooter {padding:0.8em 0.4em 0.8em 0;}
.wizardFooter .status {padding:0 0.4em; margin-left:1em;}
.wizard .button {padding:0.1em 0.2em;}

#messageArea {position:fixed; top:2em; right:0; margin:0.5em; padding:0.5em; z-index:2000; _position:absolute;}
.messageToolbar {display:block; text-align:right; padding:0.2em;}
#messageArea a {text-decoration:underline;}

.tiddlerPopupButton {padding:0.2em;}
.popupTiddler {position: absolute; z-index:300; padding:1em; margin:0;}

.popup {position:absolute; z-index:300; font-size:.9em; padding:0; list-style:none; margin:0;}
.popup .popupMessage {padding:0.4em;}
.popup hr {display:block; height:1px; width:auto; padding:0; margin:0.2em 0;}
.popup li.disabled {padding:0.4em;}
.popup li a {display:block; padding:0.4em; font-weight:normal; cursor:pointer;}
.listBreak {font-size:1px; line-height:1px;}
.listBreak div {margin:2px 0;}

.tabset {padding:1em 0 0 0.5em;}
.tab {margin:0 0 0 0.25em; padding:2px;}
.tabContents {padding:0.5em;}
.tabContents ul, .tabContents ol {margin:0; padding:0;}
.txtMainTab .tabContents li {list-style:none;}
.tabContents li.listLink { margin-left:.75em;}

#contentWrapper {display:block;}
#splashScreen {display:none;}

#displayArea {margin:1em 17em 0 14em;}

.toolbar {text-align:right; font-size:.9em;}

.tiddler {padding:1em 1em 0;}

.missing .viewer,.missing .title {font-style:italic;}

.title {font-size:1.6em; font-weight:bold;}

.missing .subtitle {display:none;}
.subtitle {font-size:1.1em;}

.tiddler .button {padding:0.2em 0.4em;}

.tagging {margin:0.5em 0.5em 0.5em 0; float:left; display:none;}
.isTag .tagging {display:block;}
.tagged {margin:0.5em; float:right;}
.tagging, .tagged {font-size:0.9em; padding:0.25em;}
.tagging ul, .tagged ul {list-style:none; margin:0.25em; padding:0;}
.tagClear {clear:both;}

.footer {font-size:.9em;}
.footer li {display:inline;}

.annotation {padding:0.5em; margin:0.5em;}

* html .viewer pre {width:99%; padding:0 0 1em 0;}
.viewer {line-height:1.4em; padding-top:0.5em;}
.viewer .button {margin:0 0.25em; padding:0 0.25em;}
.viewer blockquote {line-height:1.5em; padding-left:0.8em;margin-left:2.5em;}
.viewer ul, .viewer ol {margin-left:0.5em; padding-left:1.5em;}

.viewer table, table.twtable {border-collapse:collapse; margin:0.8em 1.0em;}
.viewer th, .viewer td, .viewer tr,.viewer caption,.twtable th, .twtable td, .twtable tr,.twtable caption {padding:3px;}
table.listView {font-size:0.85em; margin:0.8em 1.0em;}
table.listView th, table.listView td, table.listView tr {padding:0px 3px 0px 3px;}

.viewer pre {padding:0.5em; margin-left:0.5em; font-size:1.2em; line-height:1.4em; overflow:auto;}
.viewer code {font-size:1.2em; line-height:1.4em;}

.editor {font-size:1.1em;}
.editor input, .editor textarea {display:block; width:100%; font:inherit;}
.editorFooter {padding:0.25em 0; font-size:.9em;}
.editorFooter .button {padding-top:0px; padding-bottom:0px;}

.fieldsetFix {border:0; padding:0; margin:1px 0px;}

.sparkline {line-height:1em;}
.sparktick {outline:0;}

.zoomer {font-size:1.1em; position:absolute; overflow:hidden;}
.zoomer div {padding:1em;}

* html #backstage {width:99%;}
* html #backstageArea {width:99%;}
#backstageArea {display:none; position:relative; overflow: hidden; z-index:150; padding:0.3em 0.5em;}
#backstageToolbar {position:relative;}
#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em;}
#backstageButton {display:none; position:absolute; z-index:175; top:0; right:0;}
#backstageButton a {padding:0.1em 0.4em; margin:0.1em;}
#backstage {position:relative; width:100%; z-index:50;}
#backstagePanel {display:none; z-index:100; position:absolute; width:90%; margin-left:3em; padding:1em;}
.backstagePanelFooter {padding-top:0.2em; float:right;}
.backstagePanelFooter a {padding:0.2em 0.4em;}
#backstageCloak {display:none; z-index:20; position:absolute; width:100%; height:100px;}

.whenBackstage {display:none;}
.backstageVisible .whenBackstage {display:block;}
/*}}}*/
/%
!info
|Name|ToggleRightSidebar|
|Source|http://www.TiddlyTools.com/#ToggleRightSidebar|
|Version|2.0.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|transclusion|
|Description|show/hide right sidebar (SideBarOptions)|
Usage
<<<
{{{
<<tiddler ToggleRightSidebar>>
<<tiddler ToggleRightSidebar with: label tooltip>>
}}}
Try it: <<tiddler ToggleRightSidebar##show
	with: {{config.options.chkShowRightSidebar?'â–º':'â—„'}}>>
<<<
Configuration:
<<<
{{{
config.options.chkShowRightSidebar (true)
config.options.txtToggleRightSideBarLabelShow (â—„)
config.options.txtToggleRightSideBarLabelHide (â–º)
}}}
<<<
!end
!show
<<tiddler {{
	var co=config.options;
	if (co.chkShowRightSidebar===undefined) co.chkShowRightSidebar=true;
	var sb=document.getElementById('sidebar');
	var da=document.getElementById('displayArea');
	if (sb) {
		sb.style.display=co.chkShowRightSidebar?'block':'none';
		da.style.marginRight=co.chkShowRightSidebar?'':'1em';
	}
'';}}>><html><nowiki><a href='javascript:;' title="$2"
onmouseover="
	this.href='javascript:void(eval(decodeURIComponent(%22(function(){try{('
	+encodeURIComponent(encodeURIComponent(this.onclick))
	+')()}catch(e){alert(e.description?e.description:e.toString())}})()%22)))';"
onclick="
	var co=config.options;
	var opt='chkShowRightSidebar';
	var show=co[opt]=!co[opt];
	var sb=document.getElementById('sidebar');
	var da=document.getElementById('displayArea');
	if (sb) {
		sb.style.display=show?'block':'none';
		da.style.marginRight=show?'':'1em';
	}
	saveOptionCookie(opt);
	var labelShow=co.txtToggleRightSideBarLabelShow||'&#x25C4;';
	var labelHide=co.txtToggleRightSideBarLabelHide||'&#x25BA;';
	if (this.innerHTML==labelShow||this.innerHTML==labelHide) 
		this.innerHTML=show?labelHide:labelShow;
	this.title=(show?'hide':'show')+' right sidebar';
	var sm=document.getElementById('storyMenu');
	if (sm) config.refreshers.content(sm);
	return false;
">$1</a></html>
!end
%/<<tiddler {{
	var src='ToggleRightSidebar';
	src+(tiddler&&tiddler.title==src?'##info':'##show');
}} with: {{
	var co=config.options;
	var labelShow=co.txtToggleRightSideBarLabelShow||'&#x25C4;';
	var labelHide=co.txtToggleRightSideBarLabelHide||'&#x25BA;';
	'$1'!='$'+'1'?'$1':(co.chkShowRightSidebar?labelHide:labelShow);
}} {{
	var tip=(config.options.chkShowRightSidebar?'hide':'show')+' right sidebar';
	'$2'!='$'+'2'?'$2':tip;
}}>>
Once the BitScope has been setup with the appropriate [[Channel Setup]], [[Trigger Setup]] and [[Trace Setup]], the BitScope can begin the internal capture cycle.

Use the function [[BL_Trace]] to begin the capture cycle. A BL_Trace call is also used for [[Waveform Generator]] cycles and [[Streaming]] mode. Once BL_Trace is called, the BitScope will move through the following procedure
{{{
PreTrigger, Trigger, PostTrigger, Capture
}}}
The trigger can be configured with the [[Trigger Setup]] functions the pre trigger time can be set with [[BL_PreTrigger]] and the post trigger delay can be set with [[BL_SetTriggerDelay]]. 

In a standard input capture, at the Capture stage, data is captured from the inputs to the internal buffers. When using the [[Waveform Generator]], the Capture stage will replay the buffer data out the BNC, rather than pull the data in. When using the [[Streaming]] mode, the Capture stage will bypass the BitScope internal buffers and pass the data to the computer.

Note that by default, BL_Trace is a blocking call. This may be inconvenient for large or unpredictable trigger times. BitLib also allows asynchronous threaded capture to be used with BL_Trace. If using asynchronous capture, BL_Trace will return immediately. The function [[BL_GetTraceState]] will return the current state of the capture cycle. The return value of BL_GetTraceState is enumerated in the following way
{{{
csIdle=0,csArmed=1,csCaptured=2,csTimedOut=3
}}}

To cancel a capture cycle in streaming or asynchronous mode, use the function [[BL_Halt]]. 
Once the [[Channel Setup]] and [[Trigger Setup]] have been configured successfully, the trace parameters need to be set.

The primary trace setup functions are defined as follows:

{{{function BL_SampleRate(ASampleRate : Double) : Double;}}}
{{{function BL_CaptureTime(ACaptureTime : Integer) : Integer;}}}
{{{function BL_PreTrigger(APreTrigger : Integer) : Integer;}}}
{{{function BL_BufferSize : Integer;}}}

Note that for every different capture, all of these functions should be used. 

[[BL_SampleRate]] will select the internal BitScope sample rate, and [[BL_CaptureTime]] will select the time in uS to capture data. The values returned indicate the actual values that have been set in the BitScope. The BitScope has restrictions on the sample rate and capture time which depend on the model number, the mode, and the buffer size. The number of samples that will be captured can be obtained with the function [[BL_BufferSize]]. This value should be used in the [[Acquire]] stage to ensure the correct number of points is returned.As a rough guide, in a normal capture the number of samples that will be captured can be calculated from BL_CaptureTime * BL_SampleRate. 

Choosing a value of -1 for either BL_CaptureTime and BL_SampleRate will select the best possible value for the current BitScope. Be careful however, as -1 arguments will attempt to use the entire BitScope buffer.

To store values that occur before the trigger, use the [[BL_PreTrigger]] argument. If you do not need the pre-trigger values, set this to 0. Note that the pre-trigger time is still considered part of the BL_CaptureTime. This means that BL_PreTrigger must always be less than BL_CaptureTime.

Each different capture should use all functions 
{{{
BL_SampleRate(40.0);    // setup sample rate
BL_CaptureTime(100);   // setup capture time
BL_PreTrigger(0);    // request time before trigger
size=BL_BufferSize();    // collect the size of the return buffer
}}}
Note that if a capture is the same, that is, none of the trace setup parameters change, then calling these functions again is not necessary.

To capture to a section of the BitScope memory other than address 0x000000, use the function [[BL_SetAddress]]. This may be useful for [[Waveform Generator]] applications that may require you to pre-load several waveforms at different locations in memory.


Basic trigger functionality is set up via the trigger functions [[BL_SetupTrigger]] and [[BL_SetTriggerDelay]].

BL_SetupTrigger programs a rising or falling edge, or a trigger level and als the trigger channel. 

To force a trigger event every time, that is disable the trigger, set the ATimeOut argument to [[BL_Trace]] to zero.

The BitScope hardware trigger is subject to some timing uncertainty, typically 1uS. For a more precise trigger use the [[BL_PreTrigger]] function to capture ahead of the hardware trigger point and resolve it to greater precision in software if needed.

Note: on the BS300 and BS310 models (only) when triggering on one channel and capturing another (e.g. triggering on channel A and capturing channel B) it is not possible to display waveform at the trigger point. This is because capture is occuring on channel A when the trigger is seen. The data shown at the trigger point is from channel A and a discontinuity in the data as the channel switches to channel B will be seen. However the location of the trigger will be accurate as there is no lag between channel A and B. They are captured on the same hardware clock.

!!Logic and Complex Trigger Masks
To use a more complex digital trigger, you can override certain BitScope registers with the function [[BL_SetRegister]]. BitScope registers 0x05 and 0x06 contain the logic trigger and trigger mask registers respectively. For example, to set up a don't care trigger, you should do the following:

1) call BL_SetupTrigger on a digital channel, Ch 16 say. This will setup other BitLib internals for a digital trigger.

2) call BL_SetRegister('06','ff')

3) Trace as normal 

!!External Trigger
On BS100, BS120 and BS325 it is possible to use an external trigger source via the 'Ext Trig' pin.

This pin is located on the front panel of the BitScope. 

To access this feature via BitLib set the trigger source to channel 64. 

This switches the trigger circuit from CHB to the external trigger pin. Only the trigger function is switched from ChB; output of generated waveforms and/or capture of signals via ChB remains active. 

Setting up an external trigger requires you to treat Ch 64 as a regular channel, that is by calling [[Channel Setup]] and [[Trigger Setup]] functions on channel 64. Note that internally, these function calls are setting up the ChB logic, then switching to Ch 64.
Shown here are some frequently encountered problems when using BitLib. As this software is in beta release, we appreciate any comments or suggestions you have to improve the software. Please send feedback to project@bitscope.com.

!!I can't find my BitScope
Firstly, you will need the link string for your BitScope. The link string is a [[Probe File]] entry that defines a BitScope communication link. Please use the [[BitScope Connection Manager]] to locate and test the BitScopes connected to your system. The Connection Manager will also configure your probe file. Once you have a link name, say UDP:192.168.1.75, then you will need to use it to set up BitLib calls [[BL_Open]] and [[BL_OpenLink]]. If the Connection Manager can locate a BitScope, then BitLib should find it as well. If the Connection Manager cannot find your BitScope, please consult the Connection Manager help files for assistance in detecting your BitScope.

!!Connecting to a BitScope takes too long
When using a probe file to connect to devices e.g. bitscope.prb, you may experience a long delay. This is usually due to an incorrectly configured [[probe file|Probe File]]. If you have the OpenAll flag enabled in [[BL_Open]], then BL_Open will attempt to connect to each BitScope in the probe file until it finds a successful connection. If there are many invalid network links in the probe file, BL_Open will be waiting for a timeout on each of these network links. Each network link timeout may be long, so make sure the invalid network BitScope links are not in the probe file. If the OpenAll flag is set to false, then BL_Open will return after the first successful link. However, the first successful link may be listed after dead network links. Make sure that your probe file link is listed first in the probe file and comment out invalid links. Alternatively, use [[BL_OpenLink]] to open one link at a time.

!!The zero-point voltage is not correct
In this case, you will need to [[calibrate|BL_Calibrate]] the BitScope to obtain a correct ground reference. To calibrate the BitScope, you must make sure that ALL inputs on the BitScope are ground-referenced or terminated. Next you will need to have BitLib [[initialized|Initialization]] and connected to a BitScope with [[BL_OpenLink]]. You will then need to call the function [[BL_Calibrate]] which will perform a calibration on each channel and each input and store the result in a file for BitLib's future use. See [[BL_Calibrate]] for more details.

!!Bugs
Please report any bugs you find to project@bitscope.com. In your message, please indicate your BitScope version number and the operating system you are using.  

!!I have some other problem
If you have a software related problem with BitLib please contact project@bitscope.com. If you have a hardware or BitScope related problem, please contact support@bitscope.com. 
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
Some BitScopes also have waveform generation (wavegen) capabilities. BitScopes with a waveform generator include BS300, BS310, BS320, BS325, BS326.

In BitLib, the wavegen is not a separate [[BL_Mode]], though functions may have slightly different behavior. Conceptually, the wavegen functionality should be considered the same as a capture, but with ChB reversed, that is, the buffer is sending data out the BNC, rather than reading data in.

NOTE: When using the wavegen on a 3xx BitScope, make sure the wavegen switch on the front panel of your BitScope is turned on!

When using the wavegen, the system should be in Mode 0, single channel mode, on the relevant BitScopes, or Mode 4 on multi-channel BitScopes. 

To enable the waveform generator, use the function [[BL_SetupReplay]]. This should be called before any of the [[Trace Setup]] functions are called, as the waveform generator will affect their behavior.

The waveform is played out through the channel B input on a 3xx series BitScope, and on channel A on a BS50. This channel is specified with the [[BL_SetupReplay]] function. Note however, that only these channels are valid for waveform generation.

In order to replay a waveform, the waveform must first be written into the BitScope memory with the function [[BL_Write]], which will write an array of integers (values 0..255) into the BitScope memory. You can also specify the peak to peak and offset voltage of the output waveform with [[BL_WaveLevel]] and [[BL_WaveOffset]] respectively.

Now that the waveform is loaded and the BitScope set for waveform generation, a [[BL_Trace]] call will cause the waveform to appear on the output. As mentioned earlier, the waveform generator operates like a capture but in reverse. This means that in BitLib, a waveform replay is set up in the same way as a standard capture. For example, to perform a one shot burst of waveform for 100uS, you would use [[BL_CaptureTime]](100). The resolution of the waveform is controlled by the [[BL_SampleRate]] function. NOTE: Only sample rates < 10MS/sec may be used for waveform generation.

A basic waveform run would look something like:
{{{
BL_Initialize()
BL_Open()

BL_ChannelEnable()  // enable the necessary channels 

BL_Write()          // write array into BitScope memory.

BL_WaveLevel()      // peak to peak voltage of the waveform
BL_WaveOffset()     // DC offset for the resulting waveform
BL_SetupReplay()    // Select channel for output. Note that on a BS325 it is possible
                           // to replay waveforms out the logic POD.

BL_SampleRate     // select the sample rate for waveform replay.
BL_CaptureTime    // select the duration that the waveform should appear.
BL_BufferSize     // obtain the size of the return array based on the above parameters

BL_Trace(0)       // start wavegen replay

// Waveform now appears on chB.

// On a 3xx BitScope, you can collect the data if ChA is connected to ChB. In this
// case you can call the functions...

BL_ChannelSelect(0)  // select channel A

BL_Acquire()           // collect the data
}}}

Note that it is possible to use the trigger to start a waveform replay. For this, simply set up the trigger as per a normal capture, and use a non-zero value for the timeout argument to BL_Trace(). Once a trigger event is seen, the waveform will begin replay.

The above example setup runs a one-shot of the waveform. It is also possible to repeatedly fire off a one-shot without having to reload the waveform. For example, to have a setup that repeatedly fired a burst of waveform you would write:
{{{
...
BL_WaveLevel      // peak to peak voltage of the waveform
BL_WaveOffset     // DC offset for the resulting waveform
BL_Write					// write the waveform	

start loop

  BL_SetupReplay    // select channel for output.
  BL_SetAddress     // set the start address for the replay.
  BL_Trace(0)       // trigger should be force trigger in one-shot wavegen mode
  BL_ChannelSelect(0)  // select channel A 
  BL_Acquire           // collect the data

end loop
...
}}}

Note that the above example is not a continuous waveform, but a series of one-shot bursts. It is also possible to run the waveform continuously. A continuous waveform can be generated by adjusting the trigger. In this case, the trigger should be set to a never trigger value, that is a -2 timeout argument in BL_Trace i.e. BL_Trace(-2,False). This will replay the waveform continuously, wrapping around the buffer. In this case, the entire BitScope memory should be filled with your waveform. Care should be taken to make sure that the start and end points match, to prevent glitches.

NOTE BS325 USERS: The wavegen sample rate restriction on a BS325 is 40MS/sec. Although the BS325 wavegen only operates at 10MS/sec, a clock divider allows waveforms to be replayed and captured at 40MS/sec. Note that this implies that at 40MS/sec only every 4th sample is played. 
The attenuation range of the BitScope controls the sensitivity of the internal A/D converter.

Each BitScope currently has 4 separate attenuation ranges, though this may change in the future. Each BitScope input (POD, BNC, prescales) have a different set of attenuation range values. The attenuation range values for the connected BitScope can be ascertained from the [[Reference Functions]]. The function [[BL_RangeValue]] will return the peak to peak voltage of a given attenuation range for a given input.

The greatest resolution for your signal will be obtained when the peak to peak voltage of the signal spans the entire attenuation range. To improve the voltage resolution, you may also wish to use voltage probes to scale the signal to the most effective range. Note that if your signal is too large for the current range, the signal may clip. Conversely, if the signal is too small for the current attenuation range, then you may see unwanted digital 'step' noise.