2 Replies Latest reply on Dec 29, 2017 3:20 AM by bob.marlowe

    PSoC question

    jaseelaka945_2746661

      Hello everyone;

                             I am writing smartcard using i2c communication in PSoC 3. when  debugging code i got the following error . such as syntax error near uint8. Actually uint8 is a valid data types in psoc  compiler.other error is ``buffer"  undefined identifier .but buffer is already defined.  why it show like this.  I searched internet about this error but i can't get answer.. Please help me .

       

       

      main.c

       

       

      #include "project.h"

      #include "I2C.h"

       

       

      uint8 a,zone;

       

       

       

       

      int main(void)

       

       

      {

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

      {

        uint8 set(uint8 address, uint8 *Data,uint8 Num);

       

       

       

       

       

       

      }

      CyGlobalIntEnable;

       

       

      }

       

       

      uint8 set(uint8 address, uint8 *Data, uint8 Num)

       

       

      {

      Num=3;

      address=0xB0;

       

       

         

      if(zone==0)

      {

            uint8 buffer[]={03,00,00};

            Data=buffer;

              

      }

         else if(zone==1)

         

          for(a=0;a<3;a++)

          {

              Data[a]=0;

            

          }

       

       

          uint8 buffer[]={03,01,00};//syntax error near 'uint8'

          Data=buffer;

         

      }

        else if(zone==2)

      {

           for(a=0;a<3;a++)

          {

              Data[a]=0;

             

          }

       

       

          uint8 buffer[]={03,02,00};//syntax error near 'uint8'

          Data=buffer;//undefined identifier

         

      }

         

          else if (zone==3)

          {

              for(a=0;a<3;a++)

          {

             Data[a]=0;

          }

          uint8 buffer[]={03,03,00};//syntax error near 'uint8'

          Data=buffer;//undefined identifier

         

         

         }

          else

          {

          }

              return 0;

         

      uint8 I2C_Send(uint8 address,uint8 *Data,uint8 Num);//syntax error near 'uint8'

       

       

       

       

      uint8 writezone(uint8 address,uint8 *Data,uint8 Num);

      }

       

       

      uint8 writezone(uint8 address ,uint8 *Data,uint8 Num)

      {

      address=0xB4;

              if(zone==0)

              {

                  Num=8;

                

          for(a=0;a<3;a++)

          {

              Data[a]=0;

          }

       

       

           uint8 buffer[]={00,00,05,00,07,03,04,03};

          Data=buffer;

              }

          

        else if(zone==1)

      {

           Num=0;

          Num=7;

          for(a=0;a<8;a++)

          {

              Data[a]=0;

          }

          uint8 buffer[]={00,00,04,00,07,03,05};

          Data=buffer;

      }

          else if(zone==2)

          {

           Num=0;

           Num=6;

              for(a=0;a<7;a++)

          {

              Data[a]=0;

          }

            uint8 buffer[]={00,00,03,00,65,73};

             Data=buffer;

          }

          else if(zone==3)

          {

              Num=0;

              Num=5;

               for(a=0;a<6;a++)

          {

              Data[a]=0;

          }

           uint8 buffer[]={00,00,02,74,76};

          Data=buffer;

          }

        

              else

          {

          }

              return 0;

         

         

         

          uint8 I2C_Send(uint8 address,uint8 *Data,uint8 Num);

          uint8 Readzone(uint8 address,uint8 *Data,uint8 Num);

      }

               

      uint8 Readzone(uint8 address,uint8 *Data , uint8 Num)

      {

      address=0xB2;

          Num=3;

         

          if(zone==0)

          {

          

           for(a=0;a<8;a++)

          {

              Data[a]=0;

          }

         

          uint8 buffer[]={00,00,05};

          Data=buffer;

          }

         

         

          else if(zone==1)

          {

           for(a=0;a<7;a++)

          {

              Data[a]=0;

          }

           uint8 buffer[]={00,00,04};

          Data=buffer;

            } 

           else if(zone==2)

          {

           for(a=0;a<6;a++)

          {

              Data[a]=0;

          }

           uint8 buffer[]={00,00,03};

          Data=buffer;

            } 

                

             else if(zone==3)

          {

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

          {

              Data[a]=0;

          }

           uint8 buffer[]={00,00,02};

          Data=buffer;

            }

              else

          {

          }

              return 0;

          uint8 I2C_Read(uint8 address,uint8 *Data, uint8 Num);