13 Replies Latest reply on Oct 6, 2014 11:20 AM by srinivas.prasad

    I need help

    clemente.benavente.prez

       

         

       Hi, I do not speak English very well, sorry :(.

      I want that the display change when i press the button. I have got three menus for show in display. But when i press the buttom, the display dont change. I dont know where is the error.   

       

         

      My program in C:

         

       

         

      ----------------------------------------------------------------------------------------------

         

       

         

      #include <m8c.h>        

         

      #include "PSoCAPI.h"    

         

      #include "Stdlib.h"

         

      #include "m8c.h"

         

      #include "math.h"

         

       

         

      int cadena;

         

      float datos;

         

      int t;

         

      int menu;

         

      int aux;

         

       

         

      void main(void)

         

      {

         

       

         

          M8C_EnableGInt;

         

      PGA_Start(PGA_HIGHPOWER);

         

      ADCINC_Start(ADCINC_HIGHPOWER);

         

      ADCINC_GetSamples(0);

         

      Character_LCD_Start();               

         

             

         

      while(1)

         

          //infinite loop.

         

      {

         

       

         

      if(menu==3){

         

      menu=0;

         

      }

         

       

         

      switch(menu){

         

      case 0:

         

      if (ADCINC_fIsDataAvailable() != 0){    

         

      if ((ADCINC_bGetData() <= 255)&&(ADCINC_bGetData() >0)){

         

      AMUX4_1_InputSelect(AMUX4_1_PORT0_7); 

         

                      datos=(float)ADCINC_wGetData()*5/255;

         

      a=datos*100;

         

      datos=floor(a);

         

      datos=datos/100;

         

      Character_LCD_Init();                           

         

      for(t=0;t<50;t++){

         

      Character_LCD_Position(1,2);               

         

      Character_LCD_PrString(ftoa(datos,&cadena));

         

      Character_LCD_Position(1,6);

         

      Character_LCD_PrCString("      ");

         

      Character_LCD_Position(1,12);

         

      Character_LCD_PrCString("V");

         

      Character_LCD_Position(0,1);

         

      Character_LCD_PrCString("Selector 1:");

         

      }

         

      ADCINC_fClearFlag();                            

         

      }

         

      }

         

      break;

         

       

         

      case 1:

         

      for(t=0;t<50;t++){

         

      Character_LCD_Position(0,1);

         

      Character_LCD_PrCString("Temperatura");

         

      Character_LCD_Position(1,1);

         

      Character_LCD_PrCString("Temperatura de referencia:");

         

      }

         

      ADCINC_fClearFlag();

         

      break;

         

       

         

      case 2:

         

      for(t=0;t<50;t++){

         

      Character_LCD_Position(0,1);

         

      Character_LCD_PrCString("Configuracion:");

         

      }

         

      ADCINC_fClearFlag(); 

         

      break;

         

      }

         

      aux=PRT0DR&&0x01;

         

      if(aux!=0&&x==0){

         

      menu=menu++;

         

      x=1;

         

      }else if(aux==0&&x==1){

         

      x=0;

         

      }

         

      if(menu==3)menu=0;

         

      }

         

       

         

      }

         
          ---------------------------------------------------------------------------------------------   
         
              
         
          I am trying things with psoc for a asignature of university.  The program is very simple but I'm learning to use PSoC.   
         
              
         
          Is the PSoC 1.   
         
              
         
          Thanks!