zBUS Device
About the zBUSx Methods
This section provides a listing of the available zBUSx ActiveX control methods.
Programming Steps
Add the zBUSx ActiveX controller to your program. The ActiveX help has examples for setting up ActiveX controllers in MATLAB and Python.
Connect to a zBUS (USB or GB) device caddie (rack) with the connectZBUS function.
Control the zBUS with the command and control functions using the ActiveX controller.
ConnectZBUS
Establishes a connection with a ZBUS device interface (GB or USB). ConnectZBUS returns 0 if unsuccessful and 1 when successful.
int ConnectZBUS(string Interface);
Arguments:
Returns:
Connects to the ZBUS device via the Gigabit interface
% Connects to the ZBUS via Optical Gigabit
zBUS=actxserver('ZBUS.x');
if zBUS.ConnectZBUS('GB')
e= 'connected'
else
e= 'Unable to connect'
end
FlushIO
Clears the input and output values on the zBUS in order to remove bad data from the buffers.
int FlushIO(int racknum);
Arguments:
Returns:
Flushes the IO lines of zBUS device caddie 1.
% Flushes the zbus I/O lines
zBUS.FlushIO(1)
GetDeviceAddr
Returns the address of a device, given the device type and device number.
int GetDeviceAddr(int Devtype, int devnum);
Arguments:
Returns:
For example: 2 = rack 1 position 1 3 = rack 1 position 2 4 = rack 2 position 1
Gets the address of PA5_1.
MATLAB % Gets the device address
zBUS.GetDeviceAddr(33,1)
GetDeviceVersion
Checks the version of the device, or microcode of the device (programming information).
int GetDeviceVersion(int Devtype, int devnum);
Arguments:
Returns:
TechNote: RP2.1 returns a value of 1xx (xx=version number) for the version identification.
RL2 Base stations return a value of 135 for the version identification.
Checks to see if the Device has version 50 or greater of the microcode.
% Gets the device version
if zBUS.GetDeviceVersion(35, 1) < 50
disp ' Update your microcode to run with this ActiveX '
end
GetError
Returns an error description from the zBUS.
Note: unsuccessful returns are not always the result of a zBUS error. For example, if a device does not exist at that address a return of zero is valid. The ActiveX controls are designed to produce few error calls.
string GetError;
Arguments:
None
Returns:
Checks the Version number of the PA5 and returns a possible zBUS error.
% Gets the error string
if zBUS.GetDeviceVersion(34, 1)==0
e=zBUS.GetError
end
HardwareReset
Resets the logical connection of the device caddie (rack) to the computer and returns a 0. Used to clear data lines and restore connections to the devices.
int HardwareReset(int racknum);
Arguments:
Returns:
Hardware reset of device caddie number 1.
% Hardware Reset of the zbus I/O lines
zBUS.HardwareReset(1)
Important
See TN0181 HardwareReset always returns 0 for updated information on HardwareReset.
zBusTrigA/zBusTrigB
Triggers several processor devices simultaneously either in one rack or over all racks. Trigger types include a single pulse varying in length (the length is dependant on the sampling rate), a permenant logical high, or a permenant logical low.
Note: To generate a single sample pulse, connect an EdgeDectect component after the zTrig component in your RPvdsEx circuit.
Minimum delay time is 2 milliseconds per rack, e.g. if you trigger five racks the zBusTrig requires 10 milliseconds.
Note: Differences in sample rates will cause differences in the triggering of the clock.
int zBusTrigA/B(int racknum, int Trig type, int delay);
Arguments:
Returns:
In your RPvdsEx circuit:
Link the output of the zTrig component to a digital output on the device. This will allow the trigger result to be viewed on the front panel of the device.
Link a parameter tag to the output of the zTrig component and read this tag in MATLAB, to view the results.
MATLAB
Two RP2 (devices 1 and 2) are loaded with the same circuit. They are triggered simultaneously using zBusTrigA. Only rack 1 receives the trigger. The delay is set for 3 msec just as a precaution and the trigger is a pulse. Both circuits are triggered simultaneously.
zBus=actxserver('ZBUS.x');
zBus.ConnectZBUS('GB')
RP2_1=actxserver('RPco.x');
RP2_2=actxserver('RPco.x');
RP2_1.ConnectRP2('GB', 1)
RP2_1.LoadCOF('C:\Circuit')
RP2_1.Run
RP2_2.ConnectRP2('GB', 2)
RP2_2.LoadCOF('C:\Circuit')
RP2_2.Run
zBus.zBusTrigA(1, 0, 5)
zBusSync
Synchronizes the clocks across several device caddies (racks) to minimize drift. The clocks that drive the DSP can drift by as little as 0.01% over several seconds, producing clock differences of several microseconds. zBusSync ensures synchronization across devices.
To use zBusSync, connect the Sync lines on the UB1/UZ4 to be synchronized, using short BNC cables and T-connectors to minimize noise.
zBusSync uses a bitmask to identify a master and slave clocks. The first rack 'turned on' in the bitmask (according to the logical order of devices) is master and the rest are slaves, i.e. they get their clock signal from the master device.
This command should only be used with the UB1/UZ4 USB 1.1 interfaces. It will always return a zero when used with any other interface type.
int zBusSync(int Bitmask Racknum);
Arguments:
Returns:
MATLAB
Synchronizes the clocks of zBus device caddies 1 and 2.
zBUS=actxserver('ZBUS.x');
zBUS.ConnectZBUS('USB')
zBus.zBusSync(3)