Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| learn:courses:unit-5:start [2017/03/24 20:07] – [Table] Martha | learn:courses:unit-5:start [2022/10/04 11:38] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Unit 5: IrDA Communications Protocols ====== | ====== Unit 5: IrDA Communications Protocols ====== | ||
| + | [[{}/ | ||
| + | [[{}/ | ||
| + | |||
| === Unit 5 Lab === | === Unit 5 Lab === | ||
| - | * [[https:// | + | * [[/ |
| === Download This Document === | === Download This Document === | ||
| - | * {{ : | + | {{ : |
| ===== 1. Introduction ===== | ===== 1. Introduction ===== | ||
| Line 18: | Line 21: | ||
| ===== 2. Objectives: ===== | ===== 2. Objectives: ===== | ||
| - | | + | |
| - | | + | |
| - | | + | |
| Line 26: | Line 29: | ||
| ===== 3. Basic Knowledge: ===== | ===== 3. Basic Knowledge: ===== | ||
| - | | + | |
| - | | + | |
| - | | + | |
| Line 36: | Line 39: | ||
| ===== 4. Unit Equipment List ===== | ===== 4. Unit Equipment List ===== | ||
| ==== 4.1. Hardware ==== | ==== 4.1. Hardware ==== | ||
| - | | + | |
| - | | + | |
| - | | + | |
| In addition, we suggest the following instruments: | In addition, we suggest the following instruments: | ||
| - | | + | |
| ==== 4.2. Software ==== | ==== 4.2. Software ==== | ||
| The following programs must be installed on your development work station: | The following programs must be installed on your development work station: | ||
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| ---- | ---- | ||
| ===== 5. Project Takeaways ===== | ===== 5. Project Takeaways ===== | ||
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| Line 84: | Line 87: | ||
| The Basys MX3 platform is equipped with a Rohm RPM973-H11 infrared communications module that provides the digital interface, as shown in Fig. 7.1. The three microprocessor control pins shown in Fig. 7.2 are the IR_TX, IR_RX, and the IR_PDOWN. The Rohm RPM973-H11 is in a low power mode whenever the IR_PDOWN control signal is in the high state. The IR_PDOWN must be in a low state to transmit or receive infrared signals. Both IR_TX and IR_RX are [[https:// | The Basys MX3 platform is equipped with a Rohm RPM973-H11 infrared communications module that provides the digital interface, as shown in Fig. 7.1. The three microprocessor control pins shown in Fig. 7.2 are the IR_TX, IR_RX, and the IR_PDOWN. The Rohm RPM973-H11 is in a low power mode whenever the IR_PDOWN control signal is in the high state. The IR_PDOWN must be in a low state to transmit or receive infrared signals. Both IR_TX and IR_RX are [[https:// | ||
| - | {{ : | + | {{ : |
| //Figure 7.1. RPM973-H11 block diagram.// | //Figure 7.1. RPM973-H11 block diagram.// | ||
| - | {{ : | + | {{ : |
| //Figure 7.2. Schematic diagram of PIC32 connection to the RPM841-H11 Infrared Module.// | //Figure 7.2. Schematic diagram of PIC32 connection to the RPM841-H11 Infrared Module.// | ||
| Line 97: | Line 100: | ||
| Figure 7.3 shows that the IR LED modulation for a 38 kHz carrier is determined as the inverse of the period between LED pulses. The LED is only on for about 2.4 μs out of the 26.3 μs carrier frequency period. The duty cycle of the LED is less than 10% resulting in lower power consumption. | Figure 7.3 shows that the IR LED modulation for a 38 kHz carrier is determined as the inverse of the period between LED pulses. The LED is only on for about 2.4 μs out of the 26.3 μs carrier frequency period. The duty cycle of the LED is less than 10% resulting in lower power consumption. | ||
| - | {{ : | + | |
| + | {{ : | ||
| //Figure 7.3. IrDA 38 kHz carrier signal.// | //Figure 7.3. IrDA 38 kHz carrier signal.// | ||
| Figure 7.4 shows a complete IrDA message using the NEC protocol. The signal is low whenever an infrared light is detected. The NEC protocol message contains 32 bits organized in eight bit bytes sent with LSB first. After a 9 ms leader and a 4.5 ms gap, a 560 μs bit marker signals the start of the LSB of the first data byte, as shown in Fig. 7.5. | Figure 7.4 shows a complete IrDA message using the NEC protocol. The signal is low whenever an infrared light is detected. The NEC protocol message contains 32 bits organized in eight bit bytes sent with LSB first. After a 9 ms leader and a 4.5 ms gap, a 560 μs bit marker signals the start of the LSB of the first data byte, as shown in Fig. 7.5. | ||
| - | {{ : | + | |
| + | {{ : | ||
| //Figure 7.4. Screen capture of a NEC IrDA control message.// | //Figure 7.4. Screen capture of a NEC IrDA control message.// | ||
| Figures 7.5 and 7.6 show expanded views of portions of the NEC IrDA protocol, showing the sync followed by three of the 24 data bits. Note that the differentiation between a ONE bit and a ZERO bit is the length of the gap following each 560 μs period of 38 kHz modulated infrared pulses. The last byte contains 9 pulse bursts to allow the last bit to be framed correctly. | Figures 7.5 and 7.6 show expanded views of portions of the NEC IrDA protocol, showing the sync followed by three of the 24 data bits. Note that the differentiation between a ONE bit and a ZERO bit is the length of the gap following each 560 μs period of 38 kHz modulated infrared pulses. The last byte contains 9 pulse bursts to allow the last bit to be framed correctly. | ||
| - | {{ : | + | {{ : |
| //Figure 7.5. Details of the message leader and first three data bits.// | //Figure 7.5. Details of the message leader and first three data bits.// | ||
| - | {{ : | + | |
| + | {{ : | ||
| //Figure 7.6. 38 kHz pulse burst timing representing two ZERO bits and a ONE bit.// | //Figure 7.6. 38 kHz pulse burst timing representing two ZERO bits and a ONE bit.// | ||
| + | |||
| Figures in Reference 4 are reproduced below to illustrate the timing of the NEC protocol. The encoding of an NEC protocol message in Fig. 7.7 shows that the entire packet consists of two bytes of data: the address byte and the command byte. Each byte is followed by its [[https:// | Figures in Reference 4 are reproduced below to illustrate the timing of the NEC protocol. The encoding of an NEC protocol message in Fig. 7.7 shows that the entire packet consists of two bytes of data: the address byte and the command byte. Each byte is followed by its [[https:// | ||
| Line 230: | Line 237: | ||
| | RPC3< | | RPC3< | ||
| | RPE9< | | RPE9< | ||
| + | |||
| + | The 38 kHz carrier signal is generated by setting the Timer 2 counter register equal to the PBCLOCK divided by 38000. The PWM output is turned off by setting the OC5 reset time greater than the Timer 2 period. The 9% duty cycle 38 kHz signal is turned on by setting the OC5 reset time to the product of 0.09 times the Timer 2 period. Generating the NEC sync signal and encoding the one’s and zero’s is just a matter of turning the PWM on and off for the specific duration, as specified by Reference 3. | ||
| + | |||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Listing 7.3. IrDA Initialization ==== | ||
| + | < | ||
| + | #define IRDA_38K_IDLE | ||
| + | #define IRDA_38K_ON | ||
| + | #define IRDA_38KHZ_PD | ||
| + | void irda_init(void) | ||
| + | { | ||
| + | int i; | ||
| + | // IrDA Power Down Control | ||
| + | | ||
| + | | ||
| + | | ||
| + | // Set up IrDA TX interface | ||
| + | | ||
| + | RPB7R = 0b00001011; | ||
| + | // Enable OC5 for PWM operation | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | // Set up IrDA RX interface | ||
| + | INT1R = 0b00000101; | ||
| + | | ||
| + | // Set up INT1 for negative edge triggering | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== 8. References ===== | ||
| + | - Remote Control, [[https:// | ||
| + | - Consumer IR, [[https:// | ||
| + | - Data Formats for IR Remote Control, [[http:// | ||
| + | - AN #157 Implementation of IR NEC Protocol, [[http:// | ||
| + | - Remote Control with IrDA® Transceivers, | ||
| + | - SB –Projects NEC Protocol, [[http:// | ||
| + | - PIC32MX330/ | ||
| + | - Understanding Sony IR remote codes, LIRC files, and the Arduino library, [[http:// | ||
| + | |||
| + | |||
| + | ---- | ||
| + | |||
| + | [[{}/ | ||
| + | [[{}/ | ||
| + | [[{}/ | ||
| + | [[{}/ | ||
| {{tag> | {{tag> | ||

