Immediate Switching Mode
CS8000 API provides two modes for switching connections: Immediate Mode and Sequence Mode. This chapter describes the Immediate Mode, which allows for instant switching of RF connections.
Immediate mode is useful for quickly testing individual switch configurations, without the need for precise switch timing. In immediate mode, each connection change is applied as soon as the command is issued, making it ideal for exploratory testing and debugging, but non-deterministic delays are introduced due to USB communication and device processing time. Sequence mode, on the other hand, allows for predefining a series of switch configurations to be executed with precise timing, making it suitable for automated test sequences where timing is critical.
Using Immediate Mode​
In Immediate Mode, switching connections is straightforward. You simply call the prepare() method to define the desired connections, followed by the commit() method to apply them immediately.
If you make several calls to prepare() before calling commit(), all the prepared connections will be applied simultaneously when commit() is called.
The example below demonstrates how to use Immediate Mode to switch connections on a CS8216 device.
- NodeJS
- Python
import { CS8000 } from "@ikalogic/cs8000";
const sw = new CS8000("CS8216");
sw.open(); // Open the first available device
sw.prepare(1, 5); // Prepare to connect COMMON port 1 to channel 5
sw.prepare(2, 0); // Prepare to open COMMON port 2 (disconnect, isolated)
sw.commit(); // Apply the prepared connection immediately
sw.prepare(1, 0); // Prepare to open COMMON port 1 (disconnect, isolated)
sw.prepare(2, 5); // Prepare to connect COMMON port 2 to channel 5
sw.commit(); // Apply the prepared connection immediately
from ikalogic_cs8000 import CS8000
sw = CS8000("CS8216")
sw.open() # Open the first available device
sw.prepare(1, 5) # Prepare to connect COMMON port 1 to channel 5
sw.prepare(2, 0) # Prepare to open COMMON port 2 (disconnect, isolated)
sw.commit() # Apply the prepared connection immediately
sw.prepare(1, 0) # Prepare to open COMMON port 1 (disconnect, isolated)
sw.prepare(2, 5) # Prepare to connect COMMON port 2 to channel 5
sw.commit() # Apply the prepared connection immediately
Calling prepare() several times on the same COMMON port will overwrite the previous preparation for that port. Only the last prepared connection for each COMMON port will be applied when commit() is called. If you want to apply several different connections, you must call commit() after each prepare().