/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / LCD scrolling

Username:     
Password:     
             

Forum

# 1   2011-06-17 12:15:09 LCD scrolling

hanawa@ieee.org
New member
Registered: 2010-06-24
Posts: 3

LCD scrolling

Does somebody give me an advice on LCD scrolling with Primer2?

I checked the datasheet of ST7732 LCD controller.
I also checked the well-known ECG project given by jingxizhang.
According to the datasheet, I tried to scroll the LCD on my Primer2 as follows,

Code:

    LCD_SendLCDCmd(0x33);          // define scroll area
    LCD_SendLCDData(40);             // Top Fixed Area (TFA)
    LCD_SendLCDData(120);            // Vertical Scroll Area (VSA)
    LCD_SendLCDData(0);                // Bottom Fixed Are (BFA)

    LCD_SendLCDCmd(0x37);           // Vertical Scroll Start Address
    LCD_SendLCDData(5);                // scroll

I expected to scroll down 5 pixels, but nothing happened.
What's wrong? Any comments are welcome including a better scrolling method on Primer2.

Thanks,

Offline

 

# 2   2011-06-18 10:19:11 LCD scrolling

hanawa@ieee.org
New member
Registered: 2010-06-24
Posts: 3

Re: LCD scrolling

As I carefully watched the behavior of my primer2 LCD, it seemed that the scrolling was done but it was overwritten. For example, when I printed a string on the LCD, and repeated the above code, I saw a shadow? of the scrolled string. Thus I have guessed that  the CircleOS overwrote the LCD.

Does somebody know how to solve this situation? I want to use CircleOS for ease of my application development. Any advises are greatly appreciated.

Offline

 

# 3   2011-06-20 13:56:14 LCD scrolling

hanawa@ieee.org
New member
Registered: 2010-06-24
Posts: 3

Re: LCD scrolling

I could  solve the above problem by myself. It was because of my misunderstanding on the LCD controller ST7732 in Primer2. The following is a part of my source code. By adding dummy data, I could scroll the screen.

Code:

enum MENU_code Application_Ini(void)
    {
    // Ensure that the current OS version is recent enough
    if(strcmp(UTIL_GetVersion(), NEEDEDVERSION) < 0)
        {
        return MsgVersion();
        }

    
    LCD_SendLCDCmd(ST7732_NORON);              // NORmal mode ON
    LCD_SendLCDCmd(ST7732_MADCTL);             // Memory data access control
    LCD_SendLCDData(0x01<<4);                  // ML=1
    
    // Set Scroll Area using SCRLAR(33h) command of ST7732 LCD driver
    LCD_SendLCDCmd(ST7732_SCRLAR);             // define scroll area
    LCD_SendLCDData(0);                        // dummy
    LCD_SendLCDData(TFA);                      // Top Fixed Area (TFA)
    LCD_SendLCDData(0);                        // dummy
    LCD_SendLCDData(VSA);                      // Vertical Scroll Area (VSA)
    LCD_SendLCDData(0);                        // dummy
    LCD_SendLCDData(BFA);                      // Bottom Fixed Are (BFA)
    // See ST7732 Datasheet for detail
    // TFA+VSA+BFA must be equal to 160 (see p.76, 9.10.5.1 of the datasheet)

    //Draw my square
    LCD_DrawRect( x, y, SQUARE_WIDTH, SQUARE_WIDTH/2, RGB_BLUE);
    LCD_FillRect( x+1, y+1, SQUARE_WIDTH-2, SQUARE_WIDTH/2-2, RGB_YELLOW);    
    
    return MENU_CONTINUE_COMMAND;
    }

enum MENU_code Application_Handler(void)
    {
    
    if(JOYSTICK_GetState()==JOYSTICK_UP) {

      scrollOffset-=DISPLAY_BUFF_INCREMENT;
      if( scrollOffset <= 0)
         scrollOffset += VSA;

      // scroll down
      LCD_SendLCDCmd(ST7732_VSCSAD);                // Vertical Scroll Start Address
      LCD_SendLCDData(0);                           // send a dummy data for param1
      LCD_SendLCDData(VSA+TFA+BFA-scrollOffset);    // send the param2 of VSCSAD
    }
    if(JOYSTICK_GetState()==JOYSTICK_DOWN) {

      scrollOffset+=DISPLAY_BUFF_INCREMENT;
      if( scrollOffset >= VSA)
         scrollOffset -= VSA;

      // scroll down
      LCD_SendLCDCmd(ST7732_VSCSAD);                // Vertical Scroll Start Address
      LCD_SendLCDData(0);                           // send a dummy data for param1
      LCD_SendLCDData(VSA+TFA+BFA-scrollOffset);    // send the param2 of VSCSAD
    }
    
    // If the button is pressed, the application is exited
    if(BUTTON_GetState() == BUTTON_PUSHED)
        {
        BUTTON_WaitForRelease();
        BUTTON_SetMode( BUTTON_ONOFF_FORMAIN );
        return MENU_Quit();
        }

    return MENU_CONTINUE;   // Returning MENU_LEAVE will quit to CircleOS
    }

Last edited by hanawa@ieee.org (2011-06-20 14:24:09)

Offline

 

Board footer