SlideShare a Scribd company logo
1 of 10
Download to read offline
TITLE                   : Implementing Wireless Remote Control Using Radio Frequency Module
NAME                    : Thian Nyuk How
Matrix Number           : HK2006-3092
DATE                    : 24 MARCH 2009



Abstract:

        This application note is about implementing wireless remote control using a Radio Frequency
(RF) module interface with microcontroller. Asynchronous mode in Universal Synchronous and
Asynchronous Receiver Transmitter (USART) will be introduced in interfacing the RF module with a
microcontroller.

1.0 Introduction:

        Radio frequency (RF) usually refers to oscillations in electrical circuits. It is normally use in
wireless communication system to transmit data. By modulating data signals onto the RF carrier signal,
data can be transfer from one point to the other point easily. In this application note, a pair of RF module
with a frequency of 433 MHz is used.

        To interface RF module with microcontroller, Universal Synchronous and Asynchronous
Receiver and Transmitter (USART) or also known as Serial Communications Interface is used. USART is
used for transmit and receive serial data. The operation of USART can be divided into two types which is
synchronous and asynchronous. Synchronous mode uses a clock and data line. Asynchronous mode does
not use clock accompanying the data.. However in this application note, only asynchronous mode will be
use in interfacing the RF module with the microcontroller.

2.0 Objective:

        Interface a RF module with microcontroller to build a wireless remote control.
3.0 Hardware:




                                RF Transmitter Module (433MHz)

                       Specifications                       RF Transmitter Module
                      Operating Voltage                           3V to 12 V
                      Operating Current                   Max: 400mA for 12 V supply
                                                            Min: 9mA for 3V supply
                          Frequency                                433MHz
                         Transfer Rate                             10Kbps
                        Antenna Length                               18cm
                               Table 1.1 Specification of RF Transmitter Module

        There are 3 pins to connect in the RF Transmitter module. The DATA pin is connected to the TX
pin of the Microcontroller. VCC pin connect to the supply voltage and GND connect to ground. The
antenna can extend with any wire but for better result, a 50 Ohm coaxial cable is used. The length of the
wire as antenna is about 18cm long.




                                      RF Receiver Module (433MHz)
Specifications                        RF Receiver Module
                        Operating Voltage                          5.0V ± 0.5V
                        Operating Current                     ≤5.5mA for 5.0V supply
                           Frequency                                 433MHz
                          Transfer Rate                               10Kbps
                         Antenna Length                                18cm
                                 Table 1.2 Specifications of RF Receiver Module

        There are 5 pin to connect for the RF receiver module. The DATA pin of the RF Receiver
Module is connecting to the RX pin of microcontroller. The VCC pin connects to the 5v supply and the
GND pin to ground. The ANT is the antenna of the receiver and can be extend with any wire. The length
of the wire is 18cm for better result.

4.0Interface RF Transmitter and Receiver with Microcontroller:

4.1 Register and Flag bit Description which will be used :

                   Register Name                                              Description
                       TXSTA                                         Transmit Status and Control
                       RCSTA                                          Receive Status and Control
                       TXREG                                         Write Transmit Data Register
                       RCREG                                         Write Receive Data Register
                       SPBRG                                               Setting Baud Rate
                        PIR1                                       Peripheral Interrupt Flag Register
                        PIE1                                     Peripheral Interrupt Enable Registers
                           Table 1.3 Register and Description which will be used

                   Flag Bit Name                                              Description
                        TXIF                                 Located in PIR1 (bit 4) which is use to check
                                                                   whether TXREG is Full or Empty
                        RCIF                                 Located in PIR1 (bit 5) which is use to check
                                                                   whether RCREG is Full or Empty
                       OERR                                 To test over run error for the RCREG Register
                       TXEN                                         Transmit Enable of Disable bit
                               Table 1.4 Description of flag bit that will be used
4.2Interfacing Transmitter with Microcontroller PIC16F628A:




                              Figure 1.1 Remote Control (Transmitter circuit)

        In the schematic of the remote control show in Figure 1.1, the microcontroller used is
PIC16F628A. To connect a RF transmitter module with PIC16F628A, the data pin of the transmitter need
to connect to the TX pin of the PIC which is pin 8 for PIC16F628A. TX pin is for the use of serial
communication interface which will transfer 8 bit data to the transmitter to be transmit. To enable the TX
port as a serial port, SPEN which is bit 7 in RCSTA have to be set. Bit two in TRISB of PIC16f628A
have two be clear in order to make the TX pin as an output pin. TXSTA is the transmit control register for
the PIC. This register has to be initializing correctly in order to make the transmitter work. By referring to
the data sheet, the source code in this application note, the TXSTA is initialized as B'00100000' which
mean that it transmit 8bit data in asynchronous low speed mode. Figure 1.2 shows the representation of
each bit of the TXSTA register. Next is to set the baud rate of the transmitter.
Figure 1.2 Representation of Each Bit in TXSTA Register

