ユーザ用ツール

サイト用ツール


ja-jp_commands:reference:ictud

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

次のリビジョン
前のリビジョン
ja-jp_commands:reference:ictud [2026/09/07 21:53] – 만듦 - 바깥 편집 127.0.0.1ja-jp_commands:reference:ictud [2026/09/14 20:30] (現在) – 外部編集 127.0.0.1
行 14: 行 14:
  
 ===== 使用例 ===== ===== 使用例 =====
 +
 +MPINO-8A4R(T)-SのP0~P3入力とP32出力を使用する例です。
  
 <code cpp> <code cpp>
-bool Ictu(uint8_t counter_id, bool CU, bool RESET, int32_t PV); +const uint8_t COUNTER_ID = 2; 
-bool Ictd(uint8_t counter_id, bool CD, bool LOAD, int32_t PV); +const int32_t RACK_CAPACITY = 100; 
-bool Ictud(uint8_t counter_idbool CUbool CDbool RESETbool LOADint32_t PV); + 
-int32_t IgetCount(uint8_t counter_id); +void setup() { 
-void IsetCount(uint8_t counter_idint32_t value); +  Serial.begin(115200); 
-bool IctudDownState(uint8_t counter_id);+
 + 
 +void loop() { 
 +  const bool entered = digitalRead(0) == HIGH; 
 +  const bool exited = digitalRead(1) == HIGH; 
 +  const bool reset = digitalRead(2== HIGH
 +  const bool preset = digitalRead(3) == HIGH; 
 +  const bool full = Ictud(COUNTER_IDenteredexitedresetpresetRACK_CAPACITY);  // 加算入力と減算入力を1つのカウンタで処理します。 
 +  digitalWrite(32full ? HIGH : LOW); 
 +}
 </code> </code>
  
行 29: 行 40:
   * メモリ不足でカウンタ状態を確保できない場合、カウンタコマンドは''false''または''0''を返します。   * メモリ不足でカウンタ状態を確保できない場合、カウンタコマンドは''false''または''0''を返します。
   * 一度作成したカウンタ状態はプログラム実行中保持されます。   * 一度作成したカウンタ状態はプログラム実行中保持されます。
 +
 +===== 同じカテゴリの内蔵コマンド =====
 +
 +  * [[:ja-jp_commands:reference:ictu|Ictu() 詳細説明を見る]]
 +  * [[:ja-jp_commands:reference:ictd|Ictd() 詳細説明を見る]]
 +  * [[:ja-jp_commands:reference:igetcount|IgetCount() 詳細説明を見る]]
 +  * [[:ja-jp_commands:reference:isetcount|IsetCount() 詳細説明を見る]]
 +  * [[:ja-jp_commands:reference:ictuddownstate|IctudDownState() 詳細説明を見る]]
  
 [[:ja-jp_commands:builtin|← 内蔵コマンド一覧]] [[:ja-jp_commands:builtin|← 内蔵コマンド一覧]]
  
ja-jp_commands/reference/ictud.1788785589.txt.gz · 最終更新: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki