Storage media (ADbasic)
Media_Write
ADwin
194
ADwin-Gold II
, Manual February 2013
Media_Write
Media_Write
copies blocks of values from an array to the memory card of
ADwin-Gold II
.
Syntax
#Include
ADwinGoldII.inc
ret_val
=
Media_Write
(
media_datatable
[],
start_block
,
count_blocks128
,
source_array
[],
array_start_index
)
Parameters
Notes
Before using
Media_Write
, the array
media_datatable
[]
must be
initialized with
Media_Init
. The instruction
Media_Init
is only
available in
ADbasic
, but not in
TiCoBasic
.
Media_Write
should only be used in low priority process section:
•
anywhere in a low priority process
•
in the sections
LowInit
or
Finish
of a high priority process
If used in a high priority process only a small number of data blocks may
be transferred. Otherwise the communication between PC and
ADwin
system would be stopped too long, and would therefore lead to an error
message (timeout).
The data transfer speed per data block increases with the number of
transferred data blocks.
The array
source_array
[]
must be dimensioned with at least
count_blocks128
× 128 elements.
T11
m e d i a _
datatable
[
]
Array containig data for the operation of the
memory card, see
Media_Init
.
ARRAY
LONG
s t a r t _
block
Index (0…
m
-1) of the first data block on the
memory card which is to be written.
m
is the return value of
Media_Init
.
LONG
c o u n t _
blocks128
Number (1…
m
-1) of data blocks to be written. A
data blocks contains 128 values of 32 bit.
m
is the return value of
Media_Init
.
LONG
s o u r c e _
array
[]
Array from which data is read.
Both data types Long or Float are allowed.
ARRAY
LONG
FLOAT
a r r a y _
s t a r t _
index
Index (1…n) of the first array element to be trans-
ferred.
LONG
ret_val
Status of data transfer:
= 0: The data have been written successfully.
> 0: An error has occurred. Set Bits in
ret_val
refer to the error cause, see table.
LONG
Bit no.
Meaning
00
Bit = 1: Memory card does not reply.
01
Bit = 1: Timeout.
02:32
Bits may be set but cannot be used here.