Arduino und der Sparkfun Transceiver nRF2401A ???

Ok.. das ist nun quick&dirty und so wahrscheinlich so falsch, wie etwas nur falsch sein kann - aber ich hab es mal versucht hier neben dem Steinegucken umzuschreiben.
Die PinModes, speziell bei RX duerften ein wenig herumzicken, da musst du mal schauen inwiefern es da noch editierbedarf gibt.. auch die Umrechnungen von Byte nach Bit waren so ein kleineres Problem - WIE ging das noch gleich? Stehe da total auf dem Schlauch.
Ansonsten habe ich so viel im Originalzustand belassen, wie moeglich war.. Nur der Kram mit dem auf 8Mhz takten.. das verstehe ich nicht und da muesstest du entsprechend schauen, wie du das mit dem Arduino hinbekommst.. evtl einen externen Quarz einbauen oder so...
Achja.. und da ich keine AHnung vom PIC habe kommt mir '0b.0010.0011' spanisch vor. Ich tippe darauf, dass das bytes sind - aber wie sie genau gelesen werden weis ich nicht, vielleicht kann da jemand anderes was dazu sagen.. ich hab mal von rechts nach links gezaehlt...

Hoffe dir hilft das ein wenig weiter:

/*
      Quick and dirty translation of the Sparkfun 24G-256bit example.
      Not tested! Nachtwind (martin@shalmirane.de)
*/

#define Clock_8MHz
#define Baud_9600


/* Ports */

///would be nice to have some Port expander for this...
#define TX_CE      12
#define TX_CS      11
#define TX_CLK1    10
#define TX_DATA    9

#define RX_CE       7
#define RX_CS       6
#define RX_CLK1     5
#define RX_DATA     4
#define RX_DR       3

int data_array[29];
int counter;
int packet_number;





void setup()
{
//Pinmodes
      pinMode(TX_CE, OUTPUT);
      pinMode(TX_CS, OUTPUT);
      pinMode(TX_CLK1, OUTPUT);
      pinMode(TX_DATA, OUTPUT);

      pinMode(RX_CE, INPUT);    
      pinMode(RX_CS, INPUT);    
      pinMode(RX_CLK1, INPUT);          
      pinMode(RX_DATA, INPUT);    
      pinMode(RX_DR, INPUT);    
      
//    printf("\n\rRF-24G Testing:\n\r", 0);
    
    delay(1000); ///Debug: can be removed.

      configure_transmitter();
    configure_receiver();
}

void loop()
{
            int i;
            long elapsed_time;

        packet_number++;
        
        //Put some data in the ougoing array
        data_array[0] = packet_number;
        for(i = 1 ; i < 29 ; i++)
            data_array[i] = ++counter;

        transmit_data();
    
        
        if(digitalRead(RX_DR) == 1) //We have data!
            receive_data();
        
        delay(10); //Have a second between transmissions just for evaluation
    
        
}


//This will clock out the current payload into the data_array
void receive_data(void)
{
      int i, j, temp;

    digitalWrite(RX_CE,LOW);//Power down RF Front end

    //Erase the current data array so that we know we are looking at actual received data
    for(i = 0 ; i < 29 ; i++)
        data_array[i] = 0x00;

    //Clock out the data
    for(i = 0 ; i < 29 ; i++) //29 bytes
    {
        for(j = 0 ; j < 8 ; j++) //8 bits each
        {
            temp <<= 1;
            temp = digitalRead(RX_DATA);
                  digitalWrite(RX_CLK1,HIGH);
                  digitalWrite(RX_CLK1,LOW);          
        }

        data_array[i] = temp; //Store this byte
    }
    
    //if(RX_DR == 0) //Once the data is clocked completely, the receiver should make DR go low
    //    printf("DR went low\n\r", 0);
    
//      printf("Received packet %d\n\r", data_array[0]);
    //This prints out the entire array - very large!
    /*
    printf("\n\rData Received:\n\r", 0);
    for(i = 0 ; i < 29 ; i++)
    {
        printf("[%d]", i);
        printf(" : %h - ", data_array[i]);
    }
    */
    

      digitalWrite(RX_CE,HIGH);      //Power up RF Front end
}

//This sends out the data stored in the data_array
//data_array must be setup before calling this function
void transmit_data(void)
{
    int i, j, temp, rf_address;

    digitalWrite(TX_CE,HIGH);

    //Clock in address
    rf_address = 17;
      ///Umrechnung von Byte auf Bit.. keine Idee wie das noch ging... Kann das auch grad dummerweise nicht testen...
    for(i = 0 ; i < 8 ; i++)
    {
        digitalWrite(TX_DATA,!!VALUE!!);
        digitalWrite(TX_CLK1,HIGH);
        digitalWrite(TX_CLK1,LOW);   
        
        rf_address <<= 1;
    }
    
    //Clock in the data_array
    for(i = 0 ; i < 29 ; i++) //29 bytes
    {
        temp = data_array[i];
        
        for(j = 0 ; j < 8 ; j++) //One bit at a time
        {
            digitalWrite(TX_DATA,!!VALUE!!);
            digitalWrite(TX_CLK1,HIGH);
            digitalWrite(TX_CLK1,LOW);   
            
            temp <<= 1;
        }
    }
      digitalWrite(TX_CE,LOW);      //Start transmission   

}

