diff --git a/CHANGELOG.md b/CHANGELOG.md index 092ff8d859..b94d2d4a68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -558,6 +558,7 @@ #### [nidigital] Unreleased - Added - (Common) Added `nitlsconfig[grpc]>=1.0.0a2` to the optional gRPC dependencies. + - Added the `nidigital_load_sheets_and_burst.py` example. - Changed - Removed diff --git a/docs/nidigital/examples.rst b/docs/nidigital/examples.rst index b8c8cc689a..cde76451ef 100644 --- a/docs/nidigital/examples.rst +++ b/docs/nidigital/examples.rst @@ -21,6 +21,15 @@ nidigital_configure_time_set_and_voltage_levels.py :encoding: utf8 :caption: `(nidigital_configure_time_set_and_voltage_levels.py) `_ +nidigital_load_sheets_and_burst.py +---------------------------------- + +.. literalinclude:: ../../src/nidigital/examples/load_sheets_and_burst/nidigital_load_sheets_and_burst.py + :language: python + :linenos: + :encoding: utf8 + :caption: `(nidigital_load_sheets_and_burst.py) `_ + nidigital_ppmu_source_and_measure.py ------------------------------------ diff --git a/src/nidigital/examples/load_sheets_and_burst/Pattern.digipat b/src/nidigital/examples/load_sheets_and_burst/Pattern.digipat new file mode 100644 index 0000000000..8d6f3c6c1e Binary files /dev/null and b/src/nidigital/examples/load_sheets_and_burst/Pattern.digipat differ diff --git a/src/nidigital/examples/load_sheets_and_burst/PinLevels.digilevels b/src/nidigital/examples/load_sheets_and_burst/PinLevels.digilevels new file mode 100644 index 0000000000..1908b117fa --- /dev/null +++ b/src/nidigital/examples/load_sheets_and_burst/PinLevels.digilevels @@ -0,0 +1,15 @@ + + + + + + 0 + 3.3 + 0.8 + 2 + 0 + HighZ + + + + \ No newline at end of file diff --git a/src/nidigital/examples/load_sheets_and_burst/PinMap.pinmap b/src/nidigital/examples/load_sheets_and_burst/PinMap.pinmap new file mode 100644 index 0000000000..1ed3183662 --- /dev/null +++ b/src/nidigital/examples/load_sheets_and_burst/PinMap.pinmap @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/nidigital/examples/load_sheets_and_burst/Specifications.specs b/src/nidigital/examples/load_sheets_and_burst/Specifications.specs new file mode 100644 index 0000000000..65c615cfd6 --- /dev/null +++ b/src/nidigital/examples/load_sheets_and_burst/Specifications.specs @@ -0,0 +1,9 @@ + + +
+ + 1 µs + +
+ +
\ No newline at end of file diff --git a/src/nidigital/examples/load_sheets_and_burst/Timing.digitiming b/src/nidigital/examples/load_sheets_and_burst/Timing.digitiming new file mode 100644 index 0000000000..fe5064ec43 --- /dev/null +++ b/src/nidigital/examples/load_sheets_and_burst/Timing.digitiming @@ -0,0 +1,23 @@ + + + + + + timing.period + + + + 0 µs + timing.period / 2 + timing.period + + + (3 * timing.period) / 4 + + Pattern + + + + + + \ No newline at end of file diff --git a/src/nidigital/examples/load_sheets_and_burst/load_sheets_and_burst.digiproj b/src/nidigital/examples/load_sheets_and_burst/load_sheets_and_burst.digiproj new file mode 100644 index 0000000000..be07fcaadd --- /dev/null +++ b/src/nidigital/examples/load_sheets_and_burst/load_sheets_and_burst.digiproj @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/nidigital/examples/load_sheets_and_burst/nidigital_load_sheets_and_burst.py b/src/nidigital/examples/load_sheets_and_burst/nidigital_load_sheets_and_burst.py new file mode 100644 index 0000000000..6fc54ce9f4 --- /dev/null +++ b/src/nidigital/examples/load_sheets_and_burst/nidigital_load_sheets_and_burst.py @@ -0,0 +1,63 @@ +#!/usr/bin/python + +import argparse +import nidigital +import os +import sys + + +def example(resource_name, options, start_label): + + with nidigital.Session(resource_name=resource_name, options=options) as session: + + dir = os.path.join(os.path.dirname(__file__)) + + pin_map_filename = os.path.join(dir, 'PinMap.pinmap') + session.load_pin_map(pin_map_filename) + + spec_filename = os.path.join(dir, 'Specifications.specs') + levels_filename = os.path.join(dir, 'PinLevels.digilevels') + timing_filename = os.path.join(dir, 'Timing.digitiming') + session.load_specifications_levels_and_timing(spec_filename, levels_filename, timing_filename) + + session.apply_levels_and_timing(levels_filename, timing_filename) + + pattern_filename = os.path.join(dir, 'Pattern.digipat') + session.load_pattern(pattern_filename) + + print('Start bursting pattern') + session.burst_pattern(start_label=start_label) + + session.selected_function = nidigital.SelectedFunction.DISCONNECT + print('Done bursting pattern') + + +def _main(argsv): + parser = argparse.ArgumentParser(description='Demonstrates how to load the pin map, specifications, levels, timing, and pattern files on a digital pattern instrument and burst the pattern.', formatter_class=argparse.ArgumentDefaultsHelpFormatter) + parser.add_argument('-n', '--resource-name', default='PXI1Slot2,PXI1Slot3', help='The specified resource name of a digital pattern instrument, for example, PXI1Slot3, where PXI1Slot3 is an instrument resource name.') + parser.add_argument('-s', '--simulate', default='True', choices=['True', 'False'], help='Whether to run on simulated hardware or real hardware') + parser.add_argument('-l', '--start-label', default='new_pattern', help='Pattern name or exported pattern label from which to start bursting the pattern.') + args = parser.parse_args(argsv) + + example(args.resource_name, + 'Simulate=1, DriverSetup=Model:6570' if args.simulate == 'True' else '', + args.start_label) + + +def main(): + _main(sys.argv[1:]) + + +def test_main(): + _main([]) + + +def test_example(): + resource_name = 'PXI1Slot2,PXI1Slot3' + options = {'simulate': True, 'driver_setup': {'Model': '6570'}, } + start_label = 'new_pattern' + example(resource_name, options, start_label) + + +if __name__ == '__main__': + main()