SPRUHZ7K August 2015 – April 2024 AM5706 , AM5708 , AM5716 , AM5718 , AM5718-HIREL
There are two methods of encoding for remote-control applications:
Japanese manufacturers favor pulse duration encoding; European manufacturers favor biphase encoding.
CIR mode uses a completely flexible free-format encoding in which 1 is transmitted from the TX FIFO as a modulated pulse with duration t.
Similarly, 0 is transmitted as a blank duration T. The MPUconstructs and deciphers the protocol of the data. For example, the RC-5 protocol using Manchester encoding can be emulated as using a 01 pair for 1 and a 10 pair for 0 (see Figure 24-52).
Because CIR mode logic does not impose a fixed format for infrared packets of data, the MPUsoftware can define the format using simple data structures that are then modulated into an industry standard, such as RC-5 or SIRC. To send a sequence of 0101 in RC-5, the MPUsoftware must write an 8-bit binary character of 10011001 to the data FIFO of the UART.
For SIRC, the modulation length (multiples of t) is used to distinguish between 1 and 0. The subsequent SIRC digits show the difference in encoding between this and, for example, RC-5. The pulse width is extended for one digit.
Figure 24-53 shows SIRC bit encoding.
To construct comprehensive packets constituting remote-control commands, the MPU software must combine a number of 8-bit data characters in a sequence that follows one of the universally accepted formats.
Figure 24-54 shows a standard RC-5 frame as detected by UART3 in CIR mode (the SIRC format follows this). Each field in RC-5 can be considered as two t pulses (digital bits) from the TX FIFO.
Where: | ||
S1, S2: | Start-bits (always 1) | |
T: | Toggle bit | |
A4..A0: | Address (or system) bits | |
C5..C0: | Command bits | |
The toggle bit T changes when a new command is transmitted to detect when the same key is pressed twice (effectively receiving the same data from the host consecutively). A brief delay in the transmission of the same command is detected by the use of the toggle bit because a code is sent while the MPUtransmits characters to the UART for transmission. The address bits define the machine or device for which the infrared transmission is intended, and the command defines the operation.
To accommodate an extended RC-5 format, the S2 bit is replaced by an additional command bit (C6) that lets the command range increase to 7 bits. This format is known as the extended RC-5 format.
SIRC encoding uses the duration of modulation for mark and space; therefore, the duration of data bits in the standard frame length varies.
Figure 24-55 shows the packet format and bit encoding. As Figure 24-56 shows, 1 start-bit of 2.4 ms and control codes are followed by data that constitute the entire frame.
The encoding must take a standard duration, but the contents of the data can vary. This implies that the control software for sending and receiving data packets must exercise a scheme of interpacket delay, where successive packets can be sent only after a real-time delay expires.
This document does not describe all encoding methods and techniques; the previous information discusses the considerations required to employ different encoding methods for different industry-standard protocols. See industry-standard documentation for specific methods of encoding and protocol use.