Baud rate refers to the speed at which the serial data is transferred, in bits per second. In Asynchronous
mode, the baud rate generator sets the baud rate using the value in the SPBRG register. The BRGH bit in
TXSTA selects between high and low speed options for greater flexibility in setting the baud rate. From
the initialization of TXSTA shown above, the BRGH is clear which mean that the baud rate is in low
speed and the SPBRG register in this application note’s source code is set to 255. The Baud rate for both
transmitter and receiver must be the same in order for the data transmitted to receive in the receiver.
When a digital data is being transmitted, it is transmit from the less significant bit to the most significant
bit. This means that the transmitter transmits digital data bit by bit to the receiver. Figure 1.3 show how
the signal is transfer in asynchronous mode.




                             Figure 1.3 Signal Transfer in Asynchronous mode
From Figure 1.3 the signal is high when no transmission (or reception) is in progress and goes
low when the transmission starts. The receiving device uses this low-going transition to determine the
timing for the bits that follow. The signal stays low for the duration of the START bit, and is followed by
the data bits, Least Significant bit first. The USART can transmit and receive either eight or nine data bits.
The STOP bit follows the last data bit and is always high. The transmission therefore ends with the pin
high. After the STOP bit has completed, the START bit of the next transmission can occur as shown by
the dotted lines.

        During transmitting data, the heart of the transmitter is the Transmit Shift Register (TSR). This
register obtain the data from the transmit buffer, TXREG. Hence, to transmit a data to the receiver, first is
to move the desire transmit data to the TXREG then it will load to TSR to be transmitted. To check
whether the data in TXREG had been move to TSR, the flag bit TXIF which located in the PIR1 is
checked. If TXREG is empty (means the data already load to TSR) the flag bit TXIF will be set. Hence
new data can be load to TXREG to be transmitted next. The Bit TXEN in TXSTA show in Figure 1.2 is
always set so that all the data in TSR will be transmit. Appendix 8.1 shows the sample code of transmit a
data.




                                        Check TXIF               False


                                            True


                                       Move Digit 9
                                       to TXREG to be
                                       transmitted




                    Figure 1.4 Block Diagram Showing the transmitter’s program runs
4.3 Interfacing RF Receiver Module with microcontroller:




                             Figure 1.5 A Testing Receiver Circuit (Receiver Circuit)

            In the schematic of the receiver circuit show in Figure 1.5, the microcontroller used is
PIC16F877A. To connect the RF Receiver Module to PIC16F877A, the data pin of the receiver is
connected to the RX pin which is pin 26 for PIC16F877A. RX pin is for the use of serial communication
interface which will receive the 8 bit data from the transmitter for further process. Before the receiver able
to receive any data from the transmitter and provide to the PIC for further process, initialization for the
PIC is needed.

            RCSTA is the receive control register for the PIC. This register has to be initializing correctly in
order to make the receiver work. By referring to the data sheet, for the source code of this application note,
RCSTA is initialized as B'10010000' which mean that it continuously receive 8 bit data, asynchronous
mode. The SPEN Flag bit in RCSTA have to be set to enable the serial port. The baud rate for the receiver
has to be the same with the transmitter. Figure 1.6 shows the representation of each bit of the RCSTA
register.
Figure 1.6 Representation of Each Bit in RCSTA Register.

        When receiving data from the transmitter, the data is first stall in Receive Shift Register (RSR).
After that the received data is transferred to the RCREG register when it is empty. Once the transferring
process from the RSR to RCREG is complete, the flag bit RCIF will be set. The RCREG is a double-
buffered register which mean that it can store two byte of data. When the 2nd data come in but the 1st data
have not been read yet, the data will store in the second slot of the RCREG. When the 1st data is read, the
2nd data will move to the 1st slot and new data can be move into RCREG. However, when the RCREG is
full and the 3rd data is store in the RSR, the flag bit OERR will be set and the data in RSR will lost. In
addition, all the receive process will be stop. Hence it is a must to clear the flag bit OERR in order to
retrieve the receiving process. Flag bit OERR can be clear by first clear the CREN and then set it again.
Appendix 8.2 shows the sample code to receive date from receiver.
The test receiver circuit show in schematic is connected with two LED which is used to test
whether the receiver receive data from the transmitter. If it receive the correct data from the transmitter,
will either on or off based on the desire of user to program it.



                                                                                               False


                                                        Move data from
             Check RCIF               TRUE                                          Identify the data receive
                                                        RCREG to a file


                                                                                               True
          False

                                                                                            Activate
                                                                                            Dog Collar


                                   Figure 1.7 Block diagram showing the receiver’s program runs

5.0 Result:
A brief experiment is conducted to test the range of the RF remote control range.

                     Condition                                                Outcome
                  Without Antenna                                  Receive Range less than 5 meters
        With antenna in closed surrounding                          Receive range about 25 meters
        With Antenna in open surrounding                            Receive range about 35 meters
         Table 1.5 experimental result of the range of the RF remote control in different condition

Another experiment is conducted to test the interference upon the RF module with RF module of different
frequency. It is proved that the RF module will not be interfering by the RF module of different frequency.
However when two same frequency of transmitter is transmitting data, the receiver will receive error
signal which is not the exact signal from both transmitter.

