Anda di halaman 1dari 14

8051 HOW-TO GUIDE

Interface RF433.92MHz
with 8051

Contents at a Glance
8051 Slicker 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 Slicker Board


The 8051 Slicker 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 Slicker 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:

Ant
1

1
2
3
4

JP12

TX Module

C16 0.1D
D10 LED
SW34

R49 330E
RF_P

U18
1
2
3
4
5
6
7
8
9

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

SW35
TX_D3
TX_D2
TX_D1
TX_D0

R51
750K
TX_D3
TX_D2
TX_D1
TX_D0

SW DIP-4

D11 LED

R50 330E

D12 LED

R52 330E

D13 LED

R53 330E

SW DIP-8
HT-12E

Join the Technical Community Today!


http://www.pantechsolutions.net

Receiver Section:
D14 LED
R54
330E

RF_P

R55
1K

JP13
Rx Module

U19
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

Ant
D15

LED

R57 330E

D16

LED

R58 330E

D17

LED

R59 330E

D18

LED

R60 330E

RF_P

A0
A1
A2
A3
A4
A5
A6
A7
Vss

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

1
2
3
4
5
6
7
8
9

SW36

Q5

C17 0.1D

BC547
2

HT-12D

DATAIN

SW DIP-8
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

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;

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

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);
//---------------------------------//
LCD command Function

Join the Technical Community Today!


http://www.pantechsolutions.net

//---------------------------------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
//---------------------------------void lcd_init(void)
{

Join the Technical Community Today!


http://www.pantechsolutions.net

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)
{
if (Cnt == 1)

Join the Technical Community Today!


http://www.pantechsolutions.net

{
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)
{
ch = SBUF;

Join the Technical Community Today!


http://www.pantechsolutions.net

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

Anda mungkin juga menyukai