====== Ictd() ====== ''Ictd()''는 설정값을 불러온 후 입력 상승마다 현재값을 감소시킵니다. {{:commands:reference:ictd.svg?900|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); } ===== 주의사항 ===== * 기존 0~31 고정 제한은 제거되었다. 단, 인수 타입이 ''uint8_t''이므로 최대 ID는 ''255''이다. * 메모리가 부족해서 카운터 상태를 확보하지 못하면 카운터 명령어는 ''false'' 또는 ''0''을 반환한다. * 한 번 생성된 카운터 상태는 프로그램 실행 중 유지된다. ===== 같은 카테고리의 내장 명령어 ===== * [[commands:reference:ictu|Ictu() 상세 설명 보기]] * [[commands:reference:ictud|Ictud() 상세 설명 보기]] * [[commands:reference:igetcount|IgetCount() 상세 설명 보기]] * [[commands:reference:isetcount|IsetCount() 상세 설명 보기]] * [[commands:reference:ictuddownstate|IctudDownState() 상세 설명 보기]] [[commands:builtin|← 내장 명령어 리스트]]