6.0 Conclusion:
The RF module perform a satisfy range as a wireless remote control and able to transfer signal through
obstacles. Interfacing the RF module with microcontroller through USART shows a stable performance
from both the transmitter and receiver.
7.0 References:

   1. Microcontroller Programming, The Microchip PIC, Juliao Sanchez, Maria P.Canton (e-book)
   2. Data Sheet Microchip PIC16F877A
   3. Data Sheet Microchip PIC16F628A

8.0 Appendix:
8.1 Sample Assembly code of transmit a digit 9 continuously

 Transmit    ; to transmit a digit 9

 BANKSEL         PIR1

 BTFSS           PIR1, TXIF ;check flag bit TXIF

 GOTO            Transmit

 MOVLW           D'9'      ; move digit 9 to TXREG

 BANKSEL         TXREG

 MOVWF           TXREG

 GOTO            Transmit


8.2 Sample code of Reciever Receiving Data 9 from Transmitter

 Receive         MOVLW                 D'9'

                 MOVWF                 H1            ; move digit 9 to file H1

                 BANKSEL               PIR1

                 BTFSS                 PIR1,RCIF     ; check if RCIF is set

                 GOTO                  $-1

                 BANKSEL               RCREG         ; receive complete

                 MOVF                  RCREG,W

                 MOVWF                 D1            ; move receive data to D1

                 MOVF                  D1,W

                 SUBWF                 H1,0          ; check receive data

                 BTFSC                 STATUS,Z

                 GOTO                  Receive       ; wrong data re-loop

                 GOTO                  On_LED

More Related Content

What's hot

Experiment 2 - Frequency Modulator (FM)
Experiment 2  -  Frequency Modulator (FM)Experiment 2  -  Frequency Modulator (FM)
Experiment 2 - Frequency Modulator (FM)AIMST University
 
Dual use power line for Design_For_Teastability a Cmos Reciver Design
Dual use power line for Design_For_Teastability a Cmos Reciver DesignDual use power line for Design_For_Teastability a Cmos Reciver Design
Dual use power line for Design_For_Teastability a Cmos Reciver DesignBHUSHAN MHASKE
 
Auto selection of any aviliable phase
Auto selection of any aviliable phaseAuto selection of any aviliable phase
Auto selection of any aviliable phasenajeebs10
 
RF MODULE Part-15
RF MODULE Part-15RF MODULE Part-15
RF MODULE Part-15Techvilla
 
DESIGN OF HIGH EFFICIENCY TWO STAGE POWER AMPLIFIER IN 0.13UM RF CMOS TECHNOL...
DESIGN OF HIGH EFFICIENCY TWO STAGE POWER AMPLIFIER IN 0.13UM RF CMOS TECHNOL...DESIGN OF HIGH EFFICIENCY TWO STAGE POWER AMPLIFIER IN 0.13UM RF CMOS TECHNOL...
DESIGN OF HIGH EFFICIENCY TWO STAGE POWER AMPLIFIER IN 0.13UM RF CMOS TECHNOL...VLSICS Design
 
Application of NarrowBand Power Line Communication in Medium Voltage Smart Di...
Application of NarrowBand Power Line Communication in Medium Voltage Smart Di...Application of NarrowBand Power Line Communication in Medium Voltage Smart Di...
Application of NarrowBand Power Line Communication in Medium Voltage Smart Di...IRJET Journal
 
Experiment 3 - Pulse Amplitude Modulator (PAM)
Experiment 3  -  Pulse Amplitude Modulator (PAM)Experiment 3  -  Pulse Amplitude Modulator (PAM)
Experiment 3 - Pulse Amplitude Modulator (PAM)AIMST University
 
Bit Error Rate for M- DPSK on Rayleigh Channel
Bit Error Rate for M- DPSK on Rayleigh ChannelBit Error Rate for M- DPSK on Rayleigh Channel
Bit Error Rate for M- DPSK on Rayleigh Channelijsrd.com
 
Synchronization of single phase power converters to grid
Synchronization of single phase power converters to gridSynchronization of single phase power converters to grid
Synchronization of single phase power converters to gridSyed Lateef
 
LED Chaser /Sequencer
 LED Chaser /Sequencer  LED Chaser /Sequencer
LED Chaser /Sequencer Haris Hassan
 
Datasheet Ad633
Datasheet Ad633Datasheet Ad633
Datasheet Ad633saragbr
 
Online detection and locating of faulty nodes using
Online detection and locating of faulty nodes using  Online detection and locating of faulty nodes using
Online detection and locating of faulty nodes using Shanid Pazhamkavil
 
Wireless Power Transmission for Mobile Charging
Wireless Power Transmission for Mobile ChargingWireless Power Transmission for Mobile Charging
Wireless Power Transmission for Mobile ChargingIRJET Journal
 
LTC4263 - PSE Controller with Internal Switch
LTC4263 - PSE Controller with Internal SwitchLTC4263 - PSE Controller with Internal Switch
LTC4263 - PSE Controller with Internal SwitchPremier Farnell
 

What's hot (17)

