Beispiel #1
0
/* サンプルタスク */
void appli(VP_INT exinf)
{
    char count[9];
    char task_id[2];
    MESSAGE* msg;
    ID this;

    memset(count,'0',sizeof(count));
    count[8] = task_id[1] = '\0';

    while (1) {
        if (++count[7] > '9') {
            count[7] = '0';
            if (++count[6] > '9') {
                count[6] = '0';
                if (++count[5] > '9') {
                    count[5] = '0';
                    if (++count[4] > '9') {
                        count[4] = '0';
                        if (++count[3] > '9') {
                            count[3] = '0';
                            if (++count[2] > '9') {
                                count[2] = '0';
                                if (++count[1] > '9') {
                                    count[1] = '0';
                                    if (++count[0] > '9') {
                                        count[0] = '0';
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        /* メモリプールから取得 */
        get_mpf(MPID_TEST,(VP)&msg);
        strcpy(msg->buf,"This is test messages from Task");
        get_tid(&this);
        task_id[0] = this + '0';
        strcat(msg->buf,task_id);
        strcat(msg->buf,". count ");
        strcat(msg->buf,count);
        strcat(msg->buf,"\r\n");
        msg->len = strlen(msg->buf);
        msg->sender = this;

        snd_mbx(MID_TEST,(T_MSG *)msg);
    }
}
Beispiel #2
0
/** %jp{状態表示} */
void print_state(int num, char *text)
{
	T_PRINT_MSG *msg;
	VP  mem;
	
	/* %jp{メモリ取得} */
	get_mpf(mpfid, &mem);
	msg = (T_PRINT_MSG *)mem;

	/* %jp{文字列生成} */
	msg->text[0] = '0' + num;
	msg->text[1] = ' ';
	msg->text[2] = ':';
	msg->text[3] = ' ';
	strcpy(&msg->text[4], text);
	strcat(msg->text, "\n");
	
	/* %jp{表示タスクに送信} */
	snd_mbx(mbxid, (T_MSG *)msg);
}