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.

DLP4500: Creating pattern sequence using C++

Part Number: DLP4500
Other Parts Discussed in Thread: DLPC350

How do i duplicate the setting of the pattern sequence in the GUI using the GUI source code.

I have successfully established connected the LightCrafter to my laptop via visual studio however i have issues writing the code to set up the correct pattern sequence.  I understand that there are a whole lot of functions available in the DLPC350_api.cpp file and i can access this functions, but i'm unsure of what sequence or what functions i have to use to set the pattern sequence. 

My questions are as follows:

1) Currently the firmware loaded in my LightCrafter have 3 images (Index 0 , 1, 2) in the flash memory.

Do i simply use the function : DLPC350_AddPatToLut(TrigType, PatNum, BitDepth, LEDSelect, InvertPat, InsertBlack, BufSwap, trigOutPrev) where PatNum is the index refers to the image index on my firmware? And repeat this 3 times to add 3 images into my pattern sequence? 

2) What is the difference between ImageLut and PatternLut ? 

3) How do i set the pattern configuration using DLPC350_SetPatternConfig(numLutEntries, repeat, numPatForTrigOut2, numImages) 

If i am displaying 3 images in the pattern, does this mean that the parameter numLutEntries = 3, numPatForTrigOut2 =3 . 

4)What i am trying to achieve in the end is :

Connect to LC - Set to pattern sequence mode - Set pattern sequence - Display pattern - disconnect from LC. 

Can some one point out to me which functions to use to set a simple pattern sequence? 

Your help is much appreciated,

Alvin

  • Alvin,

    Thanks for your inquiry. I just forwarded this thread to one of our engineers who is familiar with the LightCrafter 4500 source code. Please expect a response in due course.

    Best Regards,
    Philippe Dollo
  • Alvin,

    Have written sample example function to setup the pattern sequence mode, you can use the same and update as required.

    static int Demo_PatternSequence()

    {

    unsigned char data[2];

    unsigned int valStatus;

    //Test of pattern Sequence Mode

    if(DLPC350_SetMode(true) < 0)

    {

    DEBUG_ERR("DLPC350_SetMode() failed\n");

    return -1;

    }

    if(DLPC350_SetPatternDisplayMode(false) < 0)

    {

    DEBUG_ERR("DLPC350_SetPatternDisplayMode() failed\n");

    return -1;

    }

    if(DLPC350_PatternDisplay(0)<0)

    {

    DEBUG_ERR("DLPC350_PatternDisplay() failed\n");

    return -1;

    }

    if(DLPC350_SetPatternTriggerMode(1) < 0)

    {

    DEBUG_ERR("DLPC350_SetPatternTriggerMode() failed\n");

    return -1;

    }

    if(DLPC350_SetPatternConfig(6,true,6,2)<0)

    {

    DEBUG_ERR("DLPC350_SetPatternConfig() failed\n");

    return -1;

    }

    if(DLPC350_SetExposure_FramePeriod(500000,500000) < 0)

    {

    DEBUG_ERR("DLPC350_SetExposure_FramePeriod() failed\n");

    return -1;

    }

    DLPC350_ClearPatLut();

    //DLPC350_AddToPatLut(int TrigType, int PatNum,int BitDepth,int LEDSelect,bool InvertPat, bool InsertBlack,bool BufSwap, bool trigOutPrev)

    if(DLPC350_AddToPatLut(0,0,8,1,false,true,true,false)<0)

    {

    DEBUG_ERR("0 - DLPC350_AddToPatLut() failed\n");

    return -1;

    }

    if(DLPC350_AddToPatLut(0,1,8,2,false,true,false,false)<0)

    {

    DEBUG_ERR("1 - DLPC350_AddToPatLut() failed\n");

    return -1;

    }

    if(DLPC350_AddToPatLut(0,2,8,4,false,true,false,false)<0)

    {

    DEBUG_ERR("2 - DLPC350_AddToPatLut() failed\n");

    return -1;

    }

    if(DLPC350_AddToPatLut(0,0,8,1,false,true,true,false)<0)

    {

    DEBUG_ERR("3 - DLPC350_AddToPatLut() failed\n");

    return -1;

    }

    if(DLPC350_AddToPatLut(0,1,8,2,false,true,false,false)<0)

    {

    DEBUG_ERR("4 - DLPC350_AddToPatLut() failed\n");

    return -1;

    }

    if(DLPC350_AddToPatLut(0,2,8,4,false,true,false,false)<0)

    {

    DEBUG_ERR("5 - DLPC350_AddToPatLut() failed\n");

    return -1;

    }

    if(DLPC350_SendPatLut()<0)

    {

    DEBUG_ERR("DLPC350_SendPatLut() failed\n");

    return -1;

    }

    //Send image LUT

    data[0] = 0x01;

    data[1] = 0x02;

    if(DLPC350_SendImageLut(&data[0],2)<0)

    {

    DEBUG_ERR("DLPC350_SendImageLut() failed\n");

    return -1;

    }

    //Validate data

    if(DLPC350_ValidatePatLutData(&valStatus)<0)

    {

    DEBUG_ERR("DLPC350_ValidatePatLutData() failed\n");

    return -1;

    }

    if(valStatus)

    {

    DEBUG_ERR("Pat Seq Validation failed\n");

    return -1;

    }

    else if(DLPC350_PatternDisplay(2)<0)

    {

    DEBUG_ERR("DLPC350_PatternDisplay(2) failed\n");

    return -1;

    }

    else

    {

    printf("Hit any key to contiue...\n");

    getchar();

    if(DLPC350_PatternDisplay(0)<0)

    {

    DEBUG_ERR("DLPC350_PatternDisplay(0) failed\n");

    return -1;

    }

    }

    return 0;

    }