Experiment 2 - Frequency Modulator (FM)
Experiment 2  -  Frequency Modulator (FM)Experiment 2  -  Frequency Modulator (FM)
Experiment 2 - Frequency Modulator (FM)
 
Dual use power line for Design_For_Teastability a Cmos Reciver Design
Dual use power line for Design_For_Teastability a Cmos Reciver DesignDual use power line for Design_For_Teastability a Cmos Reciver Design
Dual use power line for Design_For_Teastability a Cmos Reciver Design
 
Led chaser
Led chaserLed chaser
Led chaser
 
Auto selection of any aviliable phase
Auto selection of any aviliable phaseAuto selection of any aviliable phase
Auto selection of any aviliable phase
 
RF MODULE Part-15
RF MODULE Part-15RF MODULE Part-15
RF MODULE Part-15
 
DESIGN OF HIGH EFFICIENCY TWO STAGE POWER AMPLIFIER IN 0.13UM RF CMOS TECHNOL...
DESIGN OF HIGH EFFICIENCY TWO STAGE POWER AMPLIFIER IN 0.13UM RF CMOS TECHNOL...DESIGN OF HIGH EFFICIENCY TWO STAGE POWER AMPLIFIER IN 0.13UM RF CMOS TECHNOL...
DESIGN OF HIGH EFFICIENCY TWO STAGE POWER AMPLIFIER IN 0.13UM RF CMOS TECHNOL...
 
Application of NarrowBand Power Line Communication in Medium Voltage Smart Di...
Application of NarrowBand Power Line Communication in Medium Voltage Smart Di...Application of NarrowBand Power Line Communication in Medium Voltage Smart Di...
Application of NarrowBand Power Line Communication in Medium Voltage Smart Di...
 
Experiment 3 - Pulse Amplitude Modulator (PAM)
Experiment 3  -  Pulse Amplitude Modulator (PAM)Experiment 3  -  Pulse Amplitude Modulator (PAM)
Experiment 3 - Pulse Amplitude Modulator (PAM)
 
Bit Error Rate for M- DPSK on Rayleigh Channel
Bit Error Rate for M- DPSK on Rayleigh ChannelBit Error Rate for M- DPSK on Rayleigh Channel
Bit Error Rate for M- DPSK on Rayleigh Channel
 
Synchronization of single phase power converters to grid
Synchronization of single phase power converters to gridSynchronization of single phase power converters to grid
Synchronization of single phase power converters to grid
 
Rf module interfacing
Rf module interfacingRf module interfacing
Rf module interfacing
 
LED Chaser /Sequencer
 LED Chaser /Sequencer  LED Chaser /Sequencer
LED Chaser /Sequencer
 
Heat Sensitive Switch
Heat Sensitive SwitchHeat Sensitive Switch
Heat Sensitive Switch
 
Datasheet Ad633
Datasheet Ad633Datasheet Ad633
Datasheet Ad633
 
Online detection and locating of faulty nodes using
Online detection and locating of faulty nodes using  Online detection and locating of faulty nodes using
Online detection and locating of faulty nodes using
 
Wireless Power Transmission for Mobile Charging
Wireless Power Transmission for Mobile ChargingWireless Power Transmission for Mobile Charging
Wireless Power Transmission for Mobile Charging
 
LTC4263 - PSE Controller with Internal Switch
LTC4263 - PSE Controller with Internal SwitchLTC4263 - PSE Controller with Internal Switch
LTC4263 - PSE Controller with Internal Switch
 

Viewers also liked

Corpakis wide slovenia6416
Corpakis wide slovenia6416Corpakis wide slovenia6416
Corpakis wide slovenia6416Dimitri Corpakis
 
"Опыт создания системы управления сборкой и тестированием" (слайдкаст)
"Опыт создания системы управления сборкой и тестированием" (слайдкаст)"Опыт создания системы управления сборкой и тестированием" (слайдкаст)
"Опыт создания системы управления сборкой и тестированием" (слайдкаст)SPB SQA Group
 
ICT SHSM
ICT SHSMICT SHSM
ICT SHSMpaynea
 
Medicion Del Stress
Medicion Del StressMedicion Del Stress
Medicion Del Stresspelon600
 
Desarrollo de Proyecto de aula
Desarrollo de Proyecto de aula Desarrollo de Proyecto de aula
Desarrollo de Proyecto de aula omar
 
Authority and Respect
Authority and RespectAuthority and Respect
Authority and Respectarshiaaziz
 
안드로이드스터디 8
안드로이드스터디 8안드로이드스터디 8
안드로이드스터디 8jangpd007
 
자바스터디 3 3
자바스터디 3 3자바스터디 3 3
자바스터디 3 3jangpd007
 
как избавиться от живота
как избавиться от животакак избавиться от живота
как избавиться от животаMark Klein
 
Instructional ppt
Instructional pptInstructional ppt
Instructional pptJessWalker1
 
Thesis_AnoukKon_421037_1662016
Thesis_AnoukKon_421037_1662016Thesis_AnoukKon_421037_1662016
Thesis_AnoukKon_421037_1662016anoukkonQompas
 
