Last change
on this file since 12350 was 11071, checked in by tbretz, 13 years ago |
Replaced v19r21 by a version extracted with 'unzip -a' to get proper unix text format.
|
File size:
968 bytes
|
Line | |
---|
1 | #include <dic.h>
|
---|
2 |
|
---|
3 | int no_link = -1;
|
---|
4 | int RegisterSet;
|
---|
5 | int RegisterValue;
|
---|
6 |
|
---|
7 | void register_callback( tag, data, size )
|
---|
8 | int *tag, *data, *size;
|
---|
9 | {
|
---|
10 | RegisterValue = *data;
|
---|
11 | RegisterSet = *tag;
|
---|
12 | /* In linux this is not necessary */
|
---|
13 | #ifdef WIN32
|
---|
14 | dim_wake_up();
|
---|
15 | #endif
|
---|
16 | }
|
---|
17 |
|
---|
18 | int set_register_wait(index, value)
|
---|
19 | int index, value;
|
---|
20 | {
|
---|
21 | int pars[2];
|
---|
22 |
|
---|
23 | pars[0] = index;
|
---|
24 | pars[1] = value;
|
---|
25 | RegisterSet = -1;
|
---|
26 | dic_cmnd_service("SET_REGISTER",pars,sizeof(pars));
|
---|
27 | while(RegisterSet == -1)
|
---|
28 | {
|
---|
29 | dim_wait();
|
---|
30 | }
|
---|
31 | if(RegisterSet == index)
|
---|
32 | return(RegisterValue);
|
---|
33 | return(-1);
|
---|
34 | }
|
---|
35 |
|
---|
36 | main(argc,argv)
|
---|
37 | int argc;
|
---|
38 | char **argv;
|
---|
39 | {
|
---|
40 | int i, index = 0, value;
|
---|
41 | char aux[80];
|
---|
42 |
|
---|
43 | for(i = 0; i< 10; i++)
|
---|
44 | {
|
---|
45 | sprintf(aux,"Register%03d",i);
|
---|
46 | dic_info_service( aux, MONIT_ONLY, 0, 0, 0,
|
---|
47 | register_callback, i, &no_link, sizeof(int) );
|
---|
48 | }
|
---|
49 |
|
---|
50 | while(1)
|
---|
51 | {
|
---|
52 | value = set_register_wait(index%10, index);
|
---|
53 | printf("Register %d: wrote %d, readback = %d\n",
|
---|
54 | index%10, index, value);
|
---|
55 | index ++;
|
---|
56 | sleep(1);
|
---|
57 | }
|
---|
58 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.