2017-03-01 308 views

答えて

0

あなたはキーを押したり、パネルに接続されている機能のいくつかの機能を確認する必要があり、IGは、メッセージを送信するだけのeasyer方法ですが、diferentノードですので、あなたは、IGとCAPLを接続することはできません。

1

あなたは、あなたがCANにそれを送信する機能「出力」を使用する必要があり、あなたはCAPLで独自のメッセージだ宣言する必要があります。以下の例では、100ms周期のID 0x100のメッセージを送信します。

enter code here 
variables 
{ 
    msTimer timer200ms; 
    msTimer timer100ms; 
    message 0x100 msg = { 
    DLC = 8, 
    byte(0) = 0x00, byte(1) = 0x00, byte(2) = 0x00, byte(3) = 0x00, 
    byte(4) = 0x00, byte(5) = 0x00, byte(6) = 0x00, byte(7) = 0x00 
}; 
    byte myByte[8]; 
} 

on timer timer200ms{ 
    int i=0, j=0; 

    if(i<7){ 
    if(j<256){ 
     myByte[i] = j; 
     write("frame %d have been change for %d", i, j); 
     j++; 
     if(j==255){ 
     i++; 
     j=0; 
     } 
    } 
    } 
    else{ 
    cancelTimer(timer200ms); 
    } 
} 

on timer timer100ms{ 
    msg.byte(0) = myByte[0]; 
    msg.byte(1) = myByte[1]; 
    msg.byte(2) = myByte[2]; 
    msg.byte(3) = myByte[3]; 
    msg.byte(4) = myByte[4]; 
    msg.byte(5) = myByte[5]; 
    msg.byte(6) = myByte[6]; 
    msg.byte(7) = myByte[7]; 
    output(msg); 
} 

on start{ 
    setTimerCyclic(timer100ms, 100); 
    setTimerCyclic(timer200ms, 100); 
} 
関連する問題