Digole
Digital Solutions
iDigole Buyer ProtectioniDigole Buyer
Protection
My shopping cart
0 Items:
Secure Checkout
Top Rated Plus
Visit Our Live Auctions
99.9% Customer's Satisfaction
 
Forum : Digole Serial Display :

 Search Forum.. 
 Creat New Topic   Reply 

Updating Text on Screen While Image is Displayed

 I'm working on a project with 160x128 true color OLED screen.  I have an image that I'm using as a banner to display across the top of the screen, and I want to update text periodically below that image (see diagram below) using the Text Position command.

-------------------------------------------------------------------------------
| PRINT SOME TEXT HERE |
|----------------------------------------------------------------------------- |
BANNER DISPLAY HERE |
|----------------------------------------------------------------------------- |
| |
| UPDATE THIS TEXT |
| |
| |
-------------------------------------------------------------------------------

Currently, I can print text, then print the image, but I can't seem to get any text to update.

I'm using the EDIM3 command, and I've verified that I'm terminating it by sending a carriage return (I'm communicating over UART).

Is there any reason why I shouldn't be able to edit specific characters after I draw an image?

 

RE:Updating Text on Screen While Image is Displayed

 It possible because of the receiving buffer in display module overflowed, it has 1K bytes buffer in it, if you sending too much data to it at once, the buffer could be overflowed.

Could you please post your code to us, then we can help you to figure it out.

Thanks for using our display on your projects.

RE:Updating Text on Screen While Image is Displayed

 Thanks for the reply, my code is below.  This is on one of Microchip's PIC32 devices.  The functions below are simply wrappers for the commands specified in the Digole manual.

 

    PPSOutput(1, RPB4, U1TX);                                                        //Configure UART modules on PIC32

    PPSOutput(4, RPC9, U2TX);

    UNG_UART_Configure(UART1, UART_CONFIG, UART_LINE_CONTROL, DESIRED_BAUD, UART_ENABLE);

    UNG_UART_Configure(UART2, UART_CONFIG, UART_LINE_CONTROL, DESIRED_BAUD, UART_ENABLE);

    UNG_DIG_SetBaud(1, 115200);                        //Update Baud rate on digole screen

    UNG_DIG_SetBaud(2, 115200);

 

    UARTSetDataRate(UART1, (SYS_FREQ/(1 << OSCCONbits.PBDIV)), 115200);     //Update baud rate on PIC32

    UARTSetDataRate(UART2, (SYS_FREQ/(1 << OSCCONbits.PBDIV)), 115200);

 

    UNG_DIG_ToggleCursor(1, OFF);                                               //Format OLED screens

    UNG_DIG_ToggleCursor(2, OFF);

    UNG_DIG_ClearScreen(1);

    UNG_DIG_ClearScreen(2);

    iDirection1 = UNG_DIG_RotateScreen(1, 1);

    iDirection2 = UNG_DIG_RotateScreen(2, 1);

    UNG_DIG_SetFont(1, 18);

    UNG_DIG_SetFont(2, 18);

 

    UNG_DIG_PrintString(1, psP2);                                                                                         //Print persistent strings

    UNG_DIG_NewLine(1, 1);

    UNG_DIG_PrintString(1, psVbus);

    UNG_DIG_NewLine(1, 1);

    UNG_DIG_PrintString(1, psIbus);

    UNG_DIG_NewLine(1, 6);

    UNG_DIG_PrintString(1, psP1);

    UNG_DIG_NewLine(1, 1);

    UNG_DIG_PrintString(1, psVbus);

    UNG_DIG_NewLine(1, 1);

    UNG_DIG_PrintString(1, psIbus);

 

    UNG_DIG_PrintString(2, psCP);

    UNG_DIG_NewLine(2, 1);

    UNG_DIG_PrintString(2, psVbus);

    UNG_DIG_NewLine(2, 1);

    UNG_DIG_PrintString(2, psIbus);

    UNG_DIG_NewLine(2, 6);

    UNG_DIG_PrintString(2, psPO);

    UNG_DIG_NewLine(2, 1);

    UNG_DIG_PrintString(2, psVbus);

    UNG_DIG_NewLine(2, 1);

    UNG_DIG_PrintString(2, psIbus);

 

    UNG_DIG_DrawImg(1, 0, 68, 128, 24, puiLogoLeft, sizeof uiLogoLeft);                                   //draw images

    UNG_DIG_DrawImg(2, 0, 68, 128, 24, puiLogoRight, sizeof uiLogoRight);

 

    while ( ! mAD1GetIntFlag() ) { }                                            //Wait for the first conversion to complete so there will be vaild data in ADC result registers

 

    while (1)

    {

        UNG_Wait(200);

 

        iCh5 = ReadADC10(0);                                                    //Read the result of channel 5 conversion from the idle buffer (Port1)

        iCh6 = ReadADC10(1);                                                    //Read the result of channel 6 conversion from the idle buffer (Port2)

        iCh7 = ReadADC10(2);                                                    //Read the result of channel 7 conversion from the idle buffer (C/P - Host)

        iCh8 = ReadADC10(3);                                                    //Read the result of channel 8 conversion from the idle buffer (PO - Type C)

 

        fCh5 = (float)iCh5;                                                     //Convert channel reads to float values

        fCh6 = (float)iCh6;

        fCh7 = (float)iCh7;

        fCh8 = (float)iCh8;

 

        fFrac5 = fCh5 / fDenom;                                                 //Determine fractional value of channel read

        fFrac6 = fCh6 / fDenom;

        fFrac7 = fCh7 / fDenom;

        fFrac8 = fCh8 / fDenom;

 

        fRes5 = fFrac5 * fVmax * 1.5;                                           //Scale results back to expected ranges

        fRes6 = fFrac6 * fVmax * 1.5;

        fRes7 = fFrac7 * fVmax * 8;

        fRes8 = fFrac8 * fVmax * 8;

 

        UNG_DIG_PlaceCursor(1, 8, 1);                                           //Print values to screen in appropriate places

        UNG_DIG_PlaceCursor(2, 8, 1);

        UNG_DIG_PrintFloat(1, fRes6, 1);

        UNG_DIG_PrintString(1, psV);

        UNG_DIG_PrintFloat(2, fRes7, 1);

        UNG_DIG_PrintString(2, psV);

        UNG_DIG_PlaceCursor(1, 8, 9);

        UNG_DIG_PlaceCursor(2, 8, 9);

        UNG_DIG_PrintFloat(1, fRes5, 1);

        UNG_DIG_PrintString(1, psV);

        UNG_DIG_PrintFloat(2, fRes8, 1);

        UNG_DIG_PrintString(2, psV);

}

 

