You are on page 1of 14

8051 HOW-TO GUIDE

Interface RF433.92MHz with 8051

Contents at a Glance
8051 Friendly Board .........................................................3 RF433.92(Radio Frequency) .. Error! Bookmark not defined. RF Transmitter ...................... Error! Bookmark not defined. RF Receiver ........................... Error! Bookmark not defined. Circuit Diagram to Interface RF with 8051 ........................5 Source Code ....................................................................5 C Program to RF using 8051 .............................................7

Join the Technical Community Today! http://www.pantechsolutions.net

8051 Friendly Board The 8051 Friendly board is specifically designed to help students to master the required skills in the area of embedded systems. The kit is designed in such way that all the possible features of the microcontroller will be easily used by the students. The kit supports in system programming (ISP) which is done through serial port. NXPs 8051 (AT89V51RD2), 8051 Friendly Kit is proposed to smooth the progress of developing and debugging of various designs encompassing of speed 8-bit Microcontrollers. RF433.92MHz (Radio Frequency): Radio Frequency, any frequency within the electromagnetic spectrum associated with radio wave propagation. When an RF current is supplied to an antenna, an electromagnetic field is created that then is able to propagate through space. Many wireless technologies are based on RF field propagation. Join the Technical Community Today! http://www.pantechsolutions.net

Receiver Module

Transmitter Module

RF transmitter: RF433.92MHz transmitter Module conneted with 4-bit encoder, user can evaluated RF interface in two ways (Standalone without MCU, user can give inputs through 4way DIP switchSW35) while making switch SW35 to ON positions inputs low goes to the encoder. Data will transmit through the module. Also provided to configure address lines of the encoder. RF Receiver: RF433.92MHz Receiver Module connected with 4-bit decoder, user can evaluated RF signal with the help of LED indications. Whenever receives data through transmitter VT LED, indicates for valid transmission.

Join the Technical Community Today! http://www.pantechsolutions.net

Circuit Diagram to RF with 8051 Transmitter Section:

TX Module
JP12

Ant
1 1

C16 0.1D D10 LED SW34 1 2 3 4 5 6 7 8 9 SW DIP-8 HT-12E U18 A0 A1 A2 A3 A4 A5 A6 A7 Vss Vdd Dout Osc1 Osc2 TE D11 D10 D9 D8 18 17 16 15 14 13 12 11 10 RF_P R51 750K TX_D3 TX_D2 TX_D1 TX_D0 SW35 TX_D3 TX_D2 TX_D1 TX_D0 SW DIP-4 D11 LED D12 LED D13 LED R50 330E R52 330E R53 330E R49 330E RF_P

Join the Technical Community Today! http://www.pantechsolutions.net

1 2 3 4

Receiver Section:
D14 LED R54 330E R55 1K C17 0.1D BC547 2 RF_P

1
Q5

SW36 1 2 3 4 5 6 7 8 9 SW DIP-8

U19 A0 A1 A2 A3 A4 A5 A6 A7 Vss Vdd VT Osc1 Osc2 DIN D11 D10 D9 D8 18 17 16 15 14 13 12 11 10 RF_P R56 33K DATAIN RX_D3 RX_D2 RX_D1 RX_D0

JP13 Rx Module Ant

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

RF_P D16 D17 D18 LED LED LED R58 330E R59 330E R60 330E

DATAIN

HT-12D

RF_P

Source Code The Interfacing RF with 8051 program is very simple and straight forward that uses a transmitting and receiving data. In C programs you cannot be sure of delay, because it depends on compiler how it optimizes the loops as soon as you make changes in the options the delay changes.

Join the Technical Community Today! http://www.pantechsolutions.net

D15

LED

R57 330E

C Program to RF using 8051


*************************************************************************************** Title : Program to transmitting and receiving data using RF433.92MHz range. *************************************************************************************** #include <reg51.h> #include <stdio.h> #define DATA P1 //Define control pins sbit RS = P3^4; sbit RW = P3^5; sbit lcd_e = P3^6; sbit EXINT0 = P3^2; sbit EXINT1 = P3^3; Code unsigned char msg[] = (" FRINDLY 8051 "); //Display the message Code unsigned char msg1[] = ("RF 433MHz COMM.."); Unsigned char U_N, L_N, Word, Cnt=0; Unsigned char ch,up,lw; Unsigned char curs = 0x80; //---------------------------------// LCD Functions //---------------------------------Void lcd_init(void); Void lcd_cmd(unsigned char); Void lcd_display(unsigned char); Void DelayMs(int);

