LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

PlotIntensity general protection fault

Hi,

 

I'm using version 9.0.1 and getting a general protection fault when trying to execute;

                PlotIntensity(pan_plot,PANEL_GRAPH_2,(void*)offset,numX,numY,
                 VAL_DOUBLE,colors,hiColor,numColors,interpColors,FALSE);

where numX=320 and numY=256.

I do use DeleteGraphPlot (pan_plot, PANEL_GRAPH_2, -1, VAL_DELAYED_DRAW); 

earlier in the routine.

 

Any ideas on the cause and correction for this?

 

Thanks,

Doug.

0 Kudos
Message 1 of 8
(3,591 Views)

I don't understand your (void *) casting in Z Array parameter: the array should be defined as double offset[256][320] and passed directly to the function.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 8
(3,579 Views)

The CVI help file defines the parameters as:

int PlotIntensity (int panelHandle, int controlID, void *zArray, int numberOfXPoints, int numberOfYPoints, int zDataType, ColorMapEntry colorMapArray[], int hiColor, int numberOfColors, int interpColors, int interpPixels);

 

where the array parameter is cast as void*.  The calling routine has defined the offset as;

    double offset[NUM_OF_DISPLAY_ROWS][NUM_OF_DISPLAY_COLUMNS];  

 

Thanks,

Doug.

0 Kudos
Message 3 of 8
(3,559 Views)

The parameter definition is void * since it is an array you can pass to this function arrays of various data types, but actual array passed to the function must match the type defined in Z Data Type parameter; in your case you can simply pass your double array without any casting. See any of the examples listed in the function help for reference.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 8
(3,551 Views)

Thanks Roberto.

I removed the reference to void* for the Zarray, but still get the GPF.

Additional note -- even with that casting, the application would plot several times before lapsing into the GPF.  Once there it faults every time, even after cycling power on the computer.  Removing the void* did not affect that behavior.

Doug.

0 Kudos
Message 5 of 8
(3,542 Views)

Hi, a double array of 320*256 elements will take 655360 bytes. How is dimensioned your stack? You may be near the stack limit size, and supposing under some condition your program allocates some more space on the stack you are likely to get this error or a similar stack overflow error.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 6 of 8
(3,538 Views)

Doubling my stack to 1 GB did not stop the GPF.  However, if I exit the program, run a different application that uses the PlotIntensity function, exit that and rerun the original program, the GPF does not occur.

0 Kudos
Message 7 of 8
(3,522 Views)

Hi DMF2,

 

Does this behavior apply to running any application that uses the PlotIntensity function before you program or a specific one?  Is it one of the example programs you are running before it?  Have you tried removing the additional graph manipulation that you are doing on this graph before the PlotIntensity to see if the problem still occurs?

Justin D
Applications Engineer
National Instruments
http://www.ni.com/support/
0 Kudos
Message 8 of 8
(3,515 Views)