This documentation is out of date.

The new version of the documentation is here: https://cannylogic.com/docs

Difference between revisions of "CANNY 7, IRRC Driver"

From CANNY Wiki
Jump to: navigation, search
[unchecked revision][unchecked revision]
(IRRC driver registers)
(IRRC driver registers)
Line 158: Line 158:
 
{|border="0" align="left"
 
{|border="0" align="left"
 
|- valign="top"
 
|- valign="top"
|style="padding-left:0.5em;"|Регистр наличия принятых данных ИК
+
|style="padding-left:0.5em;"|IRRC Data Received
 
|}
 
|}
 
|valign="top"|
 
|valign="top"|
Line 165: Line 165:
 
|width="70px" style="padding-left:0.5em;"|1
 
|width="70px" style="padding-left:0.5em;"|1
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|сообщение успешно получено и доступно в регистрах буфера приема драйвера пульта ИК ДУ;
+
|style="padding-left:0.5em;"|the message was successfully received and is available in IRRC driver receiving registers buffer;
 
|- valign="top"
 
|- valign="top"
 
|width="70px" style="padding-left:0.5em;"|0
 
|width="70px" style="padding-left:0.5em;"|0
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|в буфере приема драйвера пульта ИК ДУ отсутствуют актуальные данные.
+
|style="padding-left:0.5em;"|there is no actual data in the IRRC driver receive buffer.
 
|}
 
|}
 
|- valign="top"
 
|- valign="top"
Line 175: Line 175:
 
{|border="0" align="left"
 
{|border="0" align="left"
 
|- valign="top"
 
|- valign="top"
|style="padding-left:0.5em;"|Регистр принятого сообщения ИК b1:b0
+
|style="padding-left:0.5em;"|IRRC RX D1:D0
 
|- valign="top"
 
|- valign="top"
|style="padding-left:0.5em;"|Регистр принятого сообщения ИК b3:b2
+
|style="padding-left:0.5em;"|IRRC RX D3:D2
 
|}
 
|}
 
|valign="top"|
 
|valign="top"|
Line 184: Line 184:
 
|width="70px" style="padding-left:0.5em;"|0...65535
 
|width="70px" style="padding-left:0.5em;"|0...65535
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|значения соответствующих байт данных приемного буфера драйвера пульта ИК ДУ, по два байта на регистр.
+
|style="padding-left:0.5em;"|the values of the corresponding data bytes in the IRRC driver  receive buffer, two bytes by the register.
 
|}
 
|}
 
|}
 
|}
  
Регистры передачи драйвера пульта ИК ДУ.
+
IRRC driver transmit registers.
 
{|border="1" style="border-collapse:collapse;" align="left" width="100%"
 
{|border="1" style="border-collapse:collapse;" align="left" width="100%"
 
|- align="center" valign="top"
 
|- align="center" valign="top"
!width="250px"|Адрес
+
!width="250px"|Address
!Ожидаемые значения
+
!Expected values
 
|- valign="top"
 
|- valign="top"
 
|
 
|
 
{|border="0" align="left"
 
{|border="0" align="left"
 
|- valign="top"
 
|- valign="top"
|style="padding-left:0.5em;"|Регистр начала передачи ИК
+
|style="padding-left:0.5em;"|IRRC Request To Send
 
|}
 
|}
 
|valign="top"|
 
|valign="top"|
Line 204: Line 204:
 
|width="70px" style="padding-left:0.5em;"|1
 
|width="70px" style="padding-left:0.5em;"|1
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|загрузить данные из регистров передачи в буфер передачи драйвера пульта ИК ДУ;
+
|style="padding-left:0.5em;"|load the data from the transfer registers to the IRRC driver transmit buffer;
 
|- valign="top"
 
|- valign="top"
 
|width="70px" style="padding-left:0.5em;"|0
 
|width="70px" style="padding-left:0.5em;"|0
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|не загружать данные в буфер передачи драйвера пульта ИК ДУ.
+
|style="padding-left:0.5em;"|do not load the data from the transfer registers to the IRRC driver transmit buffer.
 
|}
 
|}
 
|- valign="top"
 
|- valign="top"
Line 214: Line 214:
 
{|border="0" align="left"
 
{|border="0" align="left"
 
|- valign="top"
 
|- valign="top"
|style="padding-left:0.5em;"|Регистр сообщения передачи ИК b1:b0
+
|style="padding-left:0.5em;"|IRRC TX D1:D0
 
|- valign="top"
 
|- valign="top"
|style="padding-left:0.5em;"|Регистр сообщения передачи ИК b3:b2
+
|style="padding-left:0.5em;"|IRRC RX D3:D2
 
|}
 
|}
 