Below are the actual functions used above.  The PIC32 is able to be configured so that using the standard c printf() function can send data to the UART.  This doesn't work all the time though.

 

 

void UNG_DIG_ClearScreen(int iModule)

{

    __XC_UART = iModule % 2 ? 1 : 2;

 

    printf("CL\r");

}

 

void UNG_DIG_PrintFloat(int iModule, float fValue, int iPrecision)

{

    __XC_UART = iModule % 2 ? 1 : 2;

 

    if(iPrecision > 3) iPrecision = 3;

    

    if(iPrecision == 1) printf("TT%.1f", fValue);

    else if(iPrecision == 2) printf("TT%.2f", fValue);

    else if(iPrecision == 3) printf("TT%.3f", fValue);

    printf("\r");

}

void UNG_DIG_PrintString(int iModule, char *pString)

 

 {

    __XC_UART = iModule % 2 ? 1 : 2;

 

    printf("TT%s", pString);

    printf("\r");

}

 

void UNG_DIG_NewLine(int iModule, int iNumLines)

{

    int i;

    __XC_UART = iModule % 2 ? 1 : 2;

 

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

    {

        printf("TRT\r");

    }

}

void UNG_DIG_ToggleCursor(int iModule, int iState)

 

{

    __XC_UART = iModule % 2 ? 1 : 2;

 

    printf("CS%d", iState);

    printf("\r");

}

int UNG_DIG_RotateScreen(int iModule, int iDirection)

 

