test 315Mhz Tx & Rx

Bluetooth, XBee, RF......

test 315Mhz Tx & Rx

Postby geevan » Tue Mar 12, 2013 3:28 am

Hi, im using pic16f877a to connect with 315mhz Rx & Tx..can anyone help me by giving a simple coding to test this rf module when swicth(RB0) at Tx is pressed, LED(RB0) at Rx is blink..here i post my coding which is not work and i don't where is the mistake. Can anyone correct it. Thankz
TX
CODE: SELECT_ALL_CODE
#include <htc.h>
#include "usart.h"
#include "delay.h"

__CONFIG(0x3F72);

unsigned char Data = 0;

void main()
{
   TRISB = 0x01;
   PORTB = 0x00;
   init_comms();
   Data = 0b10101010;
   while(1)
   {
      if(RB0 == 1)
      {
         putch(Data);
         RB1 = 1;
         DelayMs(200);
      }
   }
}


RX
CODE: SELECT_ALL_CODE
#include <htc.h>
#include "usart.h"
#include "delay.h"

__CONFIG(0x3F72);

unsigned char Data = 0;

void main()
{
   TRISB = 0x00;
   PORTB = 0x00;
   init_comms();

   while(1)
   {
      Data = getch();
      DelayMs(200);
      if(Data == 0b10101010)
      {
         RB0 = 1;
      }
   }
}
geevan
Freshie
 
Posts: 5
Joined: Tue Mar 12, 2013 2:46 am

Re: test 315Mhz Tx & Rx

Postby A380 » Tue Mar 12, 2013 11:28 am

Would you mind to show your schematics for TX and RX here?
User avatar
A380
Discoverer
 
Posts: 119
Joined: Tue May 19, 2009 2:44 pm
Location: Malaysia

Re: test 315Mhz Tx & Rx

Postby geevan » Tue Mar 19, 2013 1:51 am

Rx and Tx schematic
Attachments
rx.jpg
RX
Tx.jpg
TX
geevan
Freshie
 
Posts: 5
Joined: Tue Mar 12, 2013 2:46 am

Re: test 315Mhz Tx & Rx

Postby robosang » Tue Mar 19, 2013 9:46 am

What is the baud rate? what is the crystal value?

The circuit looks weird to me. Is there any power to microcontroller? If so why is 5V battery there?
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: test 315Mhz Tx & Rx

Postby shahrul » Tue Mar 19, 2013 10:29 am

You must delete DelayMs(200); and putch(Data); continuously. Also use baudrate 1200.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: test 315Mhz Tx & Rx

Postby geevan » Tue Mar 19, 2013 1:39 pm

can you edit back my source code for tx and rx...because i dont know where should at the baudrate 1200
geevan
Freshie
 
Posts: 5
Joined: Tue Mar 12, 2013 2:46 am

Re: test 315Mhz Tx & Rx

Postby geevan » Tue Mar 19, 2013 1:48 pm

my crystal value is 20Mhz...power supply for microcontroller is 5v as per schematic
geevan
Freshie
 
Posts: 5
Joined: Tue Mar 12, 2013 2:46 am

Re: test 315Mhz Tx & Rx

Postby shahrul » Tue Mar 19, 2013 1:59 pm

geevan WROTE:can you edit back my source code for tx and rx...because i dont know where should at the baudrate 1200

For learning, you must do it yourself. Not my job to write a code for you.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: test 315Mhz Tx & Rx

Postby geevan » Tue Mar 19, 2013 2:19 pm

ok thanks...atleast can u tell me where sholud at the baudrate 1200
geevan
Freshie
 
Posts: 5
Joined: Tue Mar 12, 2013 2:46 am

Re: test 315Mhz Tx & Rx

Postby robosang » Tue Mar 19, 2013 4:49 pm

at least? :mrgreen:
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Next

Return to Wireless Device

Who is online

Users browsing this forum: No registered users and 9 guests

cron