AnsweredAssumed Answered

Visual C++ programming for E8257D Signal Generator

Question asked by ErSanjeev on Apr 7, 2014
Latest reply on Apr 10, 2014 by tabbott
I am writing a VC++ program to change the frequency of Signal Generator from 0.5 GHz to 18 GHz in the step of 500 MHz. I want to use the for loop in the program. The code is as below:


#include
#include

void CTryDlg::OnOK() 
{
     ViSession defaultRM, vi;
     viOpenDefaultRM(&defaultRM);
     viOpen(defaultRM, "GPIB0::09::INSTR",VI_NULL,VI_NULL, &vi); 

     viPrintf(vi, "*RST\n");

     float i= 0.5;
     for (; i = < 36; i=i+0.5)
     {
          viPrintf(vi, "FREQ ", i ,"GHZ\n");
          Sleep(500);
     }
     
     viClose(vi);
     viClose(defaultRM);
     
}

The above code gives error because I am trying to concatenate the char and number, but I do not know how to do this.
Please help in this regard.

I will be thankful for your reply.

Outcomes