Rev 1624 |
Rev 1650 |
Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
#include "kernel/kern.h"
#include "modules/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");
sys_end();
}
task_activate(CONTROL_pid);
}