xpress_embedo
Advanced Member level 4
Hello!,
I am using PIC12F1571 micro-controller do develop an application, this micro-controller has very less RAM, just 128 bytes, so while designing this application, i have to take care of RAM also.
I need to calculate average on an array, can anyone please tell me, why RAM and ROM size gets changes drastically by using the function for that.
Here is case1, when i didn't used function for computing average.
In this case RAM = 54 bytes and ROM = 335 bytes
Now case 2, where i used function for computing average, and the function is as follow:
RAM = 65 bytes and ROM = 393 bytes
So 11 bytes increased in RAM and 58 bytes in ROM, can someone please help me in understanding this thing.
Thanks in advance.
I am using PIC12F1571 micro-controller do develop an application, this micro-controller has very less RAM, just 128 bytes, so while designing this application, i have to take care of RAM also.
I need to calculate average on an array, can anyone please tell me, why RAM and ROM size gets changes drastically by using the function for that.
Here is case1, when i didn't used function for computing average.
In this case RAM = 54 bytes and ROM = 335 bytes
Now case 2, where i used function for computing average, and the function is as follow:
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 uint16_t Compute_Average( uint8_t *data, uint8_t data_size) { uint16_t total; for ( uint8_t i = 0; i<data_size; i++ ) { total += *(data+i); } total = total/data_size; return total; }
RAM = 65 bytes and ROM = 393 bytes
So 11 bytes increased in RAM and 58 bytes in ROM, can someone please help me in understanding this thing.
Thanks in advance.