目次

Ictd()

Ictd()は設定値を読み込んだ後、入力の立ち上がりごとに現在値を減らします。

Ictd コマンドの動作フロー

bool Ictd(uint8_t counter_id, bool CD, bool LOAD, int32_t PV)

コマンド

コマンド 引数 戻り値 動作
Ictd(counter_id, CD, LOAD, PV) uint8_t counter_id — カウンタ番号。uint8_tの範囲のため0 ~ 255を使用可能
bool CD
bool LOAD
int32_t PV — 設定値
bool 設定値を読み込んだ後、入力の立ち上がりごとに現在値を減らします。

使用例

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

const uint8_t COUNTER_ID = 1;
const int32_t START_QUANTITY = 50;
 
void setup() {
  Serial.begin(115200);
}
 
void loop() {
  const bool shipped = digitalRead(0) == HIGH;
  const bool loadQuantity = digitalRead(1) == HIGH;
  const bool empty = Ictd(COUNTER_ID, shipped, loadQuantity, START_QUANTITY);  // 設定値をロード後、入力の立ち上がりごとに現在値を減算します。
  digitalWrite(32, empty ? HIGH : LOW);
}

注意事項

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

← 内蔵コマンド一覧