void BFT_Send(unsigned long data, byte cmd) { int fpulse = 950; // Pulse width in microseconds int fretrans = 10; // Number of code retransmissions unsigned long bitstream = 0L; byte command; // prepare data to send for (unsigned short i=0; i<10; i++) { // reverse data bits bitstream<<=1; bitstream|=(data & B1); data>>=1; } // Prepare transmit digitalWrite(PIN_RF_RX_VCC,LOW); // Turn off power to the RF receiver digitalWrite(PIN_RF_TX_VCC,HIGH); // Enable the 433Mhz transmitter delayMicroseconds(TRANSMITTER_STABLE_DELAY); // short delay to let the transmitter become stable (Note: Aurel RTX MID needs 500µS/0,5ms) // send bits for (int nRepeat = 0; nRepeat <= fretrans; nRepeat++) { data=bitstream; for (unsigned short i=0; i<10; i++) { switch (data & B1) { case 0: digitalWrite(PIN_RF_TX_DATA, HIGH); delayMicroseconds(fpulse*2); digitalWrite(PIN_RF_TX_DATA, LOW); delayMicroseconds(fpulse*2); break; case 1: digitalWrite(PIN_RF_TX_DATA, HIGH); delayMicroseconds(fpulse); digitalWrite(PIN_RF_TX_DATA, LOW); delayMicroseconds(fpulse); break; } //Next bit data>>=1; } //Send termination/synchronisation-signal. Total length: 26 periods digitalWrite(PIN_RF_TX_DATA, HIGH); delayMicroseconds(fpulse); digitalWrite(PIN_RF_TX_DATA, LOW); delayMicroseconds(fpulse*2); digitalWrite(PIN_RF_TX_DATA, HIGH); delayMicroseconds(fpulse); digitalWrite(PIN_RF_TX_DATA, LOW); delayMicroseconds(fpulse*2); digitalWrite(PIN_RF_TX_DATA, HIGH); delayMicroseconds(fpulse); digitalWrite(PIN_RF_TX_DATA, LOW); delayMicroseconds(fpulse*32); } // End transmit delayMicroseconds(TRANSMITTER_STABLE_DELAY); // short delay to let the transmitter become stable (Note: Aurel RTX MID needs 500µS/0,5ms) digitalWrite(PIN_RF_TX_VCC,LOW); // Turn thew 433Mhz transmitter off digitalWrite(PIN_RF_RX_VCC,HIGH); // Turn the 433Mhz receiver on RFLinkHW(); }
void Eurodomest_Send(unsigned long address) { int fpulse = 296; // Pulse witdh in microseconds int fretrans = 7; // Number of code retransmissions uint32_t fdatabit; uint32_t fdatamask = 0x800000; uint32_t fsendbuff; digitalWrite(PIN_RF_RX_VCC,LOW); // Turn off power to the RF receiver digitalWrite(PIN_RF_TX_VCC,HIGH); // Enable the 433Mhz transmitter delayMicroseconds(TRANSMITTER_STABLE_DELAY); // short delay to let the transmitter become stable (Note: Aurel RTX MID needs 500µS/0,5ms) for (int nRepeat = 0; nRepeat <= fretrans; nRepeat++) { fsendbuff=address; // Send command for (int i = 0; i < 24; i++) { // Eurodomest packet is 24 bits // read data bit fdatabit = fsendbuff & fdatamask; // Get most left bit fsendbuff = (fsendbuff << 1); // Shift left if (fdatabit != fdatamask) { // Write 0 digitalWrite(PIN_RF_TX_DATA, HIGH); delayMicroseconds(fpulse * 3); digitalWrite(PIN_RF_TX_DATA, LOW); delayMicroseconds(fpulse * 1); } else { // Write 1 digitalWrite(PIN_RF_TX_DATA, HIGH); delayMicroseconds(fpulse * 1); digitalWrite(PIN_RF_TX_DATA, LOW); delayMicroseconds(fpulse * 3); } } digitalWrite(PIN_RF_TX_DATA, HIGH); delayMicroseconds(fpulse * 1); digitalWrite(PIN_RF_TX_DATA, LOW); // and lower the signal delayMicroseconds(fpulse * 32); } delayMicroseconds(TRANSMITTER_STABLE_DELAY); // short delay to let the transmitter become stable (Note: Aurel RTX MID needs 500µS/0,5ms) digitalWrite(PIN_RF_TX_VCC,LOW); // Turn the 433Mhz transmitter off digitalWrite(PIN_RF_RX_VCC,HIGH); // Turn the 433Mhz receiver on RFLinkHW(); }
void Blyss_Send(unsigned long address) { int fpulse = 400; // Pulse witdh in microseconds int fretrans = 5; // Number of code retransmissions uint32_t fdatabit; uint32_t fdatamask = 0x800000; uint32_t fsendbuff; digitalWrite(PIN_RF_RX_VCC,LOW); // Spanning naar de RF ontvanger uit om interferentie met de zender te voorkomen. digitalWrite(PIN_RF_TX_VCC,HIGH); // zet de 433Mhz zender aan delayMicroseconds(TRANSMITTER_STABLE_DELAY); // short delay to let the transmitter become stable (Note: Aurel RTX MID needs 500µS/0,5ms) byte temp=(millis() &0xff); // used for the timestamp at the end of the RF packet for (int nRepeat = 0; nRepeat <= fretrans; nRepeat++) { // send SYNC 1P low, 6P high digitalWrite(PIN_RF_TX_DATA, LOW); delayMicroseconds(fpulse); digitalWrite(PIN_RF_TX_DATA, HIGH); delayMicroseconds(fpulse * 6); // end send SYNC // -------------- // Send preamble (0xfe) - 8 bits fsendbuff=0xfe; fdatamask=0x80; for (int i = 0; i < 8; i++) { // Preamble // read data bit fdatabit = fsendbuff & fdatamask; // Get most left bit fsendbuff = (fsendbuff << 1); // Shift left if (fdatabit != fdatamask) { // Write 0 digitalWrite(PIN_RF_TX_DATA, LOW); delayMicroseconds(fpulse * 2); digitalWrite(PIN_RF_TX_DATA, HIGH); delayMicroseconds(fpulse * 1); } else { // Write 1 digitalWrite(PIN_RF_TX_DATA, LOW); delayMicroseconds(fpulse * 1); digitalWrite(PIN_RF_TX_DATA, HIGH); delayMicroseconds(fpulse * 2); } } // -------------- fsendbuff=address; fdatamask=0x8000000; // Send command (channel/address/status) - 28 bits for (int i = 0; i < 28; i++) { // read data bit fdatabit = fsendbuff & fdatamask; // Get most left bit fsendbuff = (fsendbuff << 1); // Shift left if (fdatabit != fdatamask) { // Write 0 digitalWrite(PIN_RF_TX_DATA, LOW); delayMicroseconds(fpulse * 2); digitalWrite(PIN_RF_TX_DATA, HIGH); delayMicroseconds(fpulse * 1); } else { // Write 1 digitalWrite(PIN_RF_TX_DATA, LOW); delayMicroseconds(fpulse * 1); digitalWrite(PIN_RF_TX_DATA, HIGH); delayMicroseconds(fpulse * 2); } } // -------------- // Send rolling code & timestamp - 16 bits fsendbuff=0x9800 + temp; fdatamask=0x8000; for (int i = 0; i < 16; i++) { // read data bit fdatabit = fsendbuff & fdatamask; // Get most left bit fsendbuff = (fsendbuff << 1); // Shift left if (fdatabit != fdatamask) { // Write 0 digitalWrite(PIN_RF_TX_DATA, LOW); delayMicroseconds(fpulse * 2); digitalWrite(PIN_RF_TX_DATA, HIGH); delayMicroseconds(fpulse * 1); } else { // Write 1 digitalWrite(PIN_RF_TX_DATA, LOW); delayMicroseconds(fpulse * 1); digitalWrite(PIN_RF_TX_DATA, HIGH); delayMicroseconds(fpulse * 2); } } // -------------- digitalWrite(PIN_RF_TX_DATA, LOW); delayMicroseconds(fpulse * 14); } delayMicroseconds(TRANSMITTER_STABLE_DELAY); // short delay to let the transmitter become stable (Note: Aurel RTX MID needs 500µS/0,5ms) digitalWrite(PIN_RF_TX_VCC,LOW); // zet de 433Mhz zender weer uit digitalWrite(PIN_RF_RX_VCC,HIGH); // Spanning naar de RF ontvanger weer aan. RFLinkHW(); }