D:\documents and settings\informatica\escritorio\collage ninos indigo[1]
D:\documents and settings\informatica\escritorio\collage ninos indigo[1]D:\documents and settings\informatica\escritorio\collage ninos indigo[1]
D:\documents and settings\informatica\escritorio\collage ninos indigo[1]Paola
 
Trip attraction rates of shopping centers in dhanmondi area of dhaka city final
Trip attraction rates of shopping centers in dhanmondi area of dhaka city finalTrip attraction rates of shopping centers in dhanmondi area of dhaka city final
Trip attraction rates of shopping centers in dhanmondi area of dhaka city finalTeletalk Bangladesh Ltd
 
Primary maker for sd36
Primary maker for sd36Primary maker for sd36
Primary maker for sd36Kevin Amboe
 
מצגת חדשה לילדים-__2011
מצגת חדשה לילדים-__2011מצגת חדשה לילדים-__2011
מצגת חדשה לילדים-__2011benny
 
Educatieve spelen voor upload naar moodle
Educatieve spelen voor upload naar moodleEducatieve spelen voor upload naar moodle
Educatieve spelen voor upload naar moodleCVO-SSH
 
Shot count/ description.
Shot count/ description.Shot count/ description.
Shot count/ description.afrostwick
 

Viewers also liked (20)

Corpakis wide slovenia6416
Corpakis wide slovenia6416Corpakis wide slovenia6416
Corpakis wide slovenia6416
 
"Опыт создания системы управления сборкой и тестированием" (слайдкаст)
"Опыт создания системы управления сборкой и тестированием" (слайдкаст)"Опыт создания системы управления сборкой и тестированием" (слайдкаст)
"Опыт создания системы управления сборкой и тестированием" (слайдкаст)
 
Unagi
UnagiUnagi
Unagi
 
Job
JobJob
Job
 
ICT SHSM
ICT SHSMICT SHSM
ICT SHSM
 
Medicion Del Stress
Medicion Del StressMedicion Del Stress
Medicion Del Stress
 
Desarrollo de Proyecto de aula
Desarrollo de Proyecto de aula Desarrollo de Proyecto de aula
Desarrollo de Proyecto de aula
 
Authority and Respect
Authority and RespectAuthority and Respect
Authority and Respect
 
안드로이드스터디 8
안드로이드스터디 8안드로이드스터디 8
안드로이드스터디 8
 
자바스터디 3 3
자바스터디 3 3자바스터디 3 3
자바스터디 3 3
 
как избавиться от живота
как избавиться от животакак избавиться от живота
как избавиться от живота
 
Instructional ppt
Instructional pptInstructional ppt
Instructional ppt
 
Thesis_AnoukKon_421037_1662016
Thesis_AnoukKon_421037_1662016Thesis_AnoukKon_421037_1662016
Thesis_AnoukKon_421037_1662016
 
D:\documents and settings\informatica\escritorio\collage ninos indigo[1]
D:\documents and settings\informatica\escritorio\collage ninos indigo[1]D:\documents and settings\informatica\escritorio\collage ninos indigo[1]
D:\documents and settings\informatica\escritorio\collage ninos indigo[1]
 
Trip attraction rates of shopping centers in dhanmondi area of dhaka city final
Trip attraction rates of shopping centers in dhanmondi area of dhaka city finalTrip attraction rates of shopping centers in dhanmondi area of dhaka city final
Trip attraction rates of shopping centers in dhanmondi area of dhaka city final
 
Joaninha
JoaninhaJoaninha
Joaninha
 
Primary maker for sd36
Primary maker for sd36Primary maker for sd36
Primary maker for sd36
 
מצגת חדשה לילדים-__2011
מצגת חדשה לילדים-__2011מצגת חדשה לילדים-__2011
מצגת חדשה לילדים-__2011
 
Educatieve spelen voor upload naar moodle
Educatieve spelen voor upload naar moodleEducatieve spelen voor upload naar moodle
Educatieve spelen voor upload naar moodle
 
Shot count/ description.
Shot count/ description.Shot count/ description.
Shot count/ description.
 

Similar to 14849441 rf-wireless (1)

Micro c lab8(serial communication)
Micro c lab8(serial communication)Micro c lab8(serial communication)
Micro c lab8(serial communication)Mashood
 
2.4G Radio Transceiver for IEEE802.15.4 and ZigBee Applications
2.4G Radio Transceiver for IEEE802.15.4 and ZigBee Applications2.4G Radio Transceiver for IEEE802.15.4 and ZigBee Applications
2.4G Radio Transceiver for IEEE802.15.4 and ZigBee ApplicationsPremier Farnell
 
serial-200505101453.pdf
serial-200505101453.pdfserial-200505101453.pdf
serial-200505101453.pdfKiranG731731
 
Serial Communication
Serial CommunicationSerial Communication
Serial CommunicationUshaRani289
 
Achieving Reduced Area and Power with Multi Bit Flip-Flop When Implemented In...
Achieving Reduced Area and Power with Multi Bit Flip-Flop When Implemented In...Achieving Reduced Area and Power with Multi Bit Flip-Flop When Implemented In...
Achieving Reduced Area and Power with Multi Bit Flip-Flop When Implemented In...IJERA Editor
 
