Diskussion:RFM12 library/en

Aus LaborWiki
Version vom 3. Januar 2012, 09:53 Uhr von Ex (Diskussion | Beiträge) (Änderungen von 70.135.118.126 (Diskussion) rückgängig gemacht und letzte Version von Hansinator wiederhergestellt)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu: Navigation, Suche

(to be replaced soon)

Raw transmissions[Quelltext bearbeiten]

You can make use of raw transmission mode, meaning manually switching the transmitter on and off in software. This feature is especially useful if you want to control devices that don't support the RFM12's modulation (e.g. Radio controlled power Plugs).

In order to use the raw transmission feature, you have to set the variable RFM12_RAW_TX in rfm12_config.h. Before you can use the raw transmission mode, you'll have to tell the library to switch to raw mode using the function rfm12_rawmode(1). The functions rfm12_tx_on() and rfm12_tx_off() will then manually switch the transmitter on and off.

Note that when being in raw transmission mode, the rfm12 interrupt is disabled as well as other library functions. You will not be able to receive or send data the "usual" way while raw transmission mode is on. To switch back to normal mode, execute rfm12_rawmode(0).


Example Code[Quelltext bearbeiten]

 ...
 rfm12_rawmode(1);   /* switch to raw mode           */
 rfm12_tx_on();      /* send a logical one...        */
 _delay_ms(1);       /* ...for 1 ms...               */
 rfm12_tx_off();     /* then disable the transmitter */
 rfm12_rawmode(0);   /* switch back to normal mode   */
 ...

Technical details[Quelltext bearbeiten]

In raw transmission mode, the RFM12 module's transmitter is simply turned on and off. While it is enabled it transmits the preamble in an endless loop.

The module doesn't seem to support modulation modes other than it's own, so sending a logical one actually means sending the preamble with the native modulation mode. "Dumb" devices (rf power-plugs, doorbells, etc.) may well recognize this as a high-peak and can be controlled this way.