【正文】
en to decode these lengths to ones and zeros and display them on the two digit display. Also a HOLD flag can be created which will be true as long as the button is being held down. Usually 1/8 second between mands indicates a new mand. Use this value to time out HOLD times and times between mands. is an example of a program that translates the gap lengths of the NEC6121 format to the four bytes that make up the information in each mand.Step 7:Create a button to code cross reference table implements a lookup table to translate the codes received to the actual button pressed. A counter is loaded with the highest number button that can be pressed, and the code is then looked up and pared with the code that was received. If no match, the counter is decremented until a match is found. When found, the counter then has the button number that was pressed. Note too, that more checking may be done at this level on some formats, such as having an address, a plement of the code following the code itself for checking. The result from all of the steps in decoding is that if a button is pressed on a remote control, that button number appears in a PIC16C57 file location. A mand such as channel up or channel down will appear as two set flags, one to indicate the mand, the other to indicate that it is active, HOLD. From this point the application can access these flags and files to respond appropriately.Note the following details of the code protection feature on PICmicro 174。, and what, in the format, defines a 39。.HARDWARE DESCRIPTIONThe schematic in Figure 1 shows a tool that can be made to aid development of infrared receiver code. The schematic consists of a PIC16C57 connected to one of two available infrared receivers. One receiver is for nonmodulated signals, the other for modulated signals. Modulated receivers are available from Sharp and Lite On, part numbers GP1U521Y and LT1060 respectively. The nonmodulated type is available from Quality Technologies part number QSE157QT.The choice of the PIC16C57 is not indicative of the processing power required for decoding. Typical IR receiver code can ?t into less than half the ROM space available in a PIC16C54, and uses four RAM choice of a PIC16C57 in this case was driven by the need to store a lot of signal lengths for later reading.A ceramic resonator clocks the PIC16C57. It will give adequate frequency accuracy to determine pulse and gap lengths. A RC network does not usually have adequate accuracy. A button is available for resetting the PIC16C57, and four jumpers are provided to control the application startup. The two digit display is multiplexed and driven through Q1 and Q2.Three octal switches are used as inputs to control the OPTION register and which ?le is displayed. The whole circuit derives its power from a 9V, 200 m A wall mounted supply. U1 regulates the 9V down to 5V for the PIC16C57 and associated circuitry.DESCRIPTION OF SOFTWARE TO AID DEVELOPMENTThis application uses four different firmware files. IRMAIN. ASM controls the selection of the three application files. The first file is MEASURE. ASM which stores the infrared burst and gap lengths into memory and allows playback of that decodes NEC6121 infrared format and displays the received codes on the LED display. The final file, , shows the final firmware for decoding the infrared format for a Teknika Television. The firmware listed includes three applications that will aid in designing an infrared control system. IRMAIN. ASM reads jumpers 1 and 2 and directs program flow after reset to one of the three applications. Having no jumper in 2 will direct program flow to jumper in 2 only will direct program flow to in both 1 and 2 will direct program flow to TEKNIKA. ASM. Jumpers 3 and 4 are not used.This is the most basic and most useful of the three applications. This program stores the infrared burst and gap lengths into memory, allowing playback of the measure ments through the two digit display. It allows external control of the OPTION register also, through setting of SW1 is read directly into the OPTION register prescaler value for SW1 is changed during program opera