ISM Band Sub-GHz RF Transceiver
ISM Band Sub-GHz RF TransceiverISM Band Sub-GHz RF Transceiver
ISM Band Sub-GHz RF TransceiverPremier Farnell
 
accelerometer based robot.pptx
accelerometer based robot.pptxaccelerometer based robot.pptx
accelerometer based robot.pptxKishor Mhaske
 
Vlsi implementation ofdm
Vlsi implementation ofdmVlsi implementation ofdm
Vlsi implementation ofdmManas Verma
 
Efficient Design of Transceiver for Wireless Body Area Networks
Efficient Design of Transceiver for Wireless Body Area NetworksEfficient Design of Transceiver for Wireless Body Area Networks
Efficient Design of Transceiver for Wireless Body Area NetworksIOSR Journals
 
Universal Asynchronous Receive and transmit IP core
Universal Asynchronous Receive and transmit IP coreUniversal Asynchronous Receive and transmit IP core
Universal Asynchronous Receive and transmit IP coreAneesh Raveendran
 
Microcontrollers and microprocessors in electrical communication engineering....
Microcontrollers and microprocessors in electrical communication engineering....Microcontrollers and microprocessors in electrical communication engineering....
Microcontrollers and microprocessors in electrical communication engineering....ANKUSH445845
 
RF transmitter & receiver
RF transmitter & receiverRF transmitter & receiver
RF transmitter & receivercodexdesign
 

Similar to 14849441 rf-wireless (1) (20)

Rf module
Rf moduleRf module
Rf module
 
8051 serial communication-UART
8051 serial communication-UART8051 serial communication-UART
8051 serial communication-UART
 
UART
UARTUART
UART
 
Micro c lab8(serial communication)
Micro c lab8(serial communication)Micro c lab8(serial communication)
Micro c lab8(serial communication)
 
12 mt06ped019
12 mt06ped019 12 mt06ped019
12 mt06ped019
 
2.4G Radio Transceiver for IEEE802.15.4 and ZigBee Applications
2.4G Radio Transceiver for IEEE802.15.4 and ZigBee Applications2.4G Radio Transceiver for IEEE802.15.4 and ZigBee Applications
2.4G Radio Transceiver for IEEE802.15.4 and ZigBee Applications
 
serial-200505101453.pdf
serial-200505101453.pdfserial-200505101453.pdf
serial-200505101453.pdf
 
Serial Communication
Serial CommunicationSerial Communication
Serial Communication
 
Achieving Reduced Area and Power with Multi Bit Flip-Flop When Implemented In...
Achieving Reduced Area and Power with Multi Bit Flip-Flop When Implemented In...Achieving Reduced Area and Power with Multi Bit Flip-Flop When Implemented In...
Achieving Reduced Area and Power with Multi Bit Flip-Flop When Implemented In...
 
Chap10
Chap10Chap10
Chap10
 
ISM Band Sub-GHz RF Transceiver
ISM Band Sub-GHz RF TransceiverISM Band Sub-GHz RF Transceiver
ISM Band Sub-GHz RF Transceiver
 
accelerometer based robot.pptx
accelerometer based robot.pptxaccelerometer based robot.pptx
accelerometer based robot.pptx
 
Vlsi implementation ofdm
Vlsi implementation ofdmVlsi implementation ofdm
Vlsi implementation ofdm
 
Efficient Design of Transceiver for Wireless Body Area Networks
Efficient Design of Transceiver for Wireless Body Area NetworksEfficient Design of Transceiver for Wireless Body Area Networks
Efficient Design of Transceiver for Wireless Body Area Networks
 
Zigbee 802-15-4
Zigbee 802-15-4Zigbee 802-15-4
Zigbee 802-15-4
 
Universal Asynchronous Receive and transmit IP core
Universal Asynchronous Receive and transmit IP coreUniversal Asynchronous Receive and transmit IP core
Universal Asynchronous Receive and transmit IP core
 
Microcontrollers and microprocessors in electrical communication engineering....
Microcontrollers and microprocessors in electrical communication engineering....Microcontrollers and microprocessors in electrical communication engineering....
Microcontrollers and microprocessors in electrical communication engineering....
 
pbchwp
pbchwppbchwp
pbchwp
 
RF transmitter & receiver
RF transmitter & receiverRF transmitter & receiver
RF transmitter & receiver
 
MIB_in_LTE_vs_NBIoT
MIB_in_LTE_vs_NBIoTMIB_in_LTE_vs_NBIoT
MIB_in_LTE_vs_NBIoT
 

Recently uploaded

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 

Recently uploaded (20)

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 

