//---------------------------------------------------------------------
// Envoie des donnees au RF24G, en burstmode
//---------------------------------------------------------------------
void SendDataRF()
{
unsigned int uidummy, j;
// SPI1CON = 0x002E; // Master mode, SCK = Fcy/5/4 = 1.0 MHz |1110), CKP=0, CKE=0, Clk idle is low, 8 bits
SPI1CON = 0x012E; // Master mode, SCK = Fcy/5/4 = 1.0 MHz |1110), CKP=0, CKE=1, Clk idle is low, 8 bits
RF24G_CS = 0; RF24G_CE = 1; // Set RF24G Active RX/TX mode
// debug introduire 5 us de delais !
// perd 5 us // Tcs2data
for (j=0; j<20; j++) __builtin_nop();
// debug, verif delais à l oscillo
SPI1STATbits.SPIROV = 0; // Clear overflow flag
uidummy = SPI1BUF; SPI1BUF=0xE7; while (SPI1STATbits.SPITBF); while ( !SPI1STATbits.SPIRBF); // Send l adresse du Channel1 40 bits
uidummy = SPI1BUF; SPI1BUF=0xE7; while (SPI1STATbits.SPITBF); while ( !SPI1STATbits.SPIRBF);
uidummy = SPI1BUF; SPI1BUF=0xE7; while (SPI1STATbits.SPITBF); while ( !SPI1STATbits.SPIRBF);
uidummy = SPI1BUF; SPI1BUF=0xE7; while (SPI1STATbits.SPITBF); while ( !SPI1STATbits.SPIRBF);
uidummy = SPI1BUF; SPI1BUF=0xE7; while (SPI1STATbits.SPITBF); while ( !SPI1STATbits.SPIRBF);
uidummy = SPI1BUF; SPI1BUF= TimeStamp & 0xFF; while (SPI1STATbits.SPITBF); while ( !SPI1STATbits.SPIRBF); // Send le Hi
uidummy = SPI1BUF; SPI1BUF=(TimeStamp>> 8) & 0xFF; while (SPI1STATbits.SPITBF); while ( !SPI1STATbits.SPIRBF); // Send le low
uidummy = SPI1BUF; SPI1BUF= Sensor0_T & 0xFF; while (SPI1STATbits.SPITBF); while ( !SPI1STATbits.SPIRBF); // Send le Hi
uidummy = SPI1BUF; SPI1BUF=(Sensor0_T>> 8) & 0xFF; while (SPI1STATbits.SPITBF); while ( !SPI1STATbits.SPIRBF); // Send le low
uidummy = SPI1BUF; SPI1BUF= Sensor1_T & 0xFF; while (SPI1STATbits.SPITBF); while ( !SPI1STATbits.SPIRBF); // Send le Hi
uidummy = SPI1BUF; SPI1BUF=(Sensor1_T>> 8) & 0xFF; while (SPI1STATbits.SPITBF); while ( !SPI1STATbits.SPIRBF); // Send le low
uidummy = SPI1BUF; SPI1BUF= Sensor2_T & 0xFF; while (SPI1STATbits.SPITBF); while ( !SPI1STATbits.SPIRBF); // Send le Hi
uidummy = SPI1BUF; SPI1BUF=(Sensor2_T>> 8) & 0xFF; while (SPI1STATbits.SPITBF); while ( !SPI1STATbits.SPIRBF); // Send le low
uidummy = SPI1BUF; SPI1BUF= Sensor3_T & 0xFF; while (SPI1STATbits.SPITBF); while ( !SPI1STATbits.SPIRBF); // Send le Hi
uidummy = SPI1BUF; SPI1BUF=(Sensor3_T>> 8) & 0xFF; while (SPI1STATbits.SPITBF); while ( !SPI1STATbits.SPIRBF); // Send le low
// introduire 5 us de delais ! Tcs2data
for (j=0; j<20; j++) __builtin_nop();
RF24G_CS = 0; RF24G_CE = 0; // Set RF24G non actif => en VEILLE
// remet comme c était, pour le MAX6675 / thermocouple
// ici : la même freq SPI donc inutile de : SPI1CON = 0x0423; // Master mode, SCK = Fcy/8 = 2.5 MHz, CKP=0, CKE=0, Clk idle is low, 16 bits
}