Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Imports
- import os, glob
- from time import sleep
- from saleae import automation
- # Config
- localCaptureDir = '/path/to/my/captures/'
- analyzer_config_template = {
- 'Bit Rate (Bits/s)': 9600,
- 'Bits per Frame': '8 Bits per Transfer (Standard)',
- 'Stop Bits': '1 Stop Bit (Standard)',
- 'Parity Bit': 'No Parity Bit (Standard)',
- 'Significant Bit': 'Least Significant Bit Sent First (Standard)',
- 'Signal inversion': 'Inverted',
- 'Mode': 'Normal'
- }
- # Main program starts here
- # Connect to the running Logic 2 application on port 10430
- manager = automation.Manager(port=10430)
- for file in glob.glob(localCaptureDir + "*.sal"):
- # Open capture file
- capture = manager.load_capture(file)
- capture.wait() # Not strictly required for opening a saved capture
- # Clear all analyzers
- analyzers = []
- # Add analyzers
- for channel in [0, 1, 2, 3]:
- analyzer_config = analyzer_config_template
- analyzer_config['Input Channel'] = channel
- analyzers.append(
- capture.add_analyzer(
- name = 'Async Serial',
- label = 'channel_' + str(channel) + '_serial',
- settings = analyzer_config
- )
- )
- sleep(2) # Not strictly required
- # Export data
- capture.export_data_table(
- filepath = file + ".csv",
- analyzers = analyzers,
- radix = automation.RadixType.HEXADECIMAL
- )
- # Close file
- capture.close()
- # Close the connection to the Logic 2 application
- manager.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement