目次

Ictud()

Ictud()は増加入力と減少入力を1つのカウンタで処理します。

Ictud コマンドの動作フロー

bool Ictud(uint8_t counter_id, bool CU, bool CD, bool RESET, bool LOAD, int32_t PV)

コマンド

コマンド 引数 戻り値 動作
Ictud(counter_id, CU, CD, RESET, LOAD, PV) uint8_t counter_id — カウンタ番号。uint8_tの範囲のため0 ~ 255を使用可能
bool CU
bool CD
bool RESET
bool LOAD
int32_t PV — 設定値
bool 増加入力と減少入力を1つのカウンタで処理します。

使用例

MPINO-8A4R(T)-SのP0~P3入力とP32出力を使用する例です。

const uint8_t COUNTER_ID = 2;
const int32_t RACK_CAPACITY = 100;
 
void setup() {
  Serial.begin(115200);
}
 
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_ID, entered, exited, reset, preset, RACK_CAPACITY);  // 加算入力と減算入力を1つのカウンタで処理します。
  digitalWrite(32, full ? HIGH : LOW);
}

注意事項

同じカテゴリの内蔵コマンド

← 内蔵コマンド一覧