Rev 1650 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
#include "kernel/kern.h"
#include "cabs/cabs/cabs.h"
#include "tmwtypes.h"
#include "rtw.h"
extern CAB input_cid
[NINPUTCAB
];
TASK CONTROL_body
(void *arg
) {
real_T
*p
;
input_cid
[0] = cab_create
("INPUT0", sizeof(real_T
), 2);
input_cid
[1] = cab_create
("INPUT1", sizeof(real_T
), 2);
while(1) {
/* Reserve a message */
p
= (real_T
*)cab_reserve
(input_cid
[0]);
/* Save PAR1 data */
*p
= 1000.0;
/* Put CAB message */
cab_putmes
(input_cid
[0], p
);
/* Reserve a message */
p
= (real_T
*)cab_reserve
(input_cid
[1]);
/* Save PAR2 data */
*p
= 1000.0;
/* Put CAB message */
cab_putmes
(input_cid
[1], p
);
task_endcycle
();
}
return NULL
;
}
void activate_control
() {
HARD_TASK_MODEL CONTROL_task
;
PID CONTROL_pid
;
hard_task_default_model
(CONTROL_task
);
hard_task_def_mit
(CONTROL_task
,10000);
hard_task_def_wcet
(CONTROL_task
,500);
hard_task_def_usemath
(CONTROL_task
);
hard_task_def_ctrl_jet
(CONTROL_task
);
CONTROL_pid
= task_create
("CONTROL",CONTROL_body
,&CONTROL_task
,NULL
);
if (CONTROL_pid
== NIL
) {
cprintf
("Error: Cannot create RealTime Workshop [CONTROL] Task\n");
exit(1);
}
task_activate
(CONTROL_pid
);
}