Skip to content

Commit

Permalink
reduced samples per chan
Browse files Browse the repository at this point in the history
  • Loading branch information
WayneDroid committed Apr 23, 2024
1 parent e7445c6 commit 170bc20
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions examples/analog_in/cont_voltage_acq_int_clk.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
with nidaqmx.Task() as task:
task.ai_channels.add_ai_voltage_chan("Dev1/ai0")
task.timing.cfg_samp_clk_timing(
1000.0, sample_mode=AcquisitionType.CONTINUOUS, samps_per_chan=1000
1000.0, sample_mode=AcquisitionType.CONTINUOUS, samps_per_chan=50
)
print("Starting task. Press Ctrl+C to stop.")
time.sleep(1.0)
task.start()

try:
while True:
data = task.read(number_of_samples_per_channel=100)
data = task.read(number_of_samples_per_channel=10)
print(f"Acquired data: {pp.pformat(data)}")
print("Press Ctrl+C to stop.")
time.sleep(0.5)
except KeyboardInterrupt:
pass
finally:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
def callback(task_handle, every_n_samples_event_type, number_of_samples, callback_data):
"""Callback function for reading singals."""
print("Every N Samples callback invoked.")
pp.pprint(task.read(number_of_samples_per_channel=100))
pp.pprint(task.read(number_of_samples_per_channel=10))

return 0

task.ai_channels.add_ai_voltage_chan("Dev1/ai0")
task.timing.cfg_samp_clk_timing(
1000.0, sample_mode=AcquisitionType.CONTINUOUS, samps_per_chan=1000
1000.0, sample_mode=AcquisitionType.CONTINUOUS, samps_per_chan=50
)
task.register_every_n_samples_acquired_into_buffer_event(100, callback)
print("Starting task. Press Enter to stop.")
time.sleep(0.5)
time.sleep(1.0)
task.start()

input("")
Expand Down
6 changes: 3 additions & 3 deletions examples/analog_in/voltage_acq_int_clk.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"""

import nidaqmx
from nidaqmx.constants import AcquisitionType
from nidaqmx.constants import AcquisitionType, READ_ALL_AVAILABLE

with nidaqmx.Task() as task:
task.ai_channels.add_ai_voltage_chan("Dev1/ai0")
task.timing.cfg_samp_clk_timing(1000.0, sample_mode=AcquisitionType.FINITE, samps_per_chan=1000)
task.timing.cfg_samp_clk_timing(1000.0, sample_mode=AcquisitionType.FINITE, samps_per_chan=50)

data = task.read()
data = task.read(READ_ALL_AVAILABLE)
print(f"Acquired data: {data}")

0 comments on commit 170bc20

Please sign in to comment.