17.05.13 17:29
17.05.13 21:32
18.05.13 17:07
18.05.13 17:15
18.05.13 17:21
spiTx(0x000013); // InitialisierungspiTx(0x000800); // Counter A setzenspiTx(0x09db05); // Counter B setzen
18.05.13 17:43
18.05.13 17:45
18.05.13 17:52
18.05.13 18:01
18.05.13 18:05
18.05.13 18:10
#include "../lib/0.1.3/global.h"#include "../lib/0.1.3/io/io.h"#include <util/delay.h>// #define TINY13#ifdef TINY13#define LE(x) out(PORTB,PB1,0,x)// active low, 20ns pulse width, 10ns setu p time#define DATA(x) out(PORTB,PB0,0,x)// normal orientation, high = 1#define CLK(x) out(PORTB,PB2,0,x)// Clock = rising edge, 25ns on/off width #else#define LE(x) out(PORTD,PD2,0,x)#define DATA(x) out(PORTD,PD3,0,x)#define CLK(x) out(PORTD,PD4,0,x)#endif// Hier Sollfrequenz einstellen// 5050 erzeugt 404 MHz^^ Sonde not found#define COUNT_B 5050 // Standardwert 5046 für 403,69 MHzvoid 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) {#ifdef TINY13DDRB = (1<<PB0) | (1<<PB1) | (1<<PB2); // Pseudo SPI-Sch nittstelle OUTPUTs #elseDDRD = (1<<PD2) | (1<<PD3) | (1<<PD4);#endifdelayms(2500); // boot time. (spasshalber)sondeTx();delayms(3);sondeTx();while(1) {// do nothing}return 0;}
18.05.13 19:39
18.05.13 19:52
18.05.13 21:31
18.05.13 21:34