Initial commit: merge nuescan, pymso, pybbd202, and pypewpewhops into scanengine-3
- Merged four separate hardware control projects into unified platform - Created unified requirements.txt with all dependencies - Added comprehensive .gitignore - Added project overview README Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test script to connect to a Tektronix oscilloscope via raw sockets.
|
||||
"""
|
||||
|
||||
from tektronix_base import TektronixOscilloscopeBase
|
||||
|
||||
|
||||
def main():
|
||||
"""Test connection to oscilloscope at 192.168.10.105"""
|
||||
|
||||
scope_ip = "192.168.10.105"
|
||||
scope_port = 4000
|
||||
|
||||
print(f"Attempting to connect to oscilloscope at {scope_ip}:{scope_port}...")
|
||||
|
||||
scope = TektronixOscilloscopeBase(resource_name=scope_ip, port=scope_port, timeout=5.0)
|
||||
|
||||
try:
|
||||
# Attempt connection
|
||||
scope.connect()
|
||||
print(f"✓ Successfully connected to {scope_ip}:{scope_port}")
|
||||
print(f"✓ Connection status: {scope.is_connected}")
|
||||
|
||||
# Get instrument identification
|
||||
print("\nQuerying instrument identification...")
|
||||
idn = scope.identify()
|
||||
print(f"✓ Instrument ID: {idn}")
|
||||
|
||||
# Test a simple query
|
||||
print("\nTesting SCPI query...")
|
||||
response = scope.query("*OPT?")
|
||||
print(f"✓ Installed options: {response}")
|
||||
|
||||
# Test a write command
|
||||
print("\nTesting SCPI write command...")
|
||||
scope.write("*CLS")
|
||||
print("✓ Cleared status registers")
|
||||
|
||||
except ValueError as e:
|
||||
print(f"✗ Configuration error: {e}")
|
||||
except ConnectionError as e:
|
||||
print(f"✗ Connection failed: {e}")
|
||||
print("\nTroubleshooting tips:")
|
||||
print(" - Verify the oscilloscope IP address is correct")
|
||||
print(" - Check network connectivity (try: ping 192.168.10.105)")
|
||||
print(" - Ensure the oscilloscope has LXI/socket server enabled")
|
||||
print(" - Verify port 4000 is correct (check scope network settings)")
|
||||
except RuntimeError as e:
|
||||
print(f"✗ Runtime error: {e}")
|
||||
except Exception as e:
|
||||
print(f"✗ Unexpected error: {type(e).__name__}: {e}")
|
||||
finally:
|
||||
# Always disconnect
|
||||
if scope.is_connected:
|
||||
scope.disconnect()
|
||||
print("\n✓ Disconnected from oscilloscope")
|
||||
else:
|
||||
print("\n✗ Not connected")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user