|valign="top"|
 
|valign="top"|
Line 223: Line 223:
 
|width="70px" style="padding-left:0.5em;"|0...65535
 
|width="70px" style="padding-left:0.5em;"|0...65535
 
|style="padding-left:0.5em;"|=
 
|style="padding-left:0.5em;"|=
|style="padding-left:0.5em;"|значения передаваемых байт сообщения драйвера пульта ИК ДУ, по два байта на регистр.
+
|style="padding-left:0.5em;"|the values of IRRC driver message transmit bytes, two bytes per register.
 
|}
 
|}
 
|}
 
|}
  
Специальная команда стандарта NEC – «повтор команды», кодируется значениями b1:b0 = 0xFFFF  и b3:b2 = 0xFFFF как при приеме так и при передаче.
+
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.
  
 
{|
 
{|
|valign="top" style="padding-left:0.5em;"|''Примечание:''
+
|valign="top" style="padding-left:0.5em;"|''Note:''
|valign="top" style="padding-left:0.5em;"|''При отправке ИК-сообщений, каждая последующая команда должна передаваться только после освобождения буфера передачи, т. е. при наличии в регистре готовности буфера передачи ИК-сообщения значения «1». Команда повтора предыдущей команды должна отправляться сразу после отправки основной команды, не дожидаясь освобождения буфера передачи, при этом отправка должна выполняться непрерывно, как можно чаще, все время, пока требуется передача подтверждения.''
+
|valign="top" style="padding-left:0.5em;"|''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.
  
 
[[File:6_16_2_2.png|center]]
 
[[File:6_16_2_2.png|center]]
  
Контроллер ожидает получения сообщения, содержащего номер адреса 0х00 и команду с кодом 0х01. Проверка полученных от пульта ИК ДУ команд на соответствие ожидаемым выполняется путем их сравнения с константами, содержащими в младшем байте требуемое значение, а в старшем — его инверсную версию.
+
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.
  
Пример функциональной диаграммы эмуляции контроллером CANNY7 ИК-пульта ДУ, т.е. передачи ИК-команд управляемому устройству.
+
An example of a functional diagram of CANNY7 controller emulating an IR remote, i.e. transmission of IR commands to the controlled device.
  
 
[[File:6_16_2_3.png|center]]
 
[[File:6_16_2_3.png|center]]
  
При появлении на входе канала №10 значения «1» (нажатия управляющей кнопки), контроллер отправляет ИК-сообщение внешнему устройству. В сообщении содержится адрес 0хAB и команда 0хCD. При длительном сохранении значения «1» на входе канала №10 (удержании кнопки) контроллер отправляет сообщение стандарта NEC «повтор команды». Специальная команда стандарта NEC – «повтор команды», кодируется значениями b1:b0 = 0xFFFF  и b3:b2 = 0xFFFF как при приеме так и при передаче.
+
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.
  
 
{|
 
{|
|valign="top" style="padding-left:0.5em;"|''Примечание:''
+
|valign="top" style="padding-left:0.5em;"|''Note:''
|valign="top" style="padding-left:0.5em;"|''В примере отправки ИК-сообщения также реализовано использование CANNY7 для формирования несущего высокочастотного сигнала установленного стандартом NEC, с помощью канала №1 контроллера работающего в режиме ВЧ ШИМ с периодом 26мкс и заполнением 9мкс.''
+
|valign="top" style="padding-left:0.5em;"|''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 ==
 
== See also ==
 
[[CANNY 7]]
 
[[CANNY 7]]

Revision as of 07:12, 13 August 2016

General description

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

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
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 RX IO Channel
0...10 = to set the channel number used by IR RC driver for receiving data.
IRRC TX IO Channel
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
IR driver inactivity 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 buffer overflow register
1 = IRRC driver corresponding channel buffer overflow;
0 = IRRC driver corresponding channel buffer overflow not registered.
IR transmission buffer readiness register
1 = IRRC driver data transmissian buffer is empty and ready to go;
0 = IRRC driver data transmissian buffer is busy.

IRRC driver receive registers.

Address Return values
IRRC Data Received
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 RX D1:D0
IRRC RX 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 TX D1:D0
IRRC RX 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

CANNY 7