{                                                                               

    __XC_UART = iModule % 2 ? 1 : 2;

 

    printf("SD%d", iDirection);

    printf("\r");

 

    return iDirection;

}

void UNG_DIG_SetFont(int iModule, int iSize)                                  //This function is an instance when the standard printf() functionality didn't seem to work

 

{

    UART_MODULE eModule;

    int i, iSizeIndex;

 

    __XC_UART = iModule % 2 ? 1 : 2;

    eModule = iModule % 2 ? UART1 : UART2;

 

    UINT8 uiSizes[] = {0x00, 0x06, 0x0A, 0x12, 0x33, 0x78, 0x7B};

 

    if(iSize <= 3) iSizeIndex = 0;

    else if(iSize > 3 && iSize <=8) iSizeIndex = 1;

    else if(iSize > 8 && iSize <= 14) iSizeIndex = 2;

    else if(iSize > 14 && iSize <= 35) iSizeIndex = 3;

    else if(iSize > 35 && iSize <= 85) iSizeIndex = 4;

    else if(iSize > 85 && iSize <= 121) iSizeIndex = 5;

    else if(iSize > 121) iSizeIndex = 6;

    else iSizeIndex = 0;

 

    UINT8 uiCmd[] = {0x53, 0x46, uiSizes[iSizeIndex], 0x0D};

 

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

    {

        while(!UARTTransmitterIsReady(eModule));

        UARTSendDataByte(eModule, uiCmd[i]);

    }

}

 

void UNG_DIG_PlaceCursor(int iModule, int iCol, int iRow)                                //Again, printf() didn't seem to work with this command

{

    UART_MODULE eModule;

    int i;

    UINT8 uiCols[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,

        0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0F};

    UINT8 uiRows[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,

        0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0F};

    UINT8 uiCmd[] = {0x54, 0x50, uiCols[iCol], uiRows[iRow], 0x0D};

 

    __XC_UART = iModule % 2 ? 1 : 2;

    eModule = iModule % 2 ? UART1 : UART2;

 

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

    {

        while(!UARTTransmitterIsReady(eModule));

        UARTSendDataByte(eModule, uiCmd[i]);

    }

}

void UNG_DIG_DrawImg(int iModule, int iCol, int iRow, int iWidth, int iHeight, UINT8 *puiData, int iDataSize)

{

    UART_MODULE eModule;

    int i, j;

    UINT8 uiCmd[] = {0x00, 0x44, 0x80, 0x18};

    UINT8 uiEnd = 0x0D;

 

    __XC_UART = iModule % 2 ? 1 : 2;

    eModule = iModule % 2 ? UART1 : UART2;

 

    printf("EDIM3");

 

    for(i = 0; i < sizeof uiCmd; i++)

    {

        while(!UARTTransmitterIsReady(eModule));

        UARTSendDataByte(eModule, uiCmd[i]);

    }

    for(j = 0; j < iDataSize; j++)

    {

        while(!UARTTransmitterIsReady(eModule));

        UARTSendDataByte(eModule, puiData[j]);

    }

    printf("\r");

}

void UNG_DIG_SetBaud(int iModule, int iBaud)

 

{

    __XC_UART = iModule % 2 ? 1 : 2;

 

    printf("SB%d", iBaud);

    printf("\r");

}

 

RE:Updating Text on Screen While Image is Displayed

 Your code looks OK, but just wondering the delay time in the while(1) loop, please try:

1) remove while(1), just let the program run one time, and see if the data displayed OK?

2) add more time delayed in: UNG_Wait(); and see what happened.

 

 

RE:Updating Text on Screen While Image is Displayed

 I removed the while loop and increased the wait between the image draw and the second text print.  I don't see any change in the behavior though.

Is there anything else I can try?

RE:Updating Text on Screen While Image is Displayed

Hi Dear,

This is Victor, I had our technician to design a routine on the Arduino according to your program, and can not duplicate the problem as you described, I think the whole progress of your program are good, but there may be bugs in detail, I suggest you:

Replace the ADC value which you want to display with a fixed or counting value to see if that work?

Thanks!

Copyright Digole Digital Solutions, 2008-2017. All rights reserved.
Powered by Victor Sun