i am connecting cywm6935 transceiver with RCM4000 just for transmitting data from my board and given som delay to receive the same data from the transceiver to my board . i hav a code which has showing some errors even when i connect RF module with my MCU. my RF module got 5 pins wich i connected with 1st pin to grnd 2nd pin to vcc 5th pin to pc4 7th pin to pc5.
so pls check my code and give me some gud suggestions…
here s my code
/*PB7 acts as the CS line on the RF
PB0 is the serial B clock line(SCLK)
PC4 is the data output(MOSI)
PC5 is the data input(MISO)*/
//#define SPI_SER_A
#define SPI_SER_B
#define SPI_CLK_DIVISOR 5
//#class auto
#define DS2_BIT 2
#define DS3_BIT 3
#use “spi.lib”
#use RCM40xx.LIB
void main()
{
unsigned int i,j;
int RF_writdata[1]={0,1}; //here is the input for RF transmitter.
char RF_readdata[1]; //this line for receiving data.
brdInit(); //to initilize the board
SPIinit(); //SPI initiliz
while(1)
{
for(i=0;i<10;i++)
{
BitWrPortI(PBDR, &PBDRShadow, 0, 7); // SET CS LOW
}
//j=0;here may need 'for' loop. so look aftr smtime
SPIWrite(RF_writdata, 2); //i send the data to RF txr.
BitWrPortI(PBDR, &PBDRShadow, 1, 7); //SET CS HIGH
// printf("transmited value is %x %x", RF_writdata[0],RF_writdata[1]);
// BitWrPortI(PBDR, &PBDRhadow, 0, 7); //SET CS LOW
//j=1;
for(i=0;i<1000;i++); //just for dalay
for(i=0;i<1000;i++); //just for delay
for(i=0;i<10;i++)
{
BitWrPortI(PBDR, &PBDRShadow, 0,7); //SET CS LOW
}
BitWrPortI(PBDR, &PBDRShadow, 1, 7); //SET CS HIGH
SPIRead(RF_readdata,2); //here i am readin the output from RF Rx
BitWrPortI(PBDR, &PBDRShadow, 0, 7); //SET CS LOW
/// printf("recieved values are %c,%c",RF_readdata[0],RF_readdata[1]);
//using the red datas from rf rx i am toggle the LED which connected with portB.
BitWrPortI(PBDR, &PBDRhadow, RF_readdata[0], 2);
for(i=0;i<65354;i++);
BitWrPortI(PBDR, &PBDRhadow, RF_readdata[1], 2);
for(i=0;i<65354;i++);
BitWrPortI(PBDR, &PBDRhadow, RF_readdata[0], 3);
for(i=0;i<65354;i++);
BitWrPortI(PBDR, &PBDRhadow, RF_readdata[1], 3);
}
}
pls help me to come out of this problem…