//2.4G Configuration - Receiver
//This setups up a RF-24G for receiving at 1mbps
void configure_receiver(void)
{
    int i, j, temp;
    byte config_setup[14];

    //During configuration of the receiver, we need RX_DATA as an output
      pinMode(RX_DATA, OUTPUT);    

    //Config Mode
      digitalWrite(RX_CE, LOW);
      digitalWrite(RX_CS, HIGH);
    
    //Setup configuration array
    //===================================================================
    //Data bits 111-104 Max data width on channel 1 (excluding CRC and adrs) is 232
    config_setup[0] = 232;

    //Data bits 103-64 Channel 2 address - we don't care, set it to 200 
    config_setup[1] = 0;
    config_setup[2] = 0;
    config_setup[3] = 0;
    config_setup[4] = 0;
    config_setup[5] = 200;

    //Data bits 63-24 Channel 1 address - set it to 17
    config_setup[6] = 0;
    config_setup[7] = 0;
    config_setup[8] = 0;
    config_setup[9] = 0;
    config_setup[10] = 17;
    
    //Data bits 23-16 Address width and CRC
    config_setup[11] = 49; //0b.0010.0011; ???
    
    //Data bits 15-8 
    config_setup[12] = 89; //0b.0100.1101; ???
    
    //Data bits 7-0
    config_setup[13] = 13; //0b.0000.1101; ???
    //===================================================================

      
      
      
    //Clock in configuration data
      
      ///I am somewhat clueless here. Its something simple. You iterate through the 14 values of the configuration and end up setting the RX_DATA port according to the Bit you read.
      ///unfortunately i dont remember how to convert from byte to bit - shame on me ;0) 
    for(i = 0 ; i < 14 ; i++)
    {
        temp = config_setup[i];
        
        for(j = 0 ; j < 8 ; j++)
        {   
            digitalWrite(RX_DATA,!!VALUE!!);
            digitalWrite(RX_CLK1,HIGH);
            digitalWrite(RX_CLK1,LOW);                    
        }
    }
    
    //Configuration is actived on falling edge of CS (page 10)
    digitalWrite(RX_CE,LOW); 
      digitalWrite(RX_CS,LOW); 

    //After configuration of the receiver, we need RX_DATA as an input
      pinMode(RX_DATA,input);


    //Start monitoring the air
    digitalWrite(RX_CE,HIGH); 
      digitalWrite(RX_CS,LOW); 

//    printf("RX Configuration finished...\n\r", 0);

}    

//2.4G Configuration - Transmitter
//This sets up one RF-24G for shockburst transmission
void configure_transmitter(void)
{
    int i, j, temp;
    int config_setup[14];

    //Config Mode
      digitalWrite(TX_CE, LOW);
      digitalWrite(TX_CS, HIGH);    
    //Setup configuration array
    //===================================================================
    //Data bits 111-104 Max data width on channel 1 (excluding CRC and adrs) is 232
    config_setup[0] = 232;

    //Data bits 103-64 Channel 2 address - we don't care, set it to 200 
    config_setup[1] = 0;
    config_setup[2] = 0;
    config_setup[3] = 0;
    config_setup[4] = 0;
    config_setup[5] = 200;

    //Data bits 63-24 Channel 1 address - set it to 17
    config_setup[6] = 0;
    config_setup[7] = 0;
    config_setup[8] = 0;
    config_setup[9] = 0;
    config_setup[10] = 17;
    
    //Data bits 23-16 Address width and CRC
    config_setup[11] = 49; //0b.0010.0011; ???
    
    //Data bits 15-8 
    config_setup[12] = 89; //0b.0100.1101; ???
    
    //Data bits 7-0
    config_setup[13] = 12; //0b.0000.1100; ???
    //===================================================================

    //Clock in configuration data
      ///I am somewhat clueless here. Its something simple. You iterate through the 14 values of the configuration and end up setting the RX_DATA port according to the Bit you read.
      ///unfortunately i dont remember how to convert from byte to bit - shame on me ;0)       
    for(i = 0 ; i < 14 ; i++)
    {
        temp = config_setup[i];
        
        for(j = 0 ; j < 8 ; j++)
        {   
            digitalWrite(TX_DATA,!!VALUE!!);
            digitalWrite(TX_CLK1,HIGH);
            digitalWrite(TX_CLK1,LOW);     
        
//            temp <<= 1;
        }
    }
    
    //Configuration is actived on falling edge of CS (page 10)
    digitalWrite(TX_CE,LOW); 
      digitalWrite(TX_CS,LOW);       

//    printf("TX Configuration finished...\n\r", 0);
}