NXC
Version 1.2.1 r5
Main Page
Related Pages
Modules
Data Structures
Files
Examples
All
Data Structures
Files
Functions
Variables
Groups
Pages
ex_reladdressof.nxc
This is an example of how to use the
reladdressOf
function.
task main()
{
char
x[]={1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
unsigned
long
ptr =
reladdressOf
(x);
TextOut
(0,
LCD_LINE1
,
FormatNum
(
"%x"
, ptr));
IOMapReadByIDType
args;
args.
ModuleID
=
CommandModuleID
;
args.
Offset
=
CommandOffsetMemoryPool
+ptr;
args.
Count
= 10;
SysIOMapReadByID
(args);
NumOut
( 0,
LCD_LINE2
, x[0]);
NumOut
(20,
LCD_LINE2
, x[1]);
NumOut
(40,
LCD_LINE2
, x[2]);
NumOut
(60,
LCD_LINE2
, x[3]);
NumOut
(80,
LCD_LINE2
, x[4]);
NumOut
( 0,
LCD_LINE3
, args.
Buffer
[0]);
NumOut
(20,
LCD_LINE3
, args.
Buffer
[1]);
NumOut
(40,
LCD_LINE3
, args.
Buffer
[2]);
NumOut
(60,
LCD_LINE3
, args.
Buffer
[3]);
NumOut
(80,
LCD_LINE3
, args.
Buffer
[4]);
args.
Buffer
++;
args.
Buffer
*= 3;
IOMapWriteByIDType
a2;
a2.
ModuleID
=
CommandModuleID
;
a2.
Offset
=
CommandOffsetMemoryPool
+ptr;
a2.
Buffer
= args.
Buffer
;
SysIOMapWriteByID
(a2);
NumOut
( 0,
LCD_LINE4
, x[0]);
NumOut
(20,
LCD_LINE4
, x[1]);
NumOut
(40,
LCD_LINE4
, x[2]);
NumOut
(60,
LCD_LINE4
, x[3]);
NumOut
(80,
LCD_LINE4
, x[4]);
Wait
(
SEC_10
);
}
Generated by
1.8.2