14849441 rf-wireless (1)

  • 1. TITLE : Implementing Wireless Remote Control Using Radio Frequency Module NAME : Thian Nyuk How Matrix Number : HK2006-3092 DATE : 24 MARCH 2009 Abstract: This application note is about implementing wireless remote control using a Radio Frequency (RF) module interface with microcontroller. Asynchronous mode in Universal Synchronous and Asynchronous Receiver Transmitter (USART) will be introduced in interfacing the RF module with a microcontroller. 1.0 Introduction: Radio frequency (RF) usually refers to oscillations in electrical circuits. It is normally use in wireless communication system to transmit data. By modulating data signals onto the RF carrier signal, data can be transfer from one point to the other point easily. In this application note, a pair of RF module with a frequency of 433 MHz is used. To interface RF module with microcontroller, Universal Synchronous and Asynchronous Receiver and Transmitter (USART) or also known as Serial Communications Interface is used. USART is used for transmit and receive serial data. The operation of USART can be divided into two types which is synchronous and asynchronous. Synchronous mode uses a clock and data line. Asynchronous mode does not use clock accompanying the data.. However in this application note, only asynchronous mode will be use in interfacing the RF module with the microcontroller. 2.0 Objective: Interface a RF module with microcontroller to build a wireless remote control.
  • 2. 3.0 Hardware: RF Transmitter Module (433MHz) Specifications RF Transmitter Module Operating Voltage 3V to 12 V Operating Current Max: 400mA for 12 V supply Min: 9mA for 3V supply Frequency 433MHz Transfer Rate 10Kbps Antenna Length 18cm Table 1.1 Specification of RF Transmitter Module There are 3 pins to connect in the RF Transmitter module. The DATA pin is connected to the TX pin of the Microcontroller. VCC pin connect to the supply voltage and GND connect to ground. The antenna can extend with any wire but for better result, a 50 Ohm coaxial cable is used. The length of the wire as antenna is about 18cm long. RF Receiver Module (433MHz)
  • 3. Specifications RF Receiver Module Operating Voltage 5.0V ± 0.5V Operating Current ≤5.5mA for 5.0V supply Frequency 433MHz Transfer Rate 10Kbps Antenna Length 18cm Table 1.2 Specifications of RF Receiver Module There are 5 pin to connect for the RF receiver module. The DATA pin of the RF Receiver Module is connecting to the RX pin of microcontroller. The VCC pin connects to the 5v supply and the GND pin to ground. The ANT is the antenna of the receiver and can be extend with any wire. The length of the wire is 18cm for better result. 4.0Interface RF Transmitter and Receiver with Microcontroller: 4.1 Register and Flag bit Description which will be used : Register Name Description TXSTA Transmit Status and Control RCSTA Receive Status and Control TXREG Write Transmit Data Register RCREG Write Receive Data Register SPBRG Setting Baud Rate PIR1 Peripheral Interrupt Flag Register PIE1 Peripheral Interrupt Enable Registers Table 1.3 Register and Description which will be used Flag Bit Name Description TXIF Located in PIR1 (bit 4) which is use to check whether TXREG is Full or Empty RCIF Located in PIR1 (bit 5) which is use to check whether RCREG is Full or Empty OERR To test over run error for the RCREG Register TXEN Transmit Enable of Disable bit Table 1.4 Description of flag bit that will be used
  • 4. 4.2Interfacing Transmitter with Microcontroller PIC16F628A: Figure 1.1 Remote Control (Transmitter circuit) In the schematic of the remote control show in Figure 1.1, the microcontroller used is PIC16F628A. To connect a RF transmitter module with PIC16F628A, the data pin of the transmitter need to connect to the TX pin of the PIC which is pin 8 for PIC16F628A. TX pin is for the use of serial communication interface which will transfer 8 bit data to the transmitter to be transmit. To enable the TX port as a serial port, SPEN which is bit 7 in RCSTA have to be set. Bit two in TRISB of PIC16f628A have two be clear in order to make the TX pin as an output pin. TXSTA is the transmit control register for the PIC. This register has to be initializing correctly in order to make the transmitter work. By referring to the data sheet, the source code in this application note, the TXSTA is initialized as B'00100000' which mean that it transmit 8bit data in asynchronous low speed mode. Figure 1.2 shows the representation of each bit of the TXSTA register. Next is to set the baud rate of the transmitter.
  • 5. Figure 1.2 Representation of Each Bit in TXSTA Register Baud rate refers to the speed at which the serial data is transferred, in bits per second. In Asynchronous mode, the baud rate generator sets the baud rate using the value in the SPBRG register. The BRGH bit in TXSTA selects between high and low speed options for greater flexibility in setting the baud rate. From the initialization of TXSTA shown above, the BRGH is clear which mean that the baud rate is in low speed and the SPBRG register in this application note’s source code is set to 255. The Baud rate for both transmitter and receiver must be the same in order for the data transmitted to receive in the receiver. When a digital data is being transmitted, it is transmit from the less significant bit to the most significant bit. This means that the transmitter transmits digital data bit by bit to the receiver. Figure 1.3 show how the signal is transfer in asynchronous mode. Figure 1.3 Signal Transfer in Asynchronous mode
  • 6. From Figure 1.3 the signal is high when no transmission (or reception) is in progress and goes low when the transmission starts. The receiving device uses this low-going transition to determine the timing for the bits that follow. The signal stays low for the duration of the START bit, and is followed by the data bits, Least Significant bit first. The USART can transmit and receive either eight or nine data bits. The STOP bit follows the last data bit and is always high. The transmission therefore ends with the pin high. After the STOP bit has completed, the START bit of the next transmission can occur as shown by the dotted lines. During transmitting data, the heart of the transmitter is the Transmit Shift Register (TSR). This register obtain the data from the transmit buffer, TXREG. Hence, to transmit a data to the receiver, first is to move the desire transmit data to the TXREG then it will load to TSR to be transmitted. To check whether the data in TXREG had been move to TSR, the flag bit TXIF which located in the PIR1 is checked. If TXREG is empty (means the data already load to TSR) the flag bit TXIF will be set. Hence new data can be load to TXREG to be transmitted next. The Bit TXEN in TXSTA show in Figure 1.2 is always set so that all the data in TSR will be transmit. Appendix 8.1 shows the sample code of transmit a data. Check TXIF False True Move Digit 9 to TXREG to be transmitted Figure 1.4 Block Diagram Showing the transmitter’s program runs
  • 7. 4.3 Interfacing RF Receiver Module with microcontroller: Figure 1.5 A Testing Receiver Circuit (Receiver Circuit) In the schematic of the receiver circuit show in Figure 1.5, the microcontroller used is PIC16F877A. To connect the RF Receiver Module to PIC16F877A, the data pin of the receiver is connected to the RX pin which is pin 26 for PIC16F877A. RX pin is for the use of serial communication interface which will receive the 8 bit data from the transmitter for further process. Before the receiver able to receive any data from the transmitter and provide to the PIC for further process, initialization for the PIC is needed. RCSTA is the receive control register for the PIC. This register has to be initializing correctly in order to make the receiver work. By referring to the data sheet, for the source code of this application note, RCSTA is initialized as B'10010000' which mean that it continuously receive 8 bit data, asynchronous mode. The SPEN Flag bit in RCSTA have to be set to enable the serial port. The baud rate for the receiver has to be the same with the transmitter. Figure 1.6 shows the representation of each bit of the RCSTA register.
  • 8. Figure 1.6 Representation of Each Bit in RCSTA Register. When receiving data from the transmitter, the data is first stall in Receive Shift Register (RSR). After that the received data is transferred to the RCREG register when it is empty. Once the transferring process from the RSR to RCREG is complete, the flag bit RCIF will be set. The RCREG is a double- buffered register which mean that it can store two byte of data. When the 2nd data come in but the 1st data have not been read yet, the data will store in the second slot of the RCREG. When the 1st data is read, the 2nd data will move to the 1st slot and new data can be move into RCREG. However, when the RCREG is full and the 3rd data is store in the RSR, the flag bit OERR will be set and the data in RSR will lost. In addition, all the receive process will be stop. Hence it is a must to clear the flag bit OERR in order to retrieve the receiving process. Flag bit OERR can be clear by first clear the CREN and then set it again. Appendix 8.2 shows the sample code to receive date from receiver.
  • 9. The test receiver circuit show in schematic is connected with two LED which is used to test whether the receiver receive data from the transmitter. If it receive the correct data from the transmitter, will either on or off based on the desire of user to program it. False Move data from Check RCIF TRUE Identify the data receive RCREG to a file True False Activate Dog Collar Figure 1.7 Block diagram showing the receiver’s program runs 5.0 Result: A brief experiment is conducted to test the range of the RF remote control range. Condition Outcome Without Antenna Receive Range less than 5 meters With antenna in closed surrounding Receive range about 25 meters With Antenna in open surrounding Receive range about 35 meters Table 1.5 experimental result of the range of the RF remote control in different condition Another experiment is conducted to test the interference upon the RF module with RF module of different frequency. It is proved that the RF module will not be interfering by the RF module of different frequency. However when two same frequency of transmitter is transmitting data, the receiver will receive error signal which is not the exact signal from both transmitter. 6.0 Conclusion: The RF module perform a satisfy range as a wireless remote control and able to transfer signal through obstacles. Interfacing the RF module with microcontroller through USART shows a stable performance from both the transmitter and receiver.
  • 10. 7.0 References: 1. Microcontroller Programming, The Microchip PIC, Juliao Sanchez, Maria P.Canton (e-book) 2. Data Sheet Microchip PIC16F877A 3. Data Sheet Microchip PIC16F628A 8.0 Appendix: 8.1 Sample Assembly code of transmit a digit 9 continuously Transmit ; to transmit a digit 9 BANKSEL PIR1 BTFSS PIR1, TXIF ;check flag bit TXIF GOTO Transmit MOVLW D'9' ; move digit 9 to TXREG BANKSEL TXREG MOVWF TXREG GOTO Transmit 8.2 Sample code of Reciever Receiving Data 9 from Transmitter Receive MOVLW D'9' MOVWF H1 ; move digit 9 to file H1 BANKSEL PIR1 BTFSS PIR1,RCIF ; check if RCIF is set GOTO $-1 BANKSEL RCREG ; receive complete MOVF RCREG,W MOVWF D1 ; move receive data to D1 MOVF D1,W SUBWF H1,0 ; check receive data BTFSC STATUS,Z GOTO Receive ; wrong data re-loop GOTO On_LED