02-13-2007 02:22 AM
02-14-2007 12:47 PM
02-15-2007 10:16 PM
02-19-2007 02:06 AM
hi,
thanks for ur reply... my problem got solved. i was using RS232 n not GPIB... now i could work with my E4416A.... but i have one more doubt, Is there any other name that can be used as resource descriptor which is independed on GPIB/RS232???
I have read about using IVI session factory... in the online tutorial they have mentioned that the Logical name of the machine has to be used for initiating the driver.... what is this Logical name?... what is the logical name for E4416A?.... can we use the same name instead of the VISA Address if i am using IVI COM drivers for Agilent RF PowerMeter...
My aim is to write a VC++ MFC application which will measure the readings from any(currently agilent only, later planning to enhance to any) power meter.... this can be done using IVI session factory right? can u help me in this? i am new to this...
02-19-2007 04:17 AM
02-26-2007 03:13 AM
do we need to add/ install any other drivers than IVI n AgilentRFPowerMeter COM to work with GPIB port ??(i am working with a COM port, its working for me... my friend is tried the same application with GPIB(only change is GPIB address right?).. its not working for him) y? i just said him to install IVI n AgilentRFPowerMeter COM driver.. isnt that enough???
how to set the baud rate of the interfaces(COM n GPIB) through the program?
i didnt see any Communicate class under system class..
in the programmers guide it is said that SYSTem:COMMunicate:SERial:[:RECeive/TRANsmit]:BAUD
Then the system class needs a communication class which has all these options right?... what else class has this option?
02-26-2007 04:30 AM
02-26-2007 04:56 AM
thanks for ur reply..
what if i need to set the baud rate of the COM port??
which VC++ COM driver class has that option?
02-26-2007 05:21 AM
Setting comm baudrate may have two cases -- 1)set baudrate at PC side, 2)set baudrate at instrument side.
1)PC baudrate
You can use viSetAttribute() function (if using VISA32.DLL API) or ISerial::Baudrate property (if using VISA-COM API). VC++ also has SetCommState() API function but it has no meaning if using VISA.
VISA-C (VISA32.DLL) API style is:
vs = viSetAttribute( vi, VI_ATTR_ASRL_BAUD, 9600);
VISA-COM API style is:
ISerialPtr spSerial = spYourVisaSession;
spSerial->BaudRate = 19200;
But when using an IVI driver, there are two cases regarding PC's baudrate -- a)The driver is built with hard-coded baudrate (normaly coding the instrument's available max baud), b)The driver opens VISA with utilizing configuared baudrate such as by NI-MAX. The case a) you don't have to change the PC baudrate manually and the instrument baudrate must only be the same with it. The case b) you can use any baudrate you want as long as the NI-MAX configuration and instrument baudate are matched. (But normally no meaning to use 4800 or slower baudrate with your Pentium4 PC, if the instrument is supporting faster baudrates.)
2)Instrument baudrate:
Normally instrument baudrate shall be set by the instrument front panel BEFORE running the app. But if the app wants to change it through the online, you will use SYSTem:COMMunicate:SERial:BAUDrate command. However, to use this command, your app has already established a serial communication with a known baudrate. If the app is unable to communicate with the instrument due to unknown baudrate, it is also imposiible to send SYSTem:COMMunicate:SERial:BAUDrate.
03-01-2007 01:51 AM
thank you very much for ur reply....
i understood the concept now... i have tried the same... please see the code below... is it the right way to implement ?... sorry for all these silly doubts.. i am really blank in this area... just trying to learn... :)... i am able to do the measuring without the baud rate setting lines... an exception is thrown when i included the baudrate.....
#import "GlobMgr.dll" no_namespace // Visa-Com Functionality
#import "IviDriverTypeLib.dll" no_namespace
#import "IviPwrMeterTypeLib.dll" no_namespace
#import "AgRFPowerMeter.dll" no_namespace
main()
{
HRESULT hr = CoInitialize(NULL);
if(SUCCEEDED(hr))
{
// Create an instance of the driver
IAgilentRFPowerMeterPtr spDrvr(__uuidof(AgilentRFPowerMeter));
try
{
// Edit resouce descriptor and options for your system
_bstr_t resourceDescriptor = "ASRL1::INSTR";
_bstr_t driverSetupOptions = "QueryInstrStatus=true";//Simulate=true,
ISerialPtr spSerial = spDrvr;
spSerial->BaudRate = 19200;
// Initialize the driver
spDrvr->Initialize(resourceDescriptor, VARIANT_TRUE, VARIANT_TRUE, driverSetupOptions);
spDrvr->System->TimeoutMilliseconds = 20000;
........