20.06.13 19:29
20.06.13 19:45
20.06.13 19:58
20.06.13 20:01
21.06.13 10:43
21.06.13 13:36
21.06.13 22:49
27.06.13 13:48
15.07.13 17:33
15.07.13 17:46
15.07.13 18:52
#include "global.h"#include "io.h"#include <util/delay.h>#define LE(x) out(PORTB,PB1,0,x)// TINY=PIN6 ADF=13(oben)active low, 20ns pulse width, 10ns setup time#define DATA(x) out(PORTB,PB0,0,x)// TINY=PIN5 ADF=12(MITTE)normal orienta tion, high = 1#define CLK(x) out(PORTB,PB2,0,x)// TINY=PIN7 ADF=11(UNTEN)Clock = rising edge, 25ns on/off width // Hier Sollfrequenz einstellen// 5050 erzeugt 404,01 MHz^^ Sonde not found// 5051 erzeugt 404,09// 5052 erzeugt 404,17// 5413 erzeugt 433,05//#define COUNT_B 5050 // Standardwert 5046 für 403,69 MHz//#define COUNT_B 5051 #define COUNT_B 5413 void spiClose(void) { // LE-PulsLE(1);delayus(7);LE(0);delayus(40);}void spiClock(void) { // ClockpulsCLK(1);delayus(10);CLK(0);delayus(10);}// Sendet ein SPI-Datenpaketvoid spiTx(uint32_t daten) {for(uint8_t i=0; i<21; i++) {if (daten & ((uint32_t)1<<(20-i))) {DATA(1);} else {DATA(0);}spiClock();}spiClose();delayus(200);}void sondeTx(void) {spiTx(0x000013); // InitialisierungspiTx(0x000800); // Counter A setzenspiTx(((uint32_t)COUNT_B<<7) + (uint32_t)5); // Counter B setzen }int main(void) {DDRB = (1<<PB0) | (1<<PB1) | (1<<PB2); // Pseudo SPI-Sch nittstelle OUTPUTs delayms(500); // boot time. (spasshalber)sondeTx();delayms(3);while(1) {sondeTx();delayms(10000);}return 0;}
15.07.13 19:15
15.07.13 19:19
15.07.13 19:31
15.07.13 20:04