Czy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie tamPROT-ADDR-CMD-REP-BITS
Field-by-field breakdown
• PROT (Protocol)
– Defines carrier frequency (typically 36–40 kHz), mark/space timings, frame layout, bit encoding (PWM, bi-phase, etc.).
– Example tables:
‑ NEC: 38 kHz, pulse-distance, 32 data bits.
‑ Sony SIRC: 40 kHz, PWM, 12/15/20 bits.
‑ RC5: 36 kHz, Manchester, 14 bits incl. toggle.
• ADDR (Address)
– Identifies the target appliance or product family.
– Size varies (e.g. 5 bits in RC5, 8 bits + inverse in NEC, 16 bits in Samsung).
• CMD (Command)
– Encodes the user function. Same bit-width rules as ADDR.
– Often followed by its 1-complement (NEC, Samsung) or protected by a toggle bit (RC5/RC6).
• REP (Repeat)
– Boolean or counter.
– Most consumer remotes send one full frame, then – while the key is held – a protocol-defined repeat frame every 108 ms (NEC) or 45 ms (Sony).
– Libraries expose this as “numberOfRepeats” (IRremote 4.x) or a dedicated “sendRepeat” method.
• BITS (Bit count)
– Tells the encoder/decoder how many payload bits to expect so that the frame can be packed correctly.
– Mandatory for variable-length protocols (Sony, Pronto, Kaseikyo).
How libraries map the mnemonic
Environment | Typical call | Mapping to PROT-ADDR-CMD-REP-BITS |
---|---|---|
Arduino IRremote ≥4.0 | irsend.sendNEC(addr, cmd, reps); |
PROT = NEC; ADDR = addr ; CMD = cmd ; REP = reps ; BITS implicit (32) |
ESPHome | remote_transmitter.transmit_nec: |
YAML keys address , command , repeat ; bit length inferred |
Linux LIRC / irsend | button entry in lircd.conf |
Protocol section sets PROT/BITS; 0xAA55 etc. encodes ADDR+CMD; repeats handled by driver |
OpenBK/Tasmota “IRSend” | IRSend <proto> <hexvalue> <bits> [reps] |
First token = PROT, second token is ADDR + CMD packed, third token = BITS, optional REP |
NEC standard (32 bits):
[ADDR 8][~ADDR 8][CMD 8][~CMD 8]
Sony 15-bit:
[CMD 7][ADDR 8]
RC6‐0‐16 (Philips):
[Leader][Start 1][Mode 3][Trailer 1][Toggle 1][ADDR 8][CMD 8]
• Library evolution: Arduino-IRremote 4.3+ now offers per-protocol convenience wrappers; no need to hand-compose 32-bit words anymore.
• Home-automation firmware (Tasmota 14, ESPHome 2024.5) automatically learns and stores PROT/ADDR/CMD, exposing them via MQTT/HA.
• Consumer devices are slowly transitioning to CEC over HDMI or RF4CE/BLE, but IR with the above structure remains ubiquitous, especially for cost-sensitive appliances.
Practical capture-and-replay workflow:
Protocol=NEC, Address=0x20DF, Command=0x10EF, Bits=32
. irsend.sendNEC(0x20DF, 0x10EF, 0);
Repeat frames: For a held key you can do:
irsend.sendNEC(0x20DF, 0x10EF, 0); // initial
delay(110);
irsend.sendNEC(0, 0, 1); // NEC repeat code – only header & gap
• Most IR command sets are not proprietary secrets, but some manufacturers treat the codes as part of their intellectual property. Use for personal integration is normally tolerated; redistribute only where licences allow.
• Avoid blasting high-power IR LEDs directly into people’s eyes; adhere to IEC 60825 safety limits.
• Never automate critical medical or security devices without fail-safe interlocks; IR is open-air and spoofable.
flags SPACE_ENC|CONST_LENGTH
match the selected PROT. “PROT-ADDR-CMD-REP-BITS” is simply a compact way to list the five critical parameters that define an IR remote-control frame: which protocol, which device, what action, how many repeats, and how many bits. Knowing this structure lets engineers capture, document, and faithfully reproduce virtually any IR command using Arduino IRremote, ESPHome, LIRC, or similar tool-chains, while recognising protocol-specific nuances such as inverted bytes or toggle bits.