CANNY 7, IRRC Driver

From CANNY Wiki
Jump to: navigation, search

General description[edit]

CANNY 7 controller can receive and send infrared remote controls commands (IRRC) in popular formats- NEC and extended NEC. 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, channel used for this only generates baseband signal. To generate pulse packet, controller requires a carrier frequency, the source of which can be internal high frequency PWM channel or external PWM generator. Receiving IR command requires an external demodulator, such as TSOP1736 or similar.

IRRC driver in its operation uses the resources of controller channels, but has a higher priority than discrete input-output driver. Thus, upon IRRC driver activation, for the involved channels in its operation, changing values in registers associated controllers' discrete input-output driver will be ignored.

IRRC driver registers[edit]

To work with IR signal receivers and transmitters may be used any of CANNY 7 controller IO channels, wherein a particular channel of the controller, at any given moment, can only operate either for reception or transmission only. IR remote control driver provides the possibility to organize simultaneous reception and transmission via two independent channels. Furthermore it is possible to connect several IR signal receivers / transmitters to CANNY 7 controller.

IR RC Driver Configuration Registers.

Address Expected values
IRRC Mode Setup Register
1...65535 = to set IR RC channel driver configuration that determines the current mode and the parameters of its operation (set special constant of constants reference book);
0 = disconnect the channel from IR RC driver, return control to IO channel driver and allow changing its status from the functional diagram.
IRRC Receive IO Channel Select Register
0...10 = to set the channel number used by IR RC driver for receiving data.
IRRC Transmit IO Channel Select Register
0...10 = to set the channel number used by IR RC driver for transmitting data.
Note: In the configuration of "reception and transmission" separate controller channels must be assigned for receiving and transmitting data.

Driver configuration is set by named constants, representing the combination of parameters that define the type of signal that determines the electric potentials of the initial state of the channel and the channel conditions during data transmission, and the availability of internal "pull-up" potential of controller channel.

Parameter List of expected values
Standart NEC
The data flow direction Receive, transmit, receive and transmit
Signal type Direct ("1": plus, "0" minus), inverse ("1" minus "0": plus)
Internal pull-up No pull-up, positive pull-up, negative pull-up

Example of configuration IR RC driver to operate as a transmitter / receiver IR signals, wherein channel #0 is used for receiving data, and channel #1 for date transmission.

6 16 2 1.png

IRRC driver diagnostic registers.

Address 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 = IRRC driver corresponding channel buffer overflow;
0 = IRRC driver corresponding channel buffer overflow not registered.
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.

IRRC driver receive registers.

Address Return values
IRRC Data Set Ready Register
1 = the message was successfully received and is available in IRRC driver receiving registers buffer;
0 = there is no actual data in the IRRC driver receive buffer.
IRRC Received Data Register D1:D0
IRRC Received Data Register D3:D2
0...65535 = the values of the corresponding data bytes in the IRRC driver receive buffer, two bytes by the register.

IRRC driver transmit registers.

Address 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...65535 = the values of IRRC driver message transmit bytes, two bytes per register.

Special command of the NEC Standard – «command repeat», coded by values D1:D0 = 0xFFFF and D3:D2 = 0xFFFF as for reception as well as for transmission.

Note: To send IR messages, each subsequent command should be transferred only after release of the send buffer, ie in the presence of value "1" in the IR TX set ready buffer. The command of Repeat of the previous command should be sent immediately after sending the first command, without waiting for the release of the transmit buffer. wherein sending to be performed continuously, as often as possible, as long as the transfer confirmation required.

An example of a functional diagram of the controller receiving commands from an external IR remote control.

6 16 2 2.png

The controller waits to receive a message containing the address 0х00 and a command code 0х01. Checking commands, received from the IRRC to meet the expected values performed by comparing them with constants, containing in the low byte the desired value, and in the high - its inverted version.

An example of a functional diagram of CANNY7 controller emulating an IR remote, i.e. transmission of IR commands to the controlled device.

6 16 2 3.png

During presence of value "1" on the input channel #10 (pressing the control button), controller sends an IR message to an external device. The message contains the address 0хAB and command 0хCD. With prolonged presence of the value "1" at the input channel #10 (holding down button) the controller sends a message in the NEC standard "repeat command". Special command of the NEC Standard – «command repeat», coded by values D1:D0 = 0xFFFF and D3:D2 = 0xFFFF as for reception as well as for transmission.

Note: In the example of IR message send also implemented the use of CANNY7 to generate a high-frequency carrier signal complain to the NEC Standard, based on controller's channel #1, operating in the HF PWM mode with period 26mks and filling 9mks.

See also[edit]

CANNY 7