sparky:
Don’t take this personally - but I really don’t see why you are doing something in 4 steps that needs to be only 1.
Why not just use the example code?:
temp = config_setup;
for(i = 0 ; i < 8 ; i++)
{
RX_DATA = temp.7; //((config_setup & 0x80) >> 7);
RX_CLK1 = 1;
RX_CLK1 = 0;
temp <<= 1;
}
That way we know exactly what bit is being output to RX_DATA.
Hi-Tech C has its pros and cons. It does not support statements like temp.7 unless you write supporting statements for them yourself such as creating a bit field in a structure - something like this may actually be going on in your compiler. What I like about Hi-Tech C is that it implements full ISO/ANSI C. Code written for the Hi-Tech compiler should be portable to any other ANSI C compiler.
So you’ve got your oscope telling you that DR1 is toggling, but the PIC is not working.
Actually DR1 is not toggling. In fact, the problem is that DR1 is doing nothing (from what I could see on the scope), though DATA is rapidly sending pulses. This is what seems so strange to me. In fact, if I remember, I believe that CLK was also toggling, yet the PIC was doing nothing and in an infinite loop. It was as if, the RF-24 was receiving data and attempting to clock it into the PIC all by itself, yet I never saw DR1 change.
I’ve never used the Hi-Tech compiler so I don’t know what statements work with your compiler. My guess is the compiler is doing something screwy with the tris assigment:
TRISC = 0b000000001;
So that the PORTC.0 is never getting set to an input, or the define at the top of your code is not working correctly. Try looking at the generated ASM or using:
TRISC = 0x01; //Or whatever the Hi-Tech hex assignment is
instead of the binary format. I remember some motorola compilers that would happily compile
x = 0b.0000.1101;
and very happily (and to my never ending frustration) cut off everything after the second period - without any compile errors!
I am pretty sure the registers are being set correctly. I have never had any trouble before. I normally set registers in Hex, but I was faithfully trying to copy your working example. I can certainly see how being able to set periods after every nibble is convenient -- especially when you are dealing with larger numbers! Again, Hi Tech C does not support these methods.
Again, I really appreciate the help. I know you are busy, but would there be any chance you could compile my code for one of your processors and see if DR1 toggles? It is basically your code verbatim with the two changes you noted in bit representation. As I said, if I can get this code to work consistantly, it might be a nice test jig for the RF-24.
Thanks,
Sam