This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

problems in API function "DisplayPatternAutoStepForSinglePass"

Other Parts Discussed in Thread: DLPC200

Hi~

~~it's me again~~

we want to project a serial images only once , (single pass)

and we found a API function "UINT8 DLP_Display_DisplayPatternAutoStepForSinglePass()"

it is said that if we have 10 available images , they will projected once and stop then.

 

we try to use it , but the display always stop after the first image

(the 10 images are loaded into the external memory successfully)

 

So, what shall we do?

Is there something we didn't do?

thank you ~

-diao

 

  • Hi Diao,

    Your steps are correct. Unfortunately this behavior cannot be avoided. The reason provided below.

    The DLP_Display_DisplayPatternAutoStepForSinglePass is firmware realized feature in the DLPC200 controller.

    The embedded firmware of DLPC200 keep track of number of patterns in the sequence so on every pattern dipsplay it keeps decrementing the number of patterns counter until the last pattern. Note, the  patterns must be shown for defined exposure time so all the patterns have to be displayed for the complete exposure time. Now  after the last pattern is displayed the firmware basically disable the Illumination LED_Enable strobes and stops the pattern display sequence. Therefore, there is a latency involved from the time of displaying last pattern to the actual disabling of illumination and Sequence Stop, until then the next pattern (which is the first pattern) is displayed.  There is no way this behavior cannot be avoided.
     
    Referring to picture below, for 3 8bit pattern display sequence after the last pattern display, the 1st pattern is shown for a short time until the LED_Enable and Sequence stop.

     

     

    You will realize by observing that the first pattern displayed after the last pattern is displayed for short duration time, it is not displayed complete exposure time.

    Regards,
    Sanjeev

  • thank you Sanjeev~

     

    and we stiil have one more quesion:

    we use the function "DLP_Display_DisplayPatternAutoStepForSinglePass " to set "single pass"

    but it sometimes keep in "repeat passes"  .

     

    (it didn't stop after display the serial images once , but continued to display the serial again & again)

    what's the problem?

    -diao

     

  • Hi Diao,

    I think you are making some mistake. Please check if the API executed successfully. If the API executed successfully there is NO way it will ever repeat again.

    You can send me the batch_file or API call order or GUI project settings.

    Regards,

    Sanjeev

     

     

  • Hi~

     

    here is my programme

    it doesn't work sometimes.

     

    thank you~~

    -diao

     

    #include "stdafx.h"
    #include "stddef.h"
    #include "string.h"
    #include "PortabilityLayer.h"
    
    /// Implementation of a logging function.  See 'SetLoggingCallback' function.
    void Logit(String it)
    {
    	printf("%s\n", it);
    }
    
    void Usage(_TCHAR* arg0)
    {
    	printf("Purpose: Downloads 1+ images to image frame buffer memory\n");
    	printf("%s file1 [file2 | ...]\n", arg0);
    	printf("Usage:\n");
    	printf("  Input one or more filenames to download to the DLP LightCommander\n");
    	printf("  image frame buffer memory.\n");
    	printf("  All input files must be DBI-formatted files.  These files are created\n");
    	printf("  by the Application SW written by LOGIC.  See documentation for further details.\n");
    }
    
    // DBI image utility function
    int ReadDbiImageHdr_NBPP(const char* filename);
    
    
    int _tmain(int argc, _TCHAR* argv[])
    {
    	Byte loglvl = 0;
    	Boolean stopOnError = 1;
    	Status rc;
    	int i;
    	unsigned char imgcnt = 4;
    	int nbpp   = -1;
    	Double intensityPerCent;
    	int j;
    
    
    #define MAX_IMAGES  64
    	char file[MAX_IMAGES][256];  // fyi: 64 is just a convenient limit for this driver
    	UInt16 imgOrderLUT[MAX_IMAGES];
    
    
    	for(i=0; i < MAX_IMAGES; i++) {
    		file[i][0] = '\0'; // add NULL terminator
    		imgOrderLUT[i] = 0;
    	}
    
    
    	strcpy(file[0],"C:\\Documents and Settings\\Dragon\\My Documents\\LightCommander Control\\CodingTest\\Solutions\\Test Batchfile for Coding\\Images\\duijiao.dbi");
    	strcpy(file[1],"C:\\Documents and Settings\\Dragon\\My Documents\\LightCommander Control\\CodingTest\\Solutions\\Test Batchfile for Coding\\Images\\dxctest1.dbi");
    	strcpy(file[2],"C:\\Documents and Settings\\Dragon\\My Documents\\LightCommander Control\\newgreen\\Solutions\\12\\Images\\12NO.1.dbi");
    	strcpy(file[3],"C:\\Documents and Settings\\Dragon\\My Documents\\LightCommander Control\\newgreen\\Solutions\\12\\Images\\12NO.2.dbi");
    
    
    
    	// REQUIRED INITIALIZATION...
    	if((rc = InitPortabilityLayer(loglvl+1, loglvl, Logit)) != STAT_OK) {
    		printf("ERROR running InitPortabilityLayer (ret code = %d)\n", (int)rc);
    		return(1);
    	}
    	printf("%45s:  ret code = OK\n","InitPortabilityLayer");
    
    	// 1. Program image order LUT...
    	nbpp = ReadDbiImageHdr_NBPP(file[0]);
    	for(i=0; i < imgcnt; i++)
    		imgOrderLUT[i] = i;  // maintain the same image order as was passed into this app...
    
    	if((rc = DLP_RegIO_WriteImageOrderLut((Byte)nbpp, imgOrderLUT, (UInt16)imgcnt)) != STAT_OK) {
    		printf("ERROR running WriteImageOrderTable (ret code = %d)\n", (int)rc);
    		return(1);
    	}
    
    
    	// 2. Download images...
    	for(i=0; i < imgcnt; i++)
    	{
    		printf("Downloading image# %3d:  %s  ...\n", i, file[i]);
    		if((rc = WriteExternalImage(file[i], i)) != STAT_OK) {
    			printf("ERROR running WriteExternalImage (ret code = %d)\n", (int)rc);
    			return(1);
    		}
    	}
    
    
    	if((rc = DLP_Display_DisplayPatternAutoStepForSinglePass()) != 0) {
    		printf("ERROR running DisplayPatternAutoStepForSinglePass (ret code = %d)\n", (int)rc);
    		return(1);
    	}
    
    	return 0;
    }
    
    // *Temporary* function used to read the NBPP field from the header of a DBI Image file.
    // This function has no guarantees of working in the future and should be used 
    // at your own risk.  It exists here since a similar function is not available as an
    // exported function in the portability DLL.
    int ReadDbiImageHdr_NBPP(const char* filename)
    {
    	unsigned char bpp=0;
    	FILE* pFile = NULL;
    	int nBytesToRead = 0;
    	int nBytesInFile = 0;
    	int nBytesRead = 0;
    
    	typedef struct
    	{
    		char	 signature[4];
    		UInt32	 cbSize;
    		UInt32	 rows;
    		UInt32	 cols;
    		UInt32	 bpp;
    		UInt16	 data[1];
    
    	} dbiImage;
    	dbiImage dbi;
    	nBytesToRead = offsetof(dbiImage,bpp);   // get byte offset to start of "bpp"
    	nBytesToRead += sizeof(UInt32);
    
    	if((pFile = fopen(filename, "rb")) == NULL)
    	{
    		printf("File open error on %s\n", filename);
    		printf("Hint: check spelling or path\n");
    		return -1;
    	}
    	fseek(pFile, 0, SEEK_END);
    	nBytesInFile = ftell(pFile);
    	//printf("#bytes in file = %d\n", nBytesInFile);
    	if(nBytesInFile < nBytesToRead) {
    		printf("Insufficent data in file to read BPP parameter; must be at least %d bytes\n", nBytesToRead);
    		return -1;
    	}
    	fseek(pFile, 0, SEEK_SET);
    	nBytesRead = (long)fread((void*)&dbi, 1, nBytesToRead, pFile);
    	if(nBytesRead != nBytesToRead) {
    		printf("Error: did not read %d bytes...only read % bytes\n", nBytesToRead, nBytesRead);
    		return -1;
    	}
    	return (int)dbi.bpp;
    }
    

  • Hi Diao,

    Your code looks proper to me.

    Can you also send us the log file when you run this code? I am interested to see where it is failing... Is it always failing at DLP_Display_DisplayPatternAutoStepForSinglePass() call?

    There are many printf statemenent with ERROR running.... so having a log when the failure happens definately helps.

    Also provide more info on, exposure time, number of patterns, pattern bit-depth etc...

    Regards,
    Sanjeev

     

  • Hi~

    the whole code runs correctly without failing , (no interruption , no ERROR),

    but the running result is out of the function control. 

    the DLP_Display_DisplayPatternAutoStepForSinglePass()  funtion will lead a repeat passes,

    we don't know where the peoblem is in the code we send to you.

    here are the specific configurations.

    <html>
    <head>
    <META HTTP-EQUIV="Content-Type" content="text/html; charset=utf-16">
    </head>
    <body>
    <pre>
    <table width=100% bgcolor=#CFCFE5><tr> <td> <font face=arial size=+3>
    Build Log
    </font></table><table width=* cellspacing=0 cellpadding=0><tr><td width=0 bgcolor=#EDEDF5>&nbsp;</td><td width=0 bgcolor=#FFFFFF>&nbsp;</td><td width=*><pre>
    <h3>Build started: Project: test222, Configuration: Debug|Win32</h3>
    </pre></table><table width=100% bgcolor=#DFDFE5><tr><td><font face=arial size=+2>
    Command Lines
    </font></table><table width=* cellspacing=0 cellpadding=0><tr><td width=0 bgcolor=#EDEDF5>&nbsp;</td><td width=0 bgcolor=#FFFFFF>&nbsp;</td><td width=*><pre>Creating temporary file "f:\LXY\test222\test222\Debug\RSP00000112883860.rsp" with contents
    [
    /Od /D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_CONSOLE&quot; /D &quot;_UNICODE&quot; /D &quot;UNICODE&quot; /Gm /EHsc /RTC1 /MDd /Fo&quot;Debug\\&quot; /Fd&quot;Debug\vc90.pdb&quot; /W3 /c /ZI /TC .\test222.c
    ]
    Creating command line "cl.exe @f:\LXY\test222\test222\Debug\RSP00000112883860.rsp /nologo /errorReport:prompt"
    Creating temporary file "f:\LXY\test222\test222\Debug\RSP00000212883860.rsp" with contents
    [
    /OUT:&quot;F:\LXY\test222\Debug\test222.exe&quot; /INCREMENTAL /MANIFEST /MANIFESTFILE:&quot;Debug\test222.exe.intermediate.manifest&quot; /MANIFESTUAC:&quot;level='asInvoker' uiAccess='false'&quot; /DEBUG /PDB:&quot;f:\LXY\test222\Debug\test222.pdb&quot; /SUBSYSTEM:CONSOLE /DYNAMICBASE /NXCOMPAT /MACHINE:X86 PortabilityLayer.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
    
    &quot;.\Debug\stdafx.obj&quot;
    
    &quot;.\Debug\test222.obj&quot;
    
    &quot;.\Debug\test222.exe.embed.manifest.res&quot;
    ]
    Creating command line "link.exe @f:\LXY\test222\test222\Debug\RSP00000212883860.rsp /NOLOGO /ERRORREPORT:PROMPT"
    Creating temporary file "f:\LXY\test222\test222\Debug\RSP00000312883860.rsp" with contents
    [
    /out:.\Debug\test222.exe.embed.manifest /notify_update /manifest
    
    .\Debug\test222.exe.intermediate.manifest
    ]
    Creating command line "mt.exe @f:\LXY\test222\test222\Debug\RSP00000312883860.rsp /nologo"
    Creating temporary file "f:\LXY\test222\test222\Debug\BAT00000412883860.bat" with contents
    [
    @echo Manifest resource last updated at %TIME% on %DATE% &gt; .\Debug\mt.dep
    ]
    Creating command line "f:\LXY\test222\test222\Debug\BAT00000412883860.bat"
    </pre></table><table width=100% bgcolor=#DFDFE5><tr><td><font face=arial size=+2>
    Output Window
    </font></table><table width=* cellspacing=0 cellpadding=0><tr><td width=0 bgcolor=#EDEDF5>&nbsp;</td><td width=0 bgcolor=#FFFFFF>&nbsp;</td><td width=*><pre>Compiling...
    test222.c
    f:\lxy\test222\test222\test222.c(51) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
            d:\program files\microsoft visual studio 9.0\vc\include\string.h(74) : see declaration of 'strcpy'
    f:\lxy\test222\test222\test222.c(52) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
            d:\program files\microsoft visual studio 9.0\vc\include\string.h(74) : see declaration of 'strcpy'
    f:\lxy\test222\test222\test222.c(53) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
            d:\program files\microsoft visual studio 9.0\vc\include\string.h(74) : see declaration of 'strcpy'
    f:\lxy\test222\test222\test222.c(54) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
            d:\program files\microsoft visual studio 9.0\vc\include\string.h(74) : see declaration of 'strcpy'
    f:\lxy\test222\test222\test222.c(36) : warning C4101: 'intensityPerCent' : unreferenced local variable
    f:\lxy\test222\test222\test222.c(37) : warning C4101: 'j' : unreferenced local variable
    f:\lxy\test222\test222\test222.c(121) : warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
            d:\program files\microsoft visual studio 9.0\vc\include\stdio.h(237) : see declaration of 'fopen'
    Linking...
    Embedding manifest...
    </pre></table><table width=100% bgcolor=#DFDFE5><tr><td><font face=arial size=+2>
    Results
    </font></table><table width=* cellspacing=0 cellpadding=0><tr><td width=0 bgcolor=#EDEDF5>&nbsp;</td><td width=0 bgcolor=#FFFFFF>&nbsp;</td><td width=*><pre>Build log was saved at "file://f:\LXY\test222\test222\Debug\BuildLog.htm"
    test222 - 0 error(s), 7 warning(s)
    </pre></table><table   width=100% height=20 bgcolor=#CFCFE5><tr><td><font face=arial size=+2>
    </font></table></body></html>

     

    the number of patterns is 4, pattern bit-depth is 8,exposure time is 16000us, the log is also inserted.

    thank you~~

    -diao

  • Hi Diao,

    Actually I wanted to see the command line log i.e., after you built the executable when you run the exe from command line you will notice incase there are any API  call failures.

    The code compile log showing code is compiled without any errors that is fine to know. Please send us the command line log.

    Regards,

    sanjeev

  • Hi Sanjeev

    we have been working on it , but the problem still not sloved

    there is no error occured ,

    but the display stops at the first image (without single pass pattern before it, only one image )

    can you help us?

    Thank you ~~

    -diao

  • Hi Diao,

    Can you tell me indetail about the FrameRate, Camera Exposure Settings in the GUI?

    Also let me know the FrameTrigger(VSYNC) setting...

    Regards,

    Sanjeev

     

     

  • Hi 

    in the experiment now we are working at , we don't use camera to take image. 

    so , we didn't set FrameTrigger .

    And there is no Camera Exposure Settings.

    the projecting framerate is 50 fps.


    thank you ~~

    -diao 

  • Hello Diao,

    I didn't understand what you meant by 'we didn't set the Frame Trigger' is it default setting? i.e., Auto-Trigger.

    Again, same thing for Camera Exposure Setting, is it default value, for 50Hz in the LC GUI Control tool it shows a value 19994uSec. Is that correct?

    Can you zip and attach you Project?

    Regards,
    Sanjeev

     

  • Hello ~ 

    the camera exposure time (LED illumination time) we set is 16000 uSec, and framerate is 50 fps.

    this is our project .

    2677.test111.rar

    you really gave us a lot of help~~ 

    thank you so much~~

    -diao

  • Hi Diao,

    I debugged and found the root cause of the problem you are facing.

    The problem is basically with you are using older version of SDK or PortabilityLayer.lib and DLLs where there is no support for DLP_Display_DisplayPatternAutoStepForSinglePass () API.

    Please cross check the following the latest one is version

    1. LightCommander Control software Version# 1.0.92.495

    2. You can download the latest portability layer library from here DLPCR200API from here http://www.ti.com/tool/dlpr200 when you download the APIInstaller zip file date show DlpApiInstaller_2011_10_12 then it is the latest.

    Note that in the latest portability version uses following files - (The files build date show year 2011)

    PortabilityLayer.dll , USBlib.dll, and PortabilityLayer.lib

    The older portability layer version uses following files - (The file build date show year 2010)

    PortabilityLayer.dll, DlpCommDLL.dll, PortabilityLayer.lib

    Just download the latest API library from the link explained above and use these (PortabilityLayer.dll , USBlib.dll, and PortabilityLayer.lib) lib files to run your executable it will work.

    Let me know if you still face any problem.

    Regards,

    Sanjeev

     

  • Hello Sanjeev:

    sorry for asking a lot ~

    we download the latest lib files (PortabilityLayer.dll , USBlib.dll, and PortabilityLayer.lib)

    and renew it in our own project.

    but , unfortunately ,  

    the API function DLP_Display_DisplayPatternAutoStepForSinglePass () still not work .....

    it stay at the "repeat" mode.


    does our project work well in your computer?


    thank you!!

    -diao

  • Hi Diao,

    Yes I have verified again your test project, it works fine.

    When you build your application you will find that along test111.exe it copies the old DLLs PortabilityLayer.dll, USBlib.dll.

    Please delete them and add the new DLLs in the directory where test111.exe is created.

    Then run the exe it should work.

    One more IMPORTANT thing -

    In your attached test project, the code merely downloads the image files and make call to LED intensity function along with DLP_Display_DisplayPatternAutoStepForSinglePass() API.

    The other prior requirement is that the DLPC200 must be already configured to run the 8-bit grayscale structure light mode sequence with your specified exposure time. So prior to running your exe you can either

    a) Create a 8-bit grayscale strucuted light solution in the parallel flash so that upon power on it will be by default into the configurated state, so your exe will download image and call API to dispaly pattern sequence.

    b) Run a batch file from the LightCommander Control GUI and then call the exe

    Let me know if you still face any problem.

    Regards,

    Sanjeev

     

     

     

  • Hi Sanjeev:

    first , about the IMPORTANT thing you told us ,

    we checked it in LightCommander Control GUI ,

    it's  8-bit grayscale structure light mode and the exposure time is correct ,

    it is the default configurated state now.

    ////////////////////////////////////////////////////////

    following your instruction, we bulit the project , deleted the old DLL files , moved the new DLL files in.

    and , we encountered errors

    thank you !

    -diao

  • Hi Diao,

    It is evident that your MCU firmware is not upgraded to the latest.

    Goto this link and download the MCU firmware from here http://www.ti.com/tool/dlpr200 DLPR200F.

    Then download and install the firmware on your machine. Then using LC GUI tool update the firmware via Tools->Update Master Controller Program Memory ... Alt+C option.

    After upgrading power down and power the system. Read the system status via Help->About LightCommander Control and verify the MCU version is 2.1.6

    Now try to run your application it should work.

    Regards,

    Sanjeev

     

  • Hi Sanjeev!

     

    it finally works after we renewed the lib file , the firmware , the all thing.

    thank you so much!

    you gave us a lot of help

     

    can we have your e-mail?

    so the we can send "happy-new-year" e-mail to you~~ :)

     

    -diao

  • Hi Diao,

    Glad to know that you are able to go forward now. You don't need to thank so much it is our duty and we want to make sure you succeed whatever you are trying to achieve with the kit.

    Merry Christmas and New Year Wishes to you.

    Regards,

    Sanjeev

     

  • Hi Sanjeev:

    With your help , the DLP_Display_DisplayPatternAutoStepForSinglePass() works well 

    ////////////////////////////////////////////////

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

           if((rc = DLP_Display_DisplayPatternAutoStepForSinglePass()) != 0) {

               printf("ERROR running DisplayPatternAutoStepForSinglePass (ret code = %d)\n", (int)rc);

               return(1);     }

       }

    /////////////////////////////////////////////

    in the code above, 

    the Lightcommander projects 8 times of "single pass" .  it's ok~.

    but , when we want to change the LED lightness for each single pass

    it don't project the whole images. (LED lightness changing works well)

    it only displays one image when it should give a single pass

    /////////////////////////////////////////////

      intensityPerCent = 25.0;

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

           intensityPerCent+=2*i;

           DLP_LED_SetLEDintensity(2, intensityPerCent);

          

           if((rc = DLP_Display_DisplayPatternAutoStepForSinglePass()) != 0) {

               printf("ERROR running DisplayPatternAutoStepForSinglePass (ret code = %d)\n", (int)rc);

               return(1);   }

         }

    /////////////////////////////////////

    can you tell me where did we make mistake?

    thank you !

    -diao

  • Hi Diao,

    Sorry for delayed response. I was on vacation.

    You have not made any mistake. After the API call DLP_Display_DisplayPatternAutoStepForSinglePass() basically the pattern sequence display will be stopped but for the DLP_LED_SetLEDIntensity the pattern sequence must be running.

    You can follow below logic to make it work.

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    intensityPerCent = 25.0;

    for (i= 0;i<8;i++)   

    intensityPerCent+=2*i;

     //Disable the LED light output      
     DLP_LED_LEDdriverEnable(0);

     //This will ensure the LED PWM sequence is running continuously
     //This is required to modify the LED intensity
     if((rc = DLP_Display_DisplayPatternAutoStepRepeatForMultiplePasses()) != 0)
     {
               printf("ERROR running DLP_Display_DisplayPatternAutoStepRepeatForMultiplePasses ret code = %d)\n", (int)rc);
               return(1);  
     }

       
     
     //Update the LED Intenisty
     DLP_LED_SetLEDintensity(2, intensityPerCent);

          
    //Before enabling the LED Driver call single pass once otherwise directly enabling LED Driver causes patterns to be displayed since it is already running in MutliplePass Mode.
     if((rc = DLP_Display_DisplayPatternAutoStepForSinglePass()) != 0)
     {
               printf("ERROR running DisplayPatternAutoStepForSinglePass (ret code = %d)\n", (int)rc);
               return(1);  
     }

     //Enable the LED Light output
     DLP_LED_LEDdriverEnable(1); 
          
     //Call this 2nd time this will cause the projector display the patterns new intensity
     if((rc = DLP_Display_DisplayPatternAutoStepForSinglePass()) != 0)
     {
               printf("ERROR running DisplayPatternAutoStepForSinglePass (ret code = %d)\n", (int)rc);
               return(1);  
     }

     }

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////