How to use API's functions

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

 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

0 Likes
5 Replies
Anonymous
Not applicable

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

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

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.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

And change

   

 

   

PGA_SetGain(PGA_1_G8_00);

   

 

   

to

   

 

   

PGA_1_SetGain(PGA_1_G8_00);

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

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 

0 Likes