NXC
Version 1.2.1 r5
Main Page
Related Pages
Modules
Data Structures
Files
Examples
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);
Wait
(
SEC_5
);
ClearScreen
();
Wait
(
SEC_1
);
/*
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]);
Wait
(
SEC_5
);
ClearScreen
();
Wait
(
SEC_1
);
data2 = data;
result =
GetMemoryInfo
(
false
, ps, ds);
NumOut
(0,
LCD_LINE1
, ps);
NumOut
(0,
LCD_LINE2
, ds);
NumOut
(0,
LCD_LINE8
, data2[10]);
Wait
(
SEC_5
);
ClearScreen
();
Wait
(
SEC_1
);
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]);
Wait
(
SEC_5
);
ClearScreen
();
Wait
(
SEC_1
);
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]);
Wait
(
SEC_5
);
ClearScreen
();
Wait
(
SEC_1
);
result =
GetMemoryInfo
(
true
, ps, ds);
NumOut
(0,
LCD_LINE1
, ps);
NumOut
(0,
LCD_LINE2
, ds);
Wait
(
SEC_5
);
ClearScreen
();
Wait
(
SEC_1
);
while
(
true
);
}
Generated by
1.8.2