- Wed Nov 24, 2004 5:18 am
#2290
Can anyone tell me if there is a problem with the following code? I have been having a lot of trouble getting the RF-24G modules to work. I finally resorted to the following minimalist code. It is based directly on the sample code from Sparkfun. My understanding is that I should get random noise on RX_DR when this code is running, but on my DSO, I get nothing. The controller is a PIC16F877 at 3.3 volts. The only connections to the RF-24G are gound, power and the following described in the defines below. The compiler is from Hi-Tech.
I would appreciate any help.
Thanks in advance.
Sam
#include "mxapi.h"
#include "mxapi.c"
#define RX_CE RC2
#define RX_CS RC3
#define RX_CLK1 RC4
#define RX_DATA RC1
#define RX_DR RC0
void configure_receiver(void);
void main()
{
delay_ms(100);
configure_receiver();
while(TRUE);
}
void configure_receiver(void)
{
unsigned char i;
unsigned char config_setup;
PORTC = 0b00000000;
TRISC = 0b00000001;
RX_CE = 0; RX_CS = 1;
config_setup = 0b00000101;
for(i = 0 ; i < 8 ; i++)
{
RX_DATA = ((config_setup & 0x80) >> 7);
RX_CLK1 = 1;
RX_CLK1 = 0;
config_setup <<= 1;
}
RX_CE = 0; RX_CS = 0;
PORTC = 0b00000000;
TRISC = 0b00000011;
RX_CE = 1; RX_CS = 0;
}
I would appreciate any help.
Thanks in advance.
Sam
#include "mxapi.h"
#include "mxapi.c"
#define RX_CE RC2
#define RX_CS RC3
#define RX_CLK1 RC4
#define RX_DATA RC1
#define RX_DR RC0
void configure_receiver(void);
void main()
{
delay_ms(100);
configure_receiver();
while(TRUE);
}
void configure_receiver(void)
{
unsigned char i;
unsigned char config_setup;
PORTC = 0b00000000;
TRISC = 0b00000001;
RX_CE = 0; RX_CS = 1;
config_setup = 0b00000101;
for(i = 0 ; i < 8 ; i++)
{
RX_DATA = ((config_setup & 0x80) >> 7);
RX_CLK1 = 1;
RX_CLK1 = 0;
config_setup <<= 1;
}
RX_CE = 0; RX_CS = 0;
PORTC = 0b00000000;
TRISC = 0b00000011;
RX_CE = 1; RX_CS = 0;
}