Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

need help in RFID interfacing to 89c52

Status
Not open for further replies.

ud23

Advanced Member level 3
Joined
Apr 20, 2011
Messages
926
Helped
184
Reputation
368
Reaction score
180
Trophy points
1,323
Activity points
6,138
hi i am using chipcon cc2500 i wrote code for that but not working any one have working code to transmit and receive continuous data . and if have instillation register sequence .pls i need it urgent ...........
 

ud23

Advanced Member level 3
Joined
Apr 20, 2011
Messages
926
Helped
184
Reputation
368
Reaction score
180
Trophy points
1,323
Activity points
6,138
i would like to use cc2500 as transceiver and used as slave with 89c52 need sent or receive data if it present on cc2500 and take that data in pic controller and need operate relays
 

ud23

Advanced Member level 3
Joined
Apr 20, 2011
Messages
926
Helped
184
Reputation
368
Reaction score
180
Trophy points
1,323
Activity points
6,138
#include <reg51.h>


#define Enable 1
#define Disable 0
void Tx_data ();
void Rx_data ();
void Inituart(void);
//---------------------------------------------------------------
//
//---------------------------------------------------------------
unsigned char Bdelay_us;
unsigned char Bdelay_ms;
unsigned char Btemp1;
unsigned char Btemp2;
unsigned char Bloop_a;
unsigned char Bdata_buffer;
unsigned char Bp_r_data;
unsigned char Btx_data1;
unsigned char Btx_data2;
unsigned char Btx_data3;
unsigned char Brx_data1;
unsigned char Brx_data2;
unsigned char Brx_data3;
unsigned char BRSSI;
unsigned char BCRC;
unsigned char BLed_counter;
union{
unsigned char byte;
struct{
unsigned char bit0:1;
unsigned char bit1:1;
unsigned char bit2:1;
unsigned char bit3:1;
unsigned char bit4:1;
unsigned char bit5:1;
unsigned char bit6:1;
unsigned char bit7:1;
}bits;
}Bflag1;
#define bCC2500_CC1100_recive_packet_ok Bflag1.bits.bit0
#define bMCU_timeout_flag Bflag1.bits.bit1
#define bCC2500_CC1100_interrupt_flag Bflag1.bits.bit2
//---------------------------------------------------------------
//
//---------------------------------------------------------------
#include "MCU.h"
#include "Chipcon.h"


void main()

{
while(1)
{
void Inituart(void);
Tx_data();
FDelay_ms(200);
Rx_data();
}
}

void Tx_data ()
{

FDelay_ms(50);


TL1=TIME_L_BYTE_4M;
TH1=TIME_H_BYTE_4M;
bMCU_timeout_flag=Disable;

Btx_data1=0x58;
Btx_data2=0x39;
Btx_data3=BLed_counter;
FRF_CC2500_CC1100_transmit_packet_data();

bCC2500_CC1100_interrupt_flag=Disable;
INT0=1;
FCC2500_CC1100_receive_mode();
while((bCC2500_CC1100_interrupt_flag==Disable)&&(bMCU_timeout_flag==Disable));
bCC2500_CC1100_recive_packet_ok_flag=Disable;
if(bCC2500_CC1100_interrupt_flag==Enable)
{
FRF_Interrupt_CC2500_CC1100_rx_data();
}
FCC2500_CC1100_idle_mode();
FCC2500_CC1100_clear_rx_fifo();
FCC2500_CC1100_sleep_mode();
if(bCC2500_CC1100_recive_packet_ok_flag==Enable)
{
if(Brx_data1==0x58)
{
if(Brx_data2==0x39)
{
FDelay_ms(500);
P1=0xFF;
}
}
}

}





void Rx_data()
{



FMCU_Initial();
FPower_on_reset_CC2500_CC1100();
FCC2500_CC1100_Initial_all_registers();
FCC2500_CC1100_Initial_PA_table();
FCC2500_CC1100_clear_rx_fifo();
FCC2500_CC1100_clear_tx_fifo();
FCC2500_CC1100_frequency_calibration();
FDelay_4us(200);


bCC2500_CC1100_interrupt_flag=Disable;
INT0=1;
FCC2500_CC1100_receive_mode();
while(1)
{

if(bCC2500_CC1100_interrupt_flag==Enable)
{
bCC2500_CC1100_recive_packet_ok_flag=Disable;
FRF_Interrupt_CC2500_CC1100_rx_data();
FCC2500_CC1100_clear_rx_fifo();
if(bCC2500_CC1100_recive_packet_ok_flag==Enable)
{
if(Brx_data1==0x58)
{
if(Brx_data2==0x39)
{

Btx_data1=0x58;
Btx_data2=0x39;
Btx_data3=Brx_data3;
FRF_CC2500_CC1100_transmit_packet_data();

FDelay_ms(20);
P1=0xff; }
}
}

bCC2500_CC1100_interrupt_flag=Disable;
INT0=1;
FCC2500_CC1100_receive_mode();
}
}
}


void Inituart(void)
{
TMOD = 0x20; //timer1 working mode 1
TL1 = 0xfd; //f7=9600 for 16mhz Fosc,and ...
TH1 = 0xfd; //...fd=19200 for 11.0592mhz Fosc
SCON = 0xd8; //uart mode 3,ren==1
PCON = 0x80; //smod=0
TR1 = 1; //start timer1
}

this is my code but it doesnt working is there any modification or correction needed please help me
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top