FILES IN main.c

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

cross mob
Anonymous
Not applicable

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:

   

 

   

   

#include

       

   

<device.h>

   

#include

        <math.h>   

#include

    <stdio.h>   

void

{

FILE *fp;

 

 

 

    main()    int    result,i;    /* Place your initialization/startup code here (e.g. MyInst_Start()) */   

ADCDelSig_Start();

 

    /* CYGlobalIntEnable; */        /* Uncomment this line to enable global interrupts. */   

 

fp = fopen(

 

{

ADCDelSig_StartConvert();

ADCDelSig_IsEndConversion(ADCDelSig_WAIT_FOR_RESULT );

result=ADCDelSig_GetResult8();

fwrite(&result,

 

}

    "primeros.dat"    ,     "wb"    );    for    (i=0;i<10;i++)    sizeof    (    int    ), 1, fp);    /*for*/   

fclose(fp);

}

    /*main*/   

/* [] END OF FILE */

   

Some idea to create a file?

0 Likes
1 Reply
Anonymous
Not applicable

I obtained this answer in PsOC developer:

   

Where do you want to write the data to? EEPROM or back in the computer?

You cannot create a file from PSoC itself.
If you want use the data for some calculation etc, you can write the data to a temporary buffer (malloc).
If you want it to be in non-volatile you can write the data to EEPROM.
If you want to send it back to the PC, you need to have some kind of communication from PSoC to PC - like serial or USB.
 

   

By Ravi.

0 Likes