Skip to content

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:

Type Argument Description
string Interface Interface to which the device is connected.
Argument Connection Part #s
'GB ' Optical Gigabit PO5/FO5
'USB' USB UZ1, UZ2, UB2, UZ4
'USB3' USB 3.0 UZ3

Returns:

Type Value Description
int 0 Connection not successful.
int 1 Connection successful.

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:

Type Argument Description
int racknum Rack number of the IO line to flush.

Returns:

Type Value Description
int 0 Unable to Flush I/O lines.
int 1 Successfully Flushed I/O lines.

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:

Type Argument Description
int Devtype ID number of the device.
PA5 RP2 RL2 RA16 RV8 RX5 RX6 RX7 RX8 RZ2 RZ5 RZ6
33 35 36 37 38 45 46 47 48 50 53 54
Type Argument Description
int devnum Device number (1-16) e.g. RP2_1 is the first RP2 in the system (Note: Device number and physical position on the racks can differ).

Returns:

Type Value Description
int 0 No such device type or device number.
int n>2 Even numbers indicate position 1 and odd numbers position 2 of the device caddie (rack).

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:

Type Argument Description
int Devtype ID number of the device.
PA5 RP2 RL2 RA16 RV8 RX5 RX6 RX7 RX8 RZ2 RZ5 RZ6
33 35 36 37 38 45 46 47 48 50 53 54
Type Argument Description
int devnum Device number (1-16) e.g. RP2_1 is the first RP2 in the system (Note: Device number and physical position of the racks can differ).

Returns:

Type Value Description
int 0 No such device type or device number.
int >16 Version of the microcode.

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:

Type Value Description
string "" No Error
string "(string)" Possible Error descriptions: All Errors begin with ZERR
ARG_OUT_OF_RANGE
UNABLE_TO_GET_XBUS_LOCK
UNKNOWN_ERROR
XBUS_COMMINICATION_ERROR
NO_INTERFACE_INITIALIZED
XBUS_GENERATED_ERROR
ACTIVE_ACCESS_UNAVAIL
PASSIVE_ACCESS_NOT_ALLOWED
MEMORY_ALLOC_FAILED
FAILED_READ_FROM_DEVICE
DEVICE_DRIVER_CODE_ERROR
SPECED_MEMORY_NOT_VALID
ILLEGAL_USB_DEVICE_SPECED
ZUSB_COM_ERROR
ZUSB_DEVICE_NOT_RESPOND
ZUSB_START_FAILURE
ZUSB_UNABLE_TO_ACC_DEV
CALL_NOT_SUPPORT_ON_INTER
DEVICE_SPEC_ERR

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:

Type Argument Description
int racknum Caddie number to Reset.

Returns:

Type Value Description
int 0 Successfully performed a Hardware Reset.

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:

Type Argument Description
int Racknum 0=all device caddies (racks) triggered n=racknum triggered.
int Trig type 0=pulse, 1=high, 2=low.
int delay delay before trigger event occurs, must be a minimum of 2msec per rack.

Returns:

Type Value Description
int 0 Unsuccessful.
int 1 Successful.
int Note: In v57 and above, a zero will be returned even if the trigger is actually generated correctly. There are two ways to monitor the actual results.

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:

Type Argument Description
int BitMask Racknum Bitmask values for the racknum. e.g. 5 means that device caddie 1 is the master and device caddie 3 is the slave synchronized clock. 6 means that device caddie 2 is the master and device caddie 3 is the slave.

Returns:

Type Value Description
int 0 Unsuccessful.
int 1 Successful.

MATLAB

Synchronizes the clocks of zBus device caddies 1 and 2.

zBUS=actxserver('ZBUS.x');
zBUS.ConnectZBUS('USB')
zBus.zBusSync(3)