1 Reply Latest reply on Oct 3, 2010 12:51 PM by bradleyb_


      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


      the pointer.


      I get and error in the instruction:


      FILE *p;


      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*/


      Some idea to create a file?
















      FILE *fp;


















      fp = fopen(








      ADCDelSig_IsEndConversion(ADCDelSig_WAIT_FOR_RESULT );


















      /* [] END OF FILE */





        • 1. Re: CREATE A FILE

          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.


          Brad Budlong
          PSoC Sensei