Strictly necessary cookies are on by default and cannot be turned off. Functional, Performance and Tracking/targeting/sharing cookies can be turned on below based on your preferences (this banner will remain available for you to accept cookies). You may change your cookie settings by deleting cookies from your browser. Then this banner will appear again. You can learn more details about cookies HERE.
Strictly necessary (always on)
Functional, Performance and Tracking/targeting/sharing (default off)
I want to create a file into main.c to save some SIgDeltaADC values.
I wrote the typical C code to create a file but this compiler seems not to identify
I get and error in the instruction:
The compiler sais: undefined identifier.
The code is:
<device.h><math.h><stdio.h>main()int result,i;/* Place your initialization/startup code here (e.g. MyInst_Start()) *//* CYGlobalIntEnable; *//* Uncomment this line to enable global interrupts. */"primeros.dat", "wb");for(i=0;i<10;i++)sizeof(int), 1, fp);/*for*//*main*/
There isn't a file system on the PSoC 3 system that you are using, so the whole concept of File IO is not defined. Since you are interested in writing to a file, the most likely alternative is to use a communication interface to send data out of the device. The simpliest is likely the UART.
So if you put a UART into your design, then you can write to that UART and have a PC or other device recieve the data.
If you want standard C formatting routines, those are supported by the Keil compiler. For example you can use the sprintf function to create a string and then use the UART_PutString() function to send that string on the UART interface. Make sure to include the stdio.h header file as well:
You can refer to the help documentation for the Keil compiler (from Creator Help->Documentation->Keil). From there search on stdio. You will find that Keil also has the concept of printf, but that is implementation dependent and needs an interface to use. For PSoC 3 you should use sprintf and then pass that string to whatever commnunications interface that you would like to use.