You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

676 lines
32 KiB
Mathematica

(* Content-type: application/vnd.wolfram.mathematica *)
(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)
(* CreatedBy='Mathematica 12.1' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[ 158, 7]
NotebookDataLength[ 32562, 667]
NotebookOptionsPosition[ 31410, 640]
NotebookOutlinePosition[ 31879, 658]
CellTagsIndexPosition[ 31836, 655]
WindowFrame->Normal*)
(* Beginning of Notebook Content *)
Notebook[{
Cell["\<\
Below, the serial device is opened with the highest supported baud rate.
(TODO: Use .NET to surpass the 256,000 rate imposed by Mathematica)\
\>", "Text",
CellChangeTimes->{{3.8036679102907605`*^9,
3.803667970956961*^9}},ExpressionUUID->"85416522-5898-4319-9fb1-\
fbe2e065160f"],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"S", " ", "=", " ",
RowBox[{"DeviceOpen", "[",
RowBox[{"\"\<Serial\>\"", ",", " ",
RowBox[{"{",
RowBox[{"\"\<COM8\>\"", ",", " ",
RowBox[{"\"\<DataBits\>\"", "\[Rule]", "8"}], ",",
RowBox[{"\"\<Parity\>\"", "\[Rule]", "None"}], ",",
RowBox[{"\"\<StopBits\>\"", " ", "\[Rule]", " ", "1"}], ",",
RowBox[{"\"\<BaudRate\>\"", "\[Rule]", " ", "256000"}]}], "}"}]}],
"]"}]}]], "Input",
CellChangeTimes->{{3.8021056235893197`*^9, 3.802105631438999*^9}, {
3.8021056718409495`*^9, 3.802105678372324*^9}, {3.8021063692730427`*^9,
3.8021063736949897`*^9}, {3.8021065792934113`*^9, 3.802106580621784*^9}, {
3.8032936408874693`*^9, 3.803293649949585*^9}, {3.8032943655360193`*^9,
3.8032943970983996`*^9}, {3.803647738715596*^9, 3.803647746621915*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"41d31997-6913-4b37-90f8-9a96f3c666e2"],
Cell[BoxData[
InterpretationBox[
RowBox[{
TagBox["DeviceObject",
"SummaryHead"], "[",
DynamicModuleBox[{Typeset`open$$ = False, Typeset`embedState$$ = "Ready"},
TemplateBox[{
PaneSelectorBox[{False -> GridBox[{{
PaneBox[
ButtonBox[
DynamicBox[
FEPrivate`FrontEndResource[
"FEBitmaps", "SquarePlusIconMedium"],
ImageSizeCache -> {18., {0., 18.}}], Appearance -> None,
BaseStyle -> {}, ButtonFunction :> (Typeset`open$$ = True),
Evaluator -> Automatic, Method -> "Preemptive"],
Alignment -> {Center, Center}, ImageSize ->
Dynamic[{
Automatic, 3.5 CurrentValue["FontCapHeight"]/
AbsoluteCurrentValue[Magnification]}]],
GraphicsBox[{
Thickness[0.038461538461538464`], {
FaceForm[{
RGBColor[0.941, 0.961, 0.957],
Opacity[1.]}],
FilledCurveBox[{{{1, 4, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}, {
1, 3, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}}}, {{{25.5, 2.5}, {
25.5, 1.395}, {24.605, 0.5}, {23.5, 0.5}, {2.5, 0.5}, {1.395,
0.5}, {0.5, 1.395}, {0.5, 2.5}, {0.5, 23.5}, {0.5, 24.605}, {
1.395, 25.5}, {2.5, 25.5}, {23.5, 25.5}, {24.605, 25.5}, {
25.5, 24.605}, {25.5, 23.5}, {25.5, 2.5}}}]}, {
RGBColor[0.7, 0.7, 0.7],
Opacity[1.],
JoinForm[{"Miter", 10.}],
JoinedCurveBox[{{{1, 4, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}, {
1, 3, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}}}, {{{25.5, 2.5}, {
25.5, 1.395}, {24.605, 0.5}, {23.5, 0.5}, {2.5, 0.5}, {1.395,
0.5}, {0.5, 1.395}, {0.5, 2.5}, {0.5, 23.5}, {0.5, 24.605}, {
1.395, 25.5}, {2.5, 25.5}, {23.5, 25.5}, {24.605, 25.5}, {
25.5, 24.605}, {25.5, 23.5}, {25.5, 2.5}}},
CurveClosed -> {1}]}, {
FaceForm[{
RGBColor[0.5423, 0.63104, 0.63597],
Opacity[1.]}],
FilledCurveBox[{{{1, 4, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}, {
1, 3, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}}}, {{{11.133,
18.727999999999998`}, {11.133, 18.451999999999998`}, {
11.357000000000001`, 18.227999999999998`}, {11.633,
18.227999999999998`}, {14.792, 18.227999999999998`}, {15.068,
18.227999999999998`}, {15.292, 18.451999999999998`}, {15.292,
18.727999999999998`}, {15.292, 20.639000000000003`}, {15.292,
20.915}, {15.068, 21.139000000000003`}, {14.792,
21.139000000000003`}, {11.633, 21.139000000000003`}, {
11.357000000000001`, 21.139000000000003`}, {11.133, 20.915}, {
11.133, 20.639000000000003`}, {11.133,
18.727999999999998`}}}]}, {
FaceForm[{
RGBColor[0.5, 0.5, 0.5],
Opacity[1.]}],
FilledCurveBox[{{{0, 2, 0}, {0, 1, 0}, {0, 1, 0}}}, {{{
12.357000000000001`, 1.}, {14.113000000000001`, 1.}, {
14.113000000000001`, 9.554}, {12.357000000000001`,
9.554}}}]}, {
FaceForm[{
RGBColor[0.624375, 0.695304, 0.691308],
Opacity[1.]}],
FilledCurveBox[{{{0, 2, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {
0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1,
0}, {0, 1, 0}}}, {{{15.876000000000001`, 19.799}, {8.122,
19.799}, {8.122, 11.516}, {10.573, 11.516}, {10.573,
11.493}, {11.982000000000001`, 9.171}, {14.539, 9.171}, {
15.876000000000001`, 11.493}, {15.876000000000001`, 11.516}, {
18.326, 11.516}, {18.326, 19.799}, {15.876000000000001`,
19.799}}}],
FilledCurveBox[{{{0, 2, 0}, {0, 1, 0}, {0, 1, 0}}}, {{{
8.806000000000001, 7.993}, {9.995000000000001, 7.993}, {
9.995000000000001, 11.008}, {8.806000000000001, 11.008}}}],
FilledCurveBox[{{{0, 2, 0}, {0, 1, 0}, {0, 1, 0}}}, {{{16.5,
7.993}, {17.689, 7.993}, {17.689, 11.008}, {16.5,
11.008}}}]}}, AspectRatio -> Automatic, ImageSize ->
Dynamic[{Automatic, 3.5 CurrentValue["FontCapHeight"]}],
PlotRange -> {{0., 26.}, {0., 26.}}],
GridBox[{{
RowBox[{
TagBox["\"Class: \"", "SummaryItemAnnotation"],
"\[InvisibleSpace]",
TagBox["\"Serial\"", "SummaryItem"]}],
RowBox[{
TagBox["\"ID: \"", "SummaryItemAnnotation"],
"\[InvisibleSpace]",
TagBox["1", "SummaryItem"]}]}, {
RowBox[{
TagBox["\"Status: \"", "SummaryItemAnnotation"],
"\[InvisibleSpace]",
TagBox[
DynamicModuleBox[{Devices`DeviceAPI`DeviceDump`lights$$ = {
Style[
Graphics[{{
RGBColor[0.88, 1, 0.88],
Disk[{0, 0}]}, {
RGBColor[0, 0.85, 0],
Circle[{0, 0}]}}, PlotRange -> {-2.2, 1.1}, ImageSize ->
9, ImageMargins -> {{3, 3}, {2, 0}},
BaseStyle -> {CacheGraphics -> False}], Selectable ->
False],
Style[
Graphics[{{
RGBColor[1, 1, 0],
Disk[{0, 0}]}, {
RGBColor[0.8, 0.8, 0],
Circle[{0, 0}]}}, PlotRange -> {-2.2, 1.1}, ImageSize ->
9, ImageMargins -> {{3, 3}, {2, 0}},
BaseStyle -> {CacheGraphics -> False}], Selectable ->
False]}, Devices`DeviceAPI`DeviceDump`opacities$$ = {
Opacity[1],
Opacity[0.2]},
Devices`DeviceAPI`DeviceDump`status$$ = {
"Connected (COM8)", "Not connected (COM8)"},
Devices`DeviceAPI`DeviceDump`d$$ =
DeviceObject[{"Serial", 1}],
Devices`DeviceAPI`DeviceDump`ind$$ = 1,
Devices`DeviceAPI`DeviceDump`indr$$ = 1},
DynamicBox[
ToBoxes[Devices`DeviceAPI`DeviceDump`ind$$ = If[
DeviceOpenQ[Devices`DeviceAPI`DeviceDump`d$$], 1, 2];
Devices`DeviceAPI`DeviceDump`indr$$ = If[
DeviceFramework`DeviceRegisteredQ[
Devices`DeviceAPI`DeviceDump`d$$], 1, 2]; Style[
Row[{
Part[
Devices`DeviceAPI`DeviceDump`lights$$,
Devices`DeviceAPI`DeviceDump`ind$$],
Part[
Devices`DeviceAPI`DeviceDump`status$$,
Devices`DeviceAPI`DeviceDump`ind$$]}],
Part[
Devices`DeviceAPI`DeviceDump`opacities$$,
Devices`DeviceAPI`DeviceDump`indr$$]], StandardForm],
ImageSizeCache -> {142., {8., 13.}}],
DynamicModuleValues :> {}], "SummaryItem"]}],
"\[SpanFromLeft]"}}, AutoDelete -> False,
BaseStyle -> {
ShowStringCharacters -> False, NumberMarks -> False,
PrintPrecision -> 3, ShowSyntaxStyles -> False},
GridBoxAlignment -> {
"Columns" -> {{Left}}, "Rows" -> {{Automatic}}},
GridBoxItemSize -> {
"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}},
GridBoxSpacings -> {
"Columns" -> {{2}}, "Rows" -> {{Automatic}}}]}}, AutoDelete ->
False, BaselinePosition -> {1, 1},
GridBoxAlignment -> {"Rows" -> {{Top}}},
GridBoxItemSize -> {
"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}], True ->
GridBox[{{
PaneBox[
ButtonBox[
DynamicBox[
FEPrivate`FrontEndResource[
"FEBitmaps", "SquareMinusIconMedium"]], Appearance -> None,
BaseStyle -> {}, ButtonFunction :> (Typeset`open$$ = False),
Evaluator -> Automatic, Method -> "Preemptive"],
Alignment -> {Center, Center}, ImageSize ->
Dynamic[{
Automatic, 3.5 CurrentValue["FontCapHeight"]/
AbsoluteCurrentValue[Magnification]}]],
GraphicsBox[{
Thickness[0.038461538461538464`], {
FaceForm[{
RGBColor[0.941, 0.961, 0.957],
Opacity[1.]}],
FilledCurveBox[{{{1, 4, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}, {
1, 3, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}}}, {{{25.5, 2.5}, {
25.5, 1.395}, {24.605, 0.5}, {23.5, 0.5}, {2.5, 0.5}, {1.395,
0.5}, {0.5, 1.395}, {0.5, 2.5}, {0.5, 23.5}, {0.5, 24.605}, {
1.395, 25.5}, {2.5, 25.5}, {23.5, 25.5}, {24.605, 25.5}, {
25.5, 24.605}, {25.5, 23.5}, {25.5, 2.5}}}]}, {
RGBColor[0.7, 0.7, 0.7],
Opacity[1.],
JoinForm[{"Miter", 10.}],
JoinedCurveBox[{{{1, 4, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}, {
1, 3, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}}}, {{{25.5, 2.5}, {
25.5, 1.395}, {24.605, 0.5}, {23.5, 0.5}, {2.5, 0.5}, {1.395,
0.5}, {0.5, 1.395}, {0.5, 2.5}, {0.5, 23.5}, {0.5, 24.605}, {
1.395, 25.5}, {2.5, 25.5}, {23.5, 25.5}, {24.605, 25.5}, {
25.5, 24.605}, {25.5, 23.5}, {25.5, 2.5}}},
CurveClosed -> {1}]}, {
FaceForm[{
RGBColor[0.5423, 0.63104, 0.63597],
Opacity[1.]}],
FilledCurveBox[{{{1, 4, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}, {
1, 3, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}}}, {{{11.133,
18.727999999999998`}, {11.133, 18.451999999999998`}, {
11.357000000000001`, 18.227999999999998`}, {11.633,
18.227999999999998`}, {14.792, 18.227999999999998`}, {15.068,
18.227999999999998`}, {15.292, 18.451999999999998`}, {15.292,
18.727999999999998`}, {15.292, 20.639000000000003`}, {15.292,
20.915}, {15.068, 21.139000000000003`}, {14.792,
21.139000000000003`}, {11.633, 21.139000000000003`}, {
11.357000000000001`, 21.139000000000003`}, {11.133, 20.915}, {
11.133, 20.639000000000003`}, {11.133,
18.727999999999998`}}}]}, {
FaceForm[{
RGBColor[0.5, 0.5, 0.5],
Opacity[1.]}],
FilledCurveBox[{{{0, 2, 0}, {0, 1, 0}, {0, 1, 0}}}, {{{
12.357000000000001`, 1.}, {14.113000000000001`, 1.}, {
14.113000000000001`, 9.554}, {12.357000000000001`,
9.554}}}]}, {
FaceForm[{
RGBColor[0.624375, 0.695304, 0.691308],
Opacity[1.]}],
FilledCurveBox[{{{0, 2, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {
0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1,
0}, {0, 1, 0}}}, {{{15.876000000000001`, 19.799}, {8.122,
19.799}, {8.122, 11.516}, {10.573, 11.516}, {10.573,
11.493}, {11.982000000000001`, 9.171}, {14.539, 9.171}, {
15.876000000000001`, 11.493}, {15.876000000000001`, 11.516}, {
18.326, 11.516}, {18.326, 19.799}, {15.876000000000001`,
19.799}}}],
FilledCurveBox[{{{0, 2, 0}, {0, 1, 0}, {0, 1, 0}}}, {{{
8.806000000000001, 7.993}, {9.995000000000001, 7.993}, {
9.995000000000001, 11.008}, {8.806000000000001, 11.008}}}],
FilledCurveBox[{{{0, 2, 0}, {0, 1, 0}, {0, 1, 0}}}, {{{16.5,
7.993}, {17.689, 7.993}, {17.689, 11.008}, {16.5,
11.008}}}]}}, AspectRatio -> Automatic, ImageSize ->
Dynamic[{Automatic, 3.5 CurrentValue["FontCapHeight"]}],
PlotRange -> {{0., 26.}, {0., 26.}}],
GridBox[{{
RowBox[{
TagBox["\"Class: \"", "SummaryItemAnnotation"],
"\[InvisibleSpace]",
TagBox["\"Serial\"", "SummaryItem"]}],
RowBox[{
TagBox["\"ID: \"", "SummaryItemAnnotation"],
"\[InvisibleSpace]",
TagBox["1", "SummaryItem"]}]}, {
RowBox[{
TagBox["\"Status: \"", "SummaryItemAnnotation"],
"\[InvisibleSpace]",
TagBox[
DynamicModuleBox[{Devices`DeviceAPI`DeviceDump`lights$$ = {
Style[
Graphics[{{
RGBColor[0.88, 1, 0.88],
Disk[{0, 0}]}, {
RGBColor[0, 0.85, 0],
Circle[{0, 0}]}}, PlotRange -> {-2.2, 1.1}, ImageSize ->
9, ImageMargins -> {{3, 3}, {2, 0}},
BaseStyle -> {CacheGraphics -> False}], Selectable ->
False],
Style[
Graphics[{{
RGBColor[1, 1, 0],
Disk[{0, 0}]}, {
RGBColor[0.8, 0.8, 0],
Circle[{0, 0}]}}, PlotRange -> {-2.2, 1.1}, ImageSize ->
9, ImageMargins -> {{3, 3}, {2, 0}},
BaseStyle -> {CacheGraphics -> False}], Selectable ->
False]}, Devices`DeviceAPI`DeviceDump`opacities$$ = {
Opacity[1],
Opacity[0.2]},
Devices`DeviceAPI`DeviceDump`status$$ = {
"Connected (COM8)", "Not connected (COM8)"},
Devices`DeviceAPI`DeviceDump`d$$ =
DeviceObject[{"Serial", 1}],
Devices`DeviceAPI`DeviceDump`ind$$,
Devices`DeviceAPI`DeviceDump`indr$$},
DynamicBox[
ToBoxes[Devices`DeviceAPI`DeviceDump`ind$$ = If[
DeviceOpenQ[Devices`DeviceAPI`DeviceDump`d$$], 1, 2];
Devices`DeviceAPI`DeviceDump`indr$$ = If[
DeviceFramework`DeviceRegisteredQ[
Devices`DeviceAPI`DeviceDump`d$$], 1, 2]; Style[
Row[{
Part[
Devices`DeviceAPI`DeviceDump`lights$$,
Devices`DeviceAPI`DeviceDump`ind$$],
Part[
Devices`DeviceAPI`DeviceDump`status$$,
Devices`DeviceAPI`DeviceDump`ind$$]}],
Part[
Devices`DeviceAPI`DeviceDump`opacities$$,
Devices`DeviceAPI`DeviceDump`indr$$]], StandardForm]],
DynamicModuleValues :> {}], "SummaryItem"]}],
"\[SpanFromLeft]"}, {
TagBox[
DynamicModuleBox[{Devices`DeviceAPI`DeviceDump`opacities$$ = {
Opacity[1],
Opacity[0.2]}, Devices`DeviceAPI`DeviceDump`d$$ =
DeviceObject[{"Serial", 1}],
Devices`DeviceAPI`DeviceDump`props$$,
Devices`DeviceAPI`DeviceDump`vals$$,
Devices`DeviceAPI`DeviceDump`reg$$},
DynamicBox[
ToBoxes[
Devices`DeviceAPI`DeviceDump`reg$$ =
DeviceFramework`DeviceRegisteredQ[
Devices`DeviceAPI`DeviceDump`d$$];
Devices`DeviceAPI`DeviceDump`props$$ =
DeviceFramework`DeviceExternalProperties[
Devices`DeviceAPI`DeviceDump`d$$];
Devices`DeviceAPI`DeviceDump`vals$$ =
Devices`DeviceAPI`DeviceDump`d$$[
Devices`DeviceAPI`DeviceDump`props$$]; Column[
Join[{
BoxForm`SummaryItem[{"Properties: ",
If[
Or[
Not[Devices`DeviceAPI`DeviceDump`reg$$],
Devices`DeviceAPI`DeviceDump`props$$ === {}],
Style[None,
Part[Devices`DeviceAPI`DeviceDump`opacities$$,
If[Devices`DeviceAPI`DeviceDump`reg$$, 1, 2]]], ""]}]},
MapThread[BoxForm`SummaryItem[{
StringJoin[" ",
ToString[#], ": "], #2}]& , {
Devices`DeviceAPI`DeviceDump`props$$,
Devices`DeviceAPI`DeviceDump`vals$$}]]], StandardForm]],
DynamicModuleValues :> {}], "SummaryItem"],
"\[SpanFromLeft]"}}, AutoDelete -> False,
BaseStyle -> {
ShowStringCharacters -> False, NumberMarks -> False,
PrintPrecision -> 3, ShowSyntaxStyles -> False},
GridBoxAlignment -> {
"Columns" -> {{Left}}, "Rows" -> {{Automatic}}},
GridBoxItemSize -> {
"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}},
GridBoxSpacings -> {
"Columns" -> {{2}}, "Rows" -> {{Automatic}}}]}}, AutoDelete ->
False, BaselinePosition -> {1, 1},
GridBoxAlignment -> {"Rows" -> {{Top}}},
GridBoxItemSize -> {
"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}]},
Dynamic[Typeset`open$$], ImageSize -> Automatic]},
"SummaryPanel"],
DynamicModuleValues:>{}], "]"}],
DeviceObject[{"Serial", 1}],
Editable->False,
SelectWithContents->True,
Selectable->False]], "Output",
CellChangeTimes->{
3.8021056788097625`*^9, 3.8021057453831787`*^9, 3.8021057942895336`*^9,
3.8021060316366534`*^9, 3.802106186261894*^9, 3.8021062855548315`*^9,
3.802106378429561*^9, 3.802106581293333*^9, 3.8021066130743113`*^9,
3.8032935668107853`*^9, 3.8032936510903645`*^9, {3.803293875616276*^9,
3.803293903115593*^9}, 3.803294100450036*^9, 3.803294405067174*^9,
3.803294604379943*^9, 3.8032946712162905`*^9, {3.8032949499163074`*^9,
3.803294976088396*^9}, 3.8032951712887983`*^9, 3.803647675523327*^9, {
3.803647739731455*^9, 3.803647747606122*^9}, 3.803648496177911*^9},
CellLabel->"Out[1]=",ExpressionUUID->"87f9b36f-c505-426b-b212-23c48052492d"]
}, Open ]],
Cell["\<\
SingleSample requests the device to do one capture of the given amount of \
samples. This capture is done at the current sample rate.
A list of numbers of length \[OpenCurlyQuote]count\[CloseCurlyQuote] is \
returned.\
\>", "Text",
CellChangeTimes->{{3.803667979394189*^9, 3.8036680090825872`*^9}, {
3.8036681701208906`*^9,
3.8036682021838045`*^9}},ExpressionUUID->"336962db-8cb1-4bb1-afa0-\
7282e6af4f04"],
Cell[BoxData[
RowBox[{
RowBox[{
RowBox[{"SingleSample", "[",
RowBox[{"S_", ",", " ", "count_"}], "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{", "buf", "}"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"DeviceWrite", "[",
RowBox[{"S", ",", " ",
RowBox[{"{",
RowBox[{"114", ",",
RowBox[{"BitAnd", "[",
RowBox[{"count", ",", "255"}], "]"}], ",",
RowBox[{"BitAnd", "[",
RowBox[{
RowBox[{"BitShiftRight", "[",
RowBox[{"count", ",", "8"}], "]"}], ",", "255"}], "]"}]}],
"}"}]}], "]"}], ";", "\[IndentingNewLine]",
RowBox[{"buf", " ", "=", " ",
RowBox[{"DeviceReadList", "[",
RowBox[{"S", ",", " ",
RowBox[{"count", "*", "2"}]}], "]"}]}], ";", "\[IndentingNewLine]",
RowBox[{"Table", "[",
RowBox[{
RowBox[{"(",
RowBox[{"BitOr", "[",
RowBox[{
RowBox[{"buf", "[",
RowBox[{"[",
RowBox[{
RowBox[{"i", "*", "2"}], "+", "1"}], "]"}], "]"}], ",",
RowBox[{"BitShiftLeft", "[",
RowBox[{
RowBox[{"buf", "[",
RowBox[{"[",
RowBox[{
RowBox[{"i", "*", "2"}], "+", "2"}], "]"}], "]"}], ",", "8"}],
"]"}]}], "]"}], ")"}], ",", " ",
RowBox[{"{",
RowBox[{"i", ",", "0", ",",
RowBox[{"count", "-", "1"}]}], "}"}]}], "]"}]}]}], "]"}]}],
";"}]], "Input",
CellChangeTimes->CompressedData["
1:eJwdxU8og3EABuC1krVWdphS09gB2ZqSdnCgxjIbrcWatcNiLJdl/h4s5SKH
CYvV5OJiydCsLVMbajayzWlqUdNSmJlYsrLW+N7f4enhG8wDRjqNRuNS8Da/
K/kymJNw+Eqy0y9IY1VS+IOXbuy6V2p17Iwcvfb8YpFiq4gLUv9IhnotUm3A
JzH9YZba1W8muzesvHdq2+Yu+dg4Z8NPrDE7jqZ6/dhn3z/FgoX0PbaWZA+Y
rsi/4Uu59wMrNaFvzNCIS9jiWKblqHccq2RXTbQC1ztkbKwaYni/qJu0cXJf
920Bl8LPZJbJxM1TX00w63AtOyDEjvUImT7e0SrW5CRZo4WcaB6exIqDqims
z/LmsZYzvYgz8konDvxd7OGZzvIRXgky3Xg00RjEUnU7+fwzHMYhU0MEF3U9
ceyLe+7wrCiawuWWtkf8D5VO50A=
"],
CellLabel->"In[2]:=",ExpressionUUID->"1dac0fac-36a1-454c-ab52-6dbac0f2baaa"],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"ListPlot", "[",
RowBox[{
RowBox[{"SingleSample", "[",
RowBox[{"S", ",", "1000"}], "]"}], " ", ",", " ",
RowBox[{"PlotRange", "\[Rule]",
RowBox[{"{",
RowBox[{"0", ",", " ", "4096"}], "}"}]}]}], "]"}]], "Input",
CellChangeTimes->CompressedData["
1:eJxTTMoPSmViYGAQBmIQffO+hezz4DeOVq0RmiA6JDzSCERvuDHTBETLC9y1
ANFvkrPcQbSSt1k0iN7nyREDopfdTkwE0VPN/2WB6CN1AgUg+lvDzCKwOZMu
l4NoqSlz6kF0nVrpDwh9AkznWAn/BdGPNeP/ge1xyU56AaSzDy8H08vtDDtf
AWnDg9t6QLTVUfGJIDot/+UiEF11U345iL7ro74GRDPa8m8E0RPd+jaD6RKt
za+B9M8PxltA9JsZ/4XeAOlisUvCIHrbhz2HTMPeOHq9Vz8Movec/3YCREud
tTwFoqXTom6A6FUhYg9BNABxaKVV
"],
CellLabel->"In[3]:=",ExpressionUUID->"a9e2b7bb-91a1-4144-93ef-1efead3fa9b4"],
Cell[BoxData[
GraphicsBox[{{},
{RGBColor[0.368417, 0.506779, 0.709798], PointSize[0.004583333333333334],
AbsoluteThickness[1.6], PointBox[CompressedData["
1:eJxd23+Io3edwPHQW0ooiwRZJBxDeSxLCWVYcr2xxrrWx7pXYx0115urUcf6
WNca17HGOu7FOtbHdfRi3TvD3Vwv1nWNcZVQFgllkVAWeZBFgiwllKUMZZEg
i4SylCBLCWURf3zf7wFn//nw2ifJ8zzf37/mrY9+8aHP3JLL5Wb/kMv9NYZ/
83f/LczOxPxHiCWdDzF9FhdCvNnFh0JMdJHv/z9eCnH2fzgKcbyD7wixoA+H
uPq/+E4+/z+4FGJT3xViVS+HeEMfCbHo75VDXPJ+/xTida/fHeLE6/8cYubz
r4R44Rn8Np7P978nxHM/wG8PsWX6VUKsmL7vCPHoWXwvn/8xfmeIqz18NMRX
9btCfOMn+L4QT/fxu0P8pY5DfO6nIab4LM69J8R7znEdv4Jz94c48Dq+7Wdc
f2+IL3gdj/z+sRBv5fMp/qXX/yXE2/0+fs3neyDEHZ8fF7z+vhAf6nMdXzJ9
qiEexineMD3fH+IS6Z/iKz/i+oMhXvwh1/Gq+fuBEBvkf4rrlo/VEDuUnxQv
W54+yO9R3lK8Ynn8UIiW5xTv1Y8Ph1jwOr7p9VqIJa7H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bnZ/DI+u/9SJ8anuE69jxvgt2PbXjd9XY8xy38
lP0/fsP1X2z72MEP9EPs4je5/oPvcf0He758iN9i+48fd/0Xu541xp5XnJje
tv/Y8dQUO3+ZYc+fzPEh139NT8d/p0O0vufxkvUfu55VxCfdH8R3u/7n990v
xDdI/wrO+/c6uGf/j4+6n45H5r92fxkXcQMPPG+CPR/Y8vkc/+MO5buNj3se
Cy/jLnb81cPuhwyw/c0Qe553hC87/8f+vcoYu74w8X2oH7u4QnsxxQvSZ2b6
kH5zn5f6ssAr/v3Uf4VYor/P46v2/9j+o4jPmP/Y9rOE57iMD7v+gxeu/2L7
jyquuv6Lp7b/Pq9/D4LtXxrY8+1N7Hy9hVed/+PXHf/hVz2PhZ1PdfELvF8P
u186wJ7PGvr71IcRfszzi9jx1hgfcz/X97X/x3t/z4DdT5/5e9SHufmFF/iA
6z//HaLzkTy2vBaw9aOI7R8inLj+i13fLWP7lwq2/4ix85uq9/M88T7X8RnX
f7HrWQ18wPMm+CDp08Ilz1/h07iNu57Hwjdpr7q+r/0/fjP5PcCvmP+mZz/E
EXY/LcNtytcYu747wZ732MUNx//Y+foM30V5n+Nf2f5jz/fmvh+i85M8dn5e
wJ6XLOJlx3/Y/ZvS9//+/cp4DVew6RPjv6TfnwGTtMDD
"]]}, {{}, {}}},
AspectRatio->NCache[GoldenRatio^(-1), 0.6180339887498948],
Axes->{True, True},
AxesLabel->{None, None},
AxesOrigin->{0., 0},
DisplayFunction->Identity,
Frame->{{False, False}, {False, False}},
FrameLabel->{{None, None}, {None, None}},
FrameTicks->{{Automatic, Automatic}, {Automatic, Automatic}},
GridLines->{None, None},
GridLinesStyle->Directive[
GrayLevel[0.5, 0.4]],
Method->{
"OptimizePlotMarkers" -> True, "OptimizePlotMarkers" -> True,
"CoordinatesToolOptions" -> {"DisplayFunction" -> ({
Identity[
Part[#, 1]],
Identity[
Part[#, 2]]}& ), "CopiedValueFunction" -> ({
Identity[
Part[#, 1]],
Identity[
Part[#, 2]]}& )}},
PlotRange->{{0., 1000.}, {0, 4096}},
PlotRangeClipping->True,
PlotRangePadding->{{
Scaled[0.02],
Scaled[0.02]}, {0, 0}},
Ticks->{Automatic, Automatic}]], "Output",
CellChangeTimes->{{3.8032952328885603`*^9, 3.803295257810297*^9}, {
3.8032952931967964`*^9, 3.803295315540674*^9}, {3.8032954191064196`*^9,
3.8032955209321632`*^9}, 3.80329646138122*^9, {3.803297254933321*^9,
3.8032972818802733`*^9}, 3.803298145364857*^9, 3.803647693697708*^9,
3.8036477523094993`*^9, 3.803647932598894*^9, 3.8036485018182135`*^9},
CellLabel->"Out[3]=",ExpressionUUID->"190f0b31-04bc-4b1c-9616-a401c70da720"]
}, Open ]],
Cell[BoxData[
RowBox[{
RowBox[{"DeviceClose", "[", "S", "]"}], ";"}]], "Input",
CellChangeTimes->{
3.803667878393823*^9},ExpressionUUID->"c40a0be2-35b2-44d6-811b-\
88a120de4af9"]
},
WindowSize->{1920, 997},
WindowMargins->{{-8, Automatic}, {Automatic, -8}},
TaggingRules->{"TryRealOnly" -> False},
Magnification:>1.5 Inherited,
FrontEndVersion->"12.1 for Microsoft Windows (64-bit) (June 19, 2020)",
StyleDefinitions->"Default.nb",
ExpressionUUID->"b6499ea8-3b21-4d74-ad73-b3d296b2a7aa"
]
(* End of Notebook Content *)
(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[558, 20, 292, 6, 86, "Text",ExpressionUUID->"85416522-5898-4319-9fb1-fbe2e065160f"],
Cell[CellGroupData[{
Cell[875, 30, 900, 16, 43, "Input",ExpressionUUID->"41d31997-6913-4b37-90f8-9a96f3c666e2"],
Cell[1778, 48, 19045, 363, 112, "Output",ExpressionUUID->"87f9b36f-c505-426b-b212-23c48052492d"]
}, Open ]],
Cell[20838, 414, 422, 9, 86, "Text",ExpressionUUID->"336962db-8cb1-4bb1-afa0-7282e6af4f04"],
Cell[21263, 425, 2123, 54, 131, "Input",ExpressionUUID->"1dac0fac-36a1-454c-ab52-6dbac0f2baaa"],
Cell[CellGroupData[{
Cell[23411, 483, 714, 16, 43, "Input",ExpressionUUID->"a9e2b7bb-91a1-4144-93ef-1efead3fa9b4"],
Cell[24128, 501, 7079, 129, 363, "Output",ExpressionUUID->"190f0b31-04bc-4b1c-9616-a401c70da720"]
}, Open ]],
Cell[31222, 633, 184, 5, 43, "Input",ExpressionUUID->"c40a0be2-35b2-44d6-811b-88a120de4af9"]
}
]
*)