/* main.c * * * Created: 9/24/2019 2:15:19 PM * Author: wfarmer, dlenfesty */ // CLKDIV8 was set on our processor #define F_CPU 1200000UL #define ON_TIME 9 // On time for pulses, accounting for overhead #define END_TIME 87.5 // Off time at the end of the pulse train (tuned for overhead + clock drift) #define NUM_PULSES 15 #include #include int main(void) { DDRB |= (1 << DDB3); // Set PB5 low PORTB &= ~(1 << PORTB3); // Main loop while (1) { // Loop for all pulses, high then low, excluding 15th low pulse, which is 100us for (uint8_t i = 0; i < (NUM_PULSES * 2) - 1; i++) { // Toggle PB5 PORTB ^= (1 << PORTB3); _delay_us(ON_TIME); } // Last low pulse PORTB &= ~(1 << PORTB3); _delay_us(END_TIME); } }