//Register Select //LCD Read/Write //LCD Enable

Join the Technical Community Today! http://www.pantechsolutions.net

//---------------------------------// LCD command Function //---------------------------------Void lcd_cmd(unsigned char cmnd) { DATA = cmnd; RS = 0; RW = 0; lcd_e = 1; DelayMs(35); lcd_e = 0; } //---------------------------------// LCD Data Function //---------------------------------Void lcd_display(unsigned char dat) { DATA = dat; RS = 1; RW = 0; lcd_e = 1; DelayMs(35); lcd_e = 0; } //---------------------------------// LCD Delay Function //---------------------------------Void DelayMs(int k) { unsigned int a; for(a=0;a<=k;a++); } //---------------------------------// LCD Initialization //----------------------------------

Join the Technical Community Today! http://www.pantechsolutions.net

Void lcd_init(void) { Unsigned char i; lcd_cmd(0x38); DelayMs(15); lcd_cmd(0x0c); DelayMs(15); lcd_cmd(0x06); DelayMs(15); lcd_cmd(0x01); DelayMs(15); //------------------------------------------// First Line Message Display //------------------------------------------lcd_cmd(0x80); DelayMs(35); i=0; While (msg[i]!='\0') { lcd_display(msg[i]); i++; } DelayMs(50); //------------------------------------------// Second Line Message Display //------------------------------------------lcd_cmd(0xc0); DelayMs(35); i=0; While (msg1 [i]! ='\0') { lcd_display(msg1[i]); i++; } DelayMs(50); //2x16 Character 5x7 dot //matrix LCD,8-bit format //Display On, cursor off //Shift Cursor to right //Clear display screen

//First Line Initialization

//Second Line Initialization

Join the Technical Community Today! http://www.pantechsolutions.net

Void Serial_Init(void) { TMOD = 0x20; SCON = 0x50; TH1 = 0xFD; TR1 = 1; TI = 1; } Void Recieve (unsigned char Pos) { if (Pos == 0) { L_N = (P2 & 0xF0) >> 4; } else { U_N = (P2 & 0xF0); } } //^^^^^^^^^^^^^^^^^^^^^^^^^^Main Program Starts Here^^^^^^^^^^^^^^^^^^^^^^^^^^ void main(void) { P2 = 0xFF; Serial_Init(); lcd_init(); EA = 1; ES = 1; EX0 = 1; EX1 = 1; while (1)

Join the Technical Community Today! http://www.pantechsolutions.net

{ if (Cnt == 1) { lw = 0xF0 | (ch & 0x0F); up = 0xF0 | ((ch & 0xF0)>>4); P2 = lw; DelayMs(220); Recieve (0); P2 = up; DelayMs(200); Recieve (1); Word = U_N | L_N; SBUF = Word; if (curs == 0x90) { curs = 0xC0; } if (curs == 0xD0) { curs = 0x80; } lcd_cmd(curs++); lcd_display(Word); Cnt = 0; P2 = 0xFF; } } } //^^^^^^^^^^^^^^^^^^^^^^^^^^ Serial Interrupt Routine ^^^^^^^^^^^^^^^^^^^^^^^^^^ void Serial_Interr (void) interrupt 4 { if (RI == 1) {

Join the Technical Community Today! http://www.pantechsolutions.net

ch = SBUF; if (curs == 0x80) lcd_cmd(0x01); Cnt = 1; } RI = 0; }

Join the Technical Community Today! http://www.pantechsolutions.net

Did you enjoy the read?


Pantech solutions creates information packed technical documents like this one every month. And our website is a rich and trusted resource used by a vibrant online community of more than 1, 00,000 members from organization of all shapes and sizes.

Join the Technical Community Today! http://www.pantechsolutions.net

What do we sell?
Our products range from Various Microcontroller development boards, DSP Boards, FPGA/CPLD boards, Communication Kits, Power electronics, Basic electronics, Robotics, Sensors, Electronic components and much more . Our goal is to make finding the parts and information you need easier and affordable so you can create awesome projects and training from Basic to Cutting edge technology.

Join the Technical Community Today! http://www.pantechsolutions.net