LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Stanford Ds345 to use Arbitrary generation

Good morning, i'm an italian student of Electronic Enginner second degree, i use DS345 to generate an arbitrary waveform but my program generate in the istrument every time an error about loading, i post my program:

double array[1000];
 int array1[1000],Instrument0;

// Arbitrary waveform generate by me
  Chirp(1000,amp,20,100,array); 

// star to communicate with instrument
srds345_init ("GPIB0::10::INSTR", VI_TRUE, VI_TRUE, &Instrument0); 

// convert array to int array1

  for(i=0;i<1000;i++){



array1[i]=(int)array[i];

sum+=array1[i];

}

// add checksum
array1[1000]=sum;

status=srds345_WriteInstrData(Instrument0, "LDWF?0,1000");

srds345_ReadInstrData(Instrument0,45,resp1,&b1); 

SetCtrlVal(PANEL_2,PANEL_2_IDD,resp1);

srds345_WriteInstrData(Instrument0,(char*)array1);

   
 srds345_WriteInstrData(Instrument0,"FUNC5"); 

i don't know whre the error is....

Thank u for the the help....

0 Kudos
Message 1 of 3
(3,512 Views)
You need to increase the size of array1 so that you can add the sum value.  You are using array1[1000], but this array is 1000 entries long using index 0-999.  Accessing array1[1000] will generate a memory fault. 

Message Edited by mvr on 11-27-2007 12:54 PM
0 Kudos
Message 2 of 3
(3,498 Views)
Excuse me i have made an error in that line, i have corrected it in my program but i have the same problem. I add the checksum as the last value but i can't send the array1 to DS345 because i recevied an error answer from the instrument. I have tried with the program in the DS345's manual but it doesn't work...why?
0 Kudos
Message 3 of 3
(3,494 Views)