/* Code for board with MICRF002 ASK receiver. Uses attiny44 with 20 MHz Crystal oscillator. tiny44 in CTC mode provides 5.00 MHz oscillator signal for transmitter, pulls low SHUT pin to receive, REFOSC on PA5: PA5 is pin8, OC1B. WAKE on PA2: Output from MICRF002 - low when signal is detected. SHUT on PA1: pull low to enable. Normally pulled high internally to MICRF002 DO on PA0: received signal */ #define F_CPU 20000000 #include #include #define pin_test(pins,pin) (pins & pin) // test for port pin #define WAVEDELAY() _delay_us(500) // Half-period of squarewave in microseconds. #define COUNTER 1 #define signal_port PINA #define signal_pin (1 << PA0) int main(void) { // // set clock divider to /1 // CLKPR = (1 << CLKPCE); CLKPR = (0 << CLKPS3) | (0 << CLKPS2) | (0 << CLKPS1) | (0 << CLKPS0); DDRA = (1 << PA7) | (1 << PA5) | (0 << PA2) | (1 << PA1) | (0 << PA0); // set PA7,PA5,PA1 for output, PA2 and PA0 for input.. PORTA = (0 << PA0); // NO pullup resistor on PA0 //working with TC1, 16 bit timer. //set to toggle OC1B on compare. Set WGM bits to specify CTC mode, together with the WGM13-WGM12 bits in TCCR1B. TCCR1A = 0<