NXC  Version 1.2.1 r5
 All Data Structures Files Functions Variables Groups Pages
ex_getmemoryinfo.nxc

This is an example of how to use the GetMemoryInfo function.

task main() {
byte data[];
byte data2[];
int data3[];
int ps, ds;
char result = GetMemoryInfo(false, ps, ds);
NumOut(0, LCD_LINE1, ps);
NumOut(0, LCD_LINE2, ds);
/*
result = GetMemoryInfo(true, ps, ds);
NumOut(0, LCD_LINE1, ps);
NumOut(0, LCD_LINE2, ds);
Wait(SEC_5);
ClearScreen();
Wait(SEC_1);
*/
ArrayInit(data, 10, 1000);
data[10]++;
ps = data[10];
result = GetMemoryInfo(false, ps, ds);
NumOut(0, LCD_LINE1, ps);
NumOut(0, LCD_LINE2, ds);
NumOut(0, LCD_LINE8, data[10]);
data2 = data;
result = GetMemoryInfo(false, ps, ds);
NumOut(0, LCD_LINE1, ps);
NumOut(0, LCD_LINE2, ds);
NumOut(0, LCD_LINE8, data2[10]);
ArrayBuild(data3, ps, ds, ps, ds, ps, ds, ps, ds);
result = GetMemoryInfo(false, ps, ds);
NumOut(0, LCD_LINE1, ps);
NumOut(0, LCD_LINE2, ds);
NumOut(0, LCD_LINE8, data3[3]);
ArrayInit(data2, 5, 1);
result = GetMemoryInfo(false, ps, ds);
NumOut(0, LCD_LINE1, ps);
NumOut(0, LCD_LINE2, ds);
NumOut(0, LCD_LINE8, data2[0]);
result = GetMemoryInfo(true, ps, ds);
NumOut(0, LCD_LINE1, ps);
NumOut(0, LCD_LINE2, ds);
while(true);
}