5 Replies Latest reply on Dec 24, 2012 1:19 AM by rajivb_36

    How to use API's functions

    user_254088674

       this is my program

         

       

         

       

         

       

         

      #include <m8c.h>        // part specific constants and macros

         

      #include "PSoCAPI.h"    // PSoC API definitions for all User Modules

         

      void main(void)

         

      {

         

      // M8C_EnableGInt ; // Uncomment this line to enable Global Interrupts

         

      // Insert your main routine code here.

         

      PGA_SetGain(PGA_1_G8_00);

         

           PGA_Start(PGA_1_MEDPOWER);

         

      }

         

      and this is my errors

         

       

         

      !W C:\Users\hai\DOCUME~1\PSOCDE~1.3PR\PDPROJ~4\PDPROJ~1\main.c(14):[warning] [MISRA 2200]calling an undeclared function may cause unexpected behavior if the function 

         

      takes or returns values other than int

         

      !W C:\Users\hai\DOCUME~1\PSOCDE~1.3PR\PDPROJ~4\PDPROJ~1\main.c(14):[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function 

         

      takes or returns values other than int

         

      !W C:\Users\hai\DOCUME~1\PSOCDE~1.3PR\PDPROJ~4\PDPROJ~1\main.c(15):[warning] [MISRA 2200]calling an undeclared function may cause unexpected behavior if the function 

         

      takes or returns values other than int

         

      !W C:\Users\hai\DOCUME~1\PSOCDE~1.3PR\PDPROJ~4\PDPROJ~1\main.c(15):[warning] [MISRA 2714]calling a function without prototype may cause unexpected behavior if the function 

         

      takes or returns values other than int

         

      ./boot.asm

         

      Linking..

         

      LMM info: area 'virtual_registers' uses 2 bytes in SRAM page 0

         

      !ERROR {linker} file 'main.o': undefined symbol '_PGA_SetGain'

         

      !ERROR {linker} file 'main.o': undefined symbol '_PGA_Start'

         

      make: *** [output/PDProject4.rom] Error -1

        • 1. Re: How to use API's functions
          ki.leung

           post your project here, it would be better if we can see the whole project,

          • 2. Re: How to use API's functions
            user_1377889

            Probably you have made a naming-error of your user-module.Make sure, that your Amplifier is named "PGA" and not "PGA_1"

               

             

               

            Bob

            • 3. Re: How to use API's functions
              user_14586677

              It looks like you have accepted the default name of PGA_1_...., so

                 

              last line of code should be changed from

                 

               

                 

              PGA_Start(PGA_1_MEDPOWER);

                 

               

                 

              to

                 

               

                 

              PGA_1_Start(PGA_1_MEDPOWER);

                 

               

                 

              Regards, Dana.

              • 4. Re: How to use API's functions
                user_14586677

                And change

                   

                 

                   

                PGA_SetGain(PGA_1_G8_00);

                   

                 

                   

                to

                   

                 

                   

                PGA_1_SetGain(PGA_1_G8_00);

                   

                 

                   

                Regards, Dana.

                • 5. Re: How to use API's functions
                  rajivb_36

                  PSoC Designer allows multiple instances of user module to placed in the design, if sufficient analog/digital blocks is available. Instance name of the user module includes a number which gets incremented everytime you place the module in the design. For example, the first time you place the PGA user module in the project, it will be named as PGA_1. The second time, it will be PGA_2 and so on.

                     

                  In the firmware, to refer to particular instance of the user module, you should use appropriate name. To understand the code flow, you can refer the user module datasheet. But you should use the APIs given in header (.h) file to configure/use the particular instance of the user module. Note that .asm and .h file for a particular user module instance appends to the designer project (and can be seen in workspace), when you "generate" the project.

                     

                   

                     

                  -Rajiv Badiger