CANNY 7.2 Duo, IRRC driver
General Description
CANNY 7.2 Duo controller can receive and send infrared remote controls commands (IRRC) in several widely-used formats - NEC, extended NEC, Samsung, Sony. Driver operation is possible in three modes: reception only, transmission only or reception / transmission. For transmission and reception any two channels can be used.
When transmitting infrared remote control commands, the channel used for this only generates baseband signal. To generate a pulse packet, the controller requires a carrier frequency, the source of which can be either an internal high frequency PWM channel or an external PWM generator. Receiving IR commands requires an external demodulator, such as TSOP1736 or similar.
IRRC driver operates using the controller’s channel resources, but has a higher priority than the discrete input-output driver. This means that for all channels, for which the IRRC driver is activated, all value changes in registers associated with discrete input-output driver will be ignored.
IRRC driver registers
Any IO channel can be assigned as either a transmitter or receiver. A channel cannot both transmit and receive at the same time. You can organize simultaneous transmission and reception by using two separate channels. You can connect several IR signal receivers / transmitters to the CANNY 7.2 Duo controller.
Register | Expected values |
---|---|
IRRC Mode Setup Register | 1…N = set driver configuration for the IRRC channel that determines the current operation mode and its operating parameters (defined by a named constant from the named constants list) 0 = disconnect the channel from the IRRC driver, return control to the IO channel driver and allow changing the channel’s status from the function diagram. |
IRRC Receive IO Channel Select Register | 0…8 = set the channel number used by IRRC driver for receiving data |
IRRC Transmit IO Channel Select Register | 0…8 = set the channel number used by IRRC driver for transmitting data |
Note: Remember to assign separate channels for transmission and reception.
Channel configuration for operating in this mode is determined by a constant that defines a combination of parameters. These parameters define the type of signal that determines the electric potentials of the initial state of the channel, channel conditions during data transmission, and the availability of internal “pull-up” potential of controller channel.
Parameter | Permitted values |
---|---|
Standard | NEC, Samsung, Sony |
Data stream direction | Reception, transmission, reception and transmission |
Signal type | Direct («1»: plus, «0»: minus), inverse («1»: minus, «0»: plus) |
Internal pull-up | No pull-up, pull-up, pull-down |
Note: Modes for using two different standards of IR remote controls for receiving and transmitting are supported. The IR remote control driver can work in the following receive-transmit combinations: NEC-NEC, NEC-Samsung, Samsung-Samsung, Samsung-NEC, Sony-Sony.
Register | Expected values |
---|---|
IRRC Idle Register | 1 = there is no activity on the corresponding channel of the IRRC driver 0 = activity is registered on the corresponding channel of the IRRC driver |
IRRC Overflow Register | 1 = registered buffer overflow on the corresponding channel of the IRRC driver 0 = no buffer overflow registered on the corresponding channel of the IRRC driver |
IRRC Ready To Send Register | 1 = IRRC driver data transmission buffer is empty and ready to go 0 = IRRC driver data transmission buffer is busy |
Register | Return values |
---|---|
IRRC Data Set Ready Register | ≥ 1 = a message was successfully received and is available in the IRRC driver receive register buffer 0 = there is no new data in the IRRC driver receive buffer |
IRRC Received Data Register D1:D0 IRRC Received Data Register D3:D2 |
0…0xFFFF = values of corresponding data bytes in the IRRC driver receive buffer, two bytes per register |
Register | Expected values |
---|---|
IRRC Request To Send | ≥ 1 = load the data from the transfer registers to the IRRC driver transmit buffer; 0 = do not load the data from the transfer registers to the IRRC driver transmit buffer. |
IRRC Transmit Data Register D1:D0 IRRC Transmit Data Register D3:D2 |
0…0xFFFF = data byte values of the meessage to be transmitted, two bytes per register. |
The special command of the NEC Standard – «repeat command» – is encoded using values D1:D0 = 0xFFFF and D3:D2 = 0xFFFF for both reception and transmission.
Note: When sending IR messages, each subsequent command is transferred only after release of the send buffer, i.e. when value “1” is present in the IRRC Ready to Send register. The “Repeat previous command” message is sent immediately after sending the first command and doesn’t require the transmit buffer to be released. Sending the “Repeat previous command” message is performed continuously, as often as possible, as long as the transfer confirmation is required.
Sony IR protocol distinctions
When receiving Sony protocol IRRC messages, the IR Received Data register D1:D0 contains both the address bits and the commands received. The command starts at D0 and is followed by the address. The D3:D2 Receive Register
There are three versions of this protocol that use 12, 15 and 20 information bits. The 12-bit prodocol consists of 5 address bits and 7 command bits. 15-bit prodocol consists of 8 address bits and 7 command bits. 20 bit consists of 5 address bits, 7 command bits and 8 extended bits. The D2 byte of the D3:D2 register contains 4 Most Significant Bits of the extension when used with the 20-bit protocol, otherwise D2 contains 0. D3 byte of the D3:D2 register contains the number of received bits, which allows you to determine the Sony protocol version.
When transmitting over the Sony protocl, write the command followed by the address to the D1:D0 Transmit Data register. Write 0 or 4 MSBs of the extension to D2 byte of the D3:D2 register depending on whether you are using the 20-bit protocol or not. Write the number of transmitted bits to the D3 byte of the same register: 12 = 0x0c, 15 = 0x0F, 20 = 0x14.
Examples
Receive example
The controller waits to receive a message containing the address 0х00 and the command code 0х01. Checking the received commands is performed by comparing them with constants that contain the desired value in the low byte, and the inverted version of the desired value in the high byte.
Transmit example
When a value of “1” is detected on the input channel #10 (a control button is pressed), the controller sends an IR message to an external device. The message contains the address 0хAB and command 0хCD. When the value “1” is present on the input channel #10 for a long time (the button is held rather than pressed) the controller sends a “repeat command” message in the NEC standard. This special «command repeat» is encoded by values D1:D0 = 0xFFFF and D3:D2 = 0xFFFF.
Note: The above IR message transmission example also implements the use of CANNY 7.2 Duo to generate a high-frequency carrier signal compliant to the NEC Standard. This is achieved using the controller’s channel #1, operating in the HF PWM mode with a period of 26 μs and a filling of 9 μs.
Receive Sony 12-bit protocol
The controller waits to receive a message containing the address 17 (CD-player) and the command code 18(increase volume). The incoming commands are checked by comparing them to constants. The incomming messages are also checked for compliance to the Sony 12-bit protocol, i.e. message length is checked.
Transmit Sony 12-bit protocol
When a negative potential is present on channel #10, the controller sends the command 18(increase voluime) to the address 17(CD-player) once. The command is sent using the 12-bit Sony protocol, i.e 12 bits are sent in one message.