Pro I: Digital-I/O- and Counter Modules
Pro-Storage Rev. A
ADwin
152
ADwin-Pro
Hardware, manual version 2.9, June 2006
Adapt the source code
3. Copy the source code files
Pro-Storage_SP.bas
and
Pro-Storage_MP.bas
from the directory
C:\ADwin\ADba-
sic\samples_ADwin_PRO
into the directory of your project. Add the
information you have selected according to the items 1 and 2 to your file.
In the source code the areas are marked which must be adapted or
moved to the MP.
Note that the global arrays have the same size in both processes.
Test the program
4. Test the programs (compile SP with low-priority!). Note, how the MP
uses the 2 global arrays for data transfer and the control of the SP:
–
DATA_199
[]
or
fb
[]
: This FIFO array is used for passing the saved
data from MP to SP.
–
DATA_198
[]
or
f_cmd
[]
: The elements of this array are used for the
control of the saving process and as feedback for the MP.
If the MP setting the parameter
f_cmd
[9]
the SP is not stopped at
once, but at the moment when there is no data left in the FIFO array.
Thus, the SP continues working as long as the MP writes data into the
FIFO array.
•
f_cmd
[1]
Number (1…10) of the file
•
f_cmd
[2]
Write mode in the SP:
0: Write data starting at the beginning of the file
("New" means to overwrite previous data).
1: Append data at the end of the data ("Append").
•
f_cmd
[3]
Duration of the time-out in the SP:
≤
0:Write data immediately.
>0:Time interval in 100µs until buffering starts.
•
f_cmd
[4]
Total size of the file in 32-bit values.
•
f_cmd
[5]
Status of the SP: Amount of data values, which have
already been written into the file.
•
f_cmd
[6]
Status of the SP: Amount of free elements in the FIFO
DATA_199
[]
.
•
f_cmd
[7]
Status or error messages of the SP:
128: Error - storage medium does not respond in a
defined time interval (time-out).
64: Error - end of file is reached during writing into the
file.
32: Status - SP is stopped as soon as possible (see
f_cmd
[9]
)
16: Error - Start sector of the file is larger than the end
sector.
8: Error - Write pointer of the file is invalid.
4: Error - File is full (before first saving).
2: Error - File does not exist.
1: Error - No storage medium in the module.
0: Status - End of file not yet reached = data can be
saved.
•
f_cmd
[8]
Status of the SP:
0: Section
INIT
:
is finished.
1: Section
INIT
:
just in progress.
•
f_cmd
[9]
Command of the MP to the SP:
0: Sp continues working.
1: Save remaining data and stop SP, for feedback
see
f_cmd
[7]
.