1 | /*
|
2 | * Sender_mit_RFM02.c
|
3 | *
|
4 | * Created: 10.12.2014 17:19:47
|
5 | * Author: Stemmler
|
6 | */
|
7 |
|
8 |
|
9 | #include <avr/io.h>
|
10 |
|
11 | #define F_CPU 16000000UL
|
12 | #include <util/delay.h>
|
13 |
|
14 | #include "rf02.h"
|
15 |
|
16 | //#include "global.h"
|
17 |
|
18 | unsigned char test[32]="Dies ist ein 433MHz Test !!!\n ";
|
19 |
|
20 | int main(void)
|
21 | {
|
22 |
|
23 | DDRD = (1 << DDD0) | (1 << DDD1); //Port D als Ausgang
|
24 | PORTD = (1<<DDD0); // Pin D0 an
|
25 |
|
26 | DDRC = 0x0000; //Port C als Eingang
|
27 | PORTC |= ( (1<<PC0) | (1<<PC1) ); //Interne Pull-Up fuer beide einschalten
|
28 |
|
29 |
|
30 | rf02_init(); // ein paar Register setzen (z.B. CLK auf 10MHz)
|
31 | rf02_setfreq(RF02FREQ(830.25)); // Sende/Empfangsfrequenz auf 830,25 MHz einstellen
|
32 | rf02_setpower(4); // -12dBm Ausgangangsleistung
|
33 | rf02_setmodfreq(3); // 120kHz Frequenzshift
|
34 | rf02_setbaud(19200); // 19200 Baud
|
35 |
|
36 |
|
37 | while(1)
|
38 | {
|
39 | //TODO:: Please write your application code
|
40 | for (int i = 0; i < 32; i++)
|
41 | {
|
42 | test[i] = PINC;
|
43 | }
|
44 |
|
45 |
|
46 | rf02_txdata(test,32);
|
47 | for (unsigned char i=0; i<100; i++)
|
48 | _delay_ms(10);
|
49 |
|
50 | PORTD ^= (1<<PORTD0); //Pin D0 toggeln
|
51 | PORTD ^= (1<<PORTD1); //Pin D1 toggeln
|
52 | }
|
53 | }
|