cancel
Showing results for 
Search instead for 
Did you mean: 

ADC with STEmwin Generated code

NEERAJ GUPTA
Associate II
Posted on August 01, 2017 at 10:31

Dear all,

              i need to monitor ADC & display the value continuously in Text box using STEmwin Generated code. My ADC driver, handling for low threshold & high threshold value is working correctly as per testing done so far but i don't know how to integrated the ADC on STEmwin Generated code. What are the basic steps to achieve this? Please! give me the required guidance.         

1 REPLY 1
NEERAJ GUPTA
Associate II
Posted on August 04, 2017 at 08:50

Nobody has replied so far, anyway i have solved my problem partially but not fully.

Now the only problem remaining is screen is flickering when the code is written like this:

void MainTask(void)

{

    int temperature = 0;

    WM_HWIN hDialog;

  WM_HWIN hItem;

  //unsigned char te;

    GUI_Clear();

    WM_SetDesktopColor(GUI_BLACK);

    hDialog = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);

    

  //GUI_ExecDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);

    //GUI_ExecCreatedDialog(hDialog);

    while(1)

    {

     //te=temperature_handling();

     //if(te==1)

     //{

        

        temperature=tempCalculate();  

        temperature=temperature/4;

        num_to_string(temperature);    

      hItem = WM_GetDialogItem(hDialog, ID_TEXT_1);

    TEXT_SetText(hItem, (const char*) string);

            

   //}

   //if(te==0)

     //{

     // hItem = WM_GetDialogItem(hDialog, ID_TEXT_1);

   // TEXT_SetText(hItem, '         ');    

   //}        

     //GUI_Delay(250);

     GUI_Exec();     

    }

}

When i use function GUI_CreateDialogBox screen begins to flicker but it able to get values continuously from ADC. 

When i use function GUI_ExecDialogBox screen gets stable but it is not able to get values continuously from ADC.

How to achieve stable Screen with ADC values? Please! help me regarding this.