int main(int argc, char** argv)
{
unsigned int i = 0;
unsigned int lecturas[50] = {0};
OSCInit();
ADCOpen();
while(1)
{
lecturas[i] = ADCRead();
i++;
if(i > 50)
{
i = 0;
}
}
}int main(int argc, char** argv)
{
unsigned int i = 0;
unsigned int lecturas[1000] = {0};
OSCInit();
ADCOpen();
while(1)
{
lecturas[i] = ADCRead();
i++;
if(i > 1000)
{
i = 0;
}
}
}compilo el codigo sin ningun error..en cuanto a uso de memoria, me sigue diciendo ke tengo la RAM totalmente vacia:En el caso del primer ejemplo:
Estás compilando con optimizaciones? Porque en este caso puede ser que el compilador te elimine tus variables porque "no estás haciendo nada" con ellas. No sé el compilador que estás usando, pero normalmente uno bueno te las eliminaría.
Si estás compilando con optimizaciones, prueba a deshabilitarlas a ver qué sucede.
También puede ser un bug en el MPLAB X, el compilador o el linker.
Saludos!
Memory Summary:
Program space used 86h ( 134) of 8000h bytes ( 0.4%)
Data space used 68h ( 104) of 600h bytes ( 6.8%)
Configuration bits used 7h ( 7) of 7h words (100.0%)
EEPROM space used 0h ( 0) of 100h bytes ( 0.0%)
ID Location space used 8h ( 8) of 8h bytes (100.0%)
Data stack space used 0h ( 0) of 53Ah bytes ( 0.0%)Memory Summary:
Program space used 86h ( 134) of 8000h bytes ( 0.4%)
Data space used F4h ( 244) of 600h bytes ( 15.9%)
Configuration bits used 7h ( 7) of 7h words (100.0%)
EEPROM space used 0h ( 0) of 100h bytes ( 0.0%)
ID Location space used 8h ( 8) of 8h bytes (100.0%)
Data stack space used 0h ( 0) of 40Eh bytes ( 0.0%)int main(int argc, char** argv)
{
unsigned int i = 0;
unsigned int lecturas[50] = {0};
OSCInit();
ADCOpen();
while(1)
{
lecturas[i] = ADCRead();
i++;
if(i > 50)
{
i = 0;
}
}
}int main(int argc, char** argv)
{
static unsigned int i = 0;
static unsigned int lecturas[50] = {0};
OSCInit();
ADCOpen();
while(1)
{
lecturas[i] = ADCRead();
i++;
if(i > 50)
{
i = 0;
}
}
}logre hacer q el compilador guardara las variables en la memoria RAM, y ahora si me sale bien la memoria ke estoy usando. si le asigno un valor muy grande, me da error, que es como debe ser.int main(void)
{
unsigned int lecturas[3000] = {0};
unsigned int i = 0;
OSCInit();
ADCOpen();
while(1)
{
lecturas[i] = ADCRead();
i++;
if(i > 3000)
{
i = 0;
}
PORTB = lecturas[i];
}
}Veo que has pasado completamente de lo que te he dicho, pero bueno... tu sabrás, eso ya me ha pasado a mi y si lo estas simulando se lo que le pasa.
por cierto por cambiar de static a volatil no cambias de memoria.
Program Memory [Origin = 0x200, Length = 0x1e00]
section address length (PC units) length (bytes) (dec)
------- ------- ----------------- --------------------
.text 0x200 0xce 0x135 (309)
.text 0x2ce 0x2e 0x45 (69)
.dinit 0x2fc 0x8 0xc (12)
.text 0x304 0xc 0x12 (18)
Total program memory used (bytes): 0x198 (408) 3%
Data Memory [Origin = 0x800, Length = 0x400]
section address alignment gaps total length (dec)
------- ------- -------------- -------------------
.nbss 0x800 0 0xf0 (240)
Total data memory used (bytes): 0xf0 (240) 23%
Dynamic Memory Usage
region address maximum length (dec)
------ ------- ---------------------
heap 0 0 (0)
stack 0x8f0 0x310 (784)
Maximum dynamic memory (bytes): 0x310 (784)Program Memory [Origin = 0x200, Length = 0x1e00]
section address length (PC units) length (bytes) (dec)
------- ------- ----------------- --------------------
.text 0x200 0xce 0x135 (309)
.text 0x2ce 0x38 0x54 (84)
.dinit 0x306 0x8 0xc (12)
.text 0x30e 0xc 0x12 (18)
Total program memory used (bytes): 0x1a7 (423) 3%
Data Memory [Origin = 0x800, Length = 0x400]
section address alignment gaps total length (dec)
------- ------- -------------- -------------------
.nbss 0x800 0 0x168 (360)
Total data memory used (bytes): 0x168 (360) 35%
Dynamic Memory Usage
region address maximum length (dec)
------ ------- ---------------------
heap 0 0 (0)
stack 0x968 0x298 (664)
Maximum dynamic memory (bytes): 0x298 (664)section address length (PC units) length (bytes) (dec)
------- ------- ----------------- --------------------
.text 0x200 0xce 0x135 (309)
.text 0x2ce 0x38 0x54 (84)
.dinit 0x306 0x8 0xc (12)
.text 0x30e 0xc 0x12 (18)
Total program memory used (bytes): 0x1a7 (423) 3%
Data Memory [Origin = 0x800, Length = 0x400]
section address alignment gaps total length (dec)
------- ------- -------------- -------------------
.nbss 0x800 0 0xf0 (240)
Total data memory used (bytes): 0xf0 (240) 23%
Dynamic Memory Usage
region address maximum length (dec)
------ ------- ---------------------
heap 0 0 (0)
stack 0x8f0 0x310 (784)
Maximum dynamic memory (bytes): 0x310 (784)Program Memory [Origin = 0x200, Length = 0x1e00]
section address length (PC units) length (bytes) (dec)
------- ------- ----------------- --------------------
.text 0x200 0xce 0x135 (309)
.dinit 0x2ce 0xa8 0xfc (252)
.text 0x376 0x44 0x66 (102)
Total program memory used (bytes): 0x297 (663) 5%
Data Memory [Origin = 0x800, Length = 0x400]
section address alignment gaps total length (dec)
------- ------- -------------- -------------------
.ndata 0x800 0 0xf0 (240)
Total data memory used (bytes): 0xf0 (240) 23%section address length (PC units) length (bytes) (dec)
------- ------- ----------------- --------------------
.text 0x200 0xce 0x135 (309)
.const 0x2ce 0xf0 0x168 (360)
.text 0x3be 0x34 0x4e (78)
.dinit 0x3f2 0x2 0x3 (3)
Total program memory used (bytes): 0x2ee (750) 6%
Data Memory [Origin = 0x800, Length = 0x400]
section address alignment gaps total length (dec)
------- ------- -------------- -------------------
Total data memory used (bytes): 0 (0)
Dynamic Memory Usage
region address maximum length (dec)
------ ------- ---------------------
heap 0 0 (0)
stack 0x800 0x400 (1024)
Maximum dynamic memory (bytes): 0x400 (1024)