49 lines
914 B
C
49 lines
914 B
C
#include <avr/io.h>
|
|
#include <util/delay.h>
|
|
|
|
#define STP PB0
|
|
#define NET PB1
|
|
#define TWV PB2
|
|
|
|
int main(void) {
|
|
DDRA |= (1<<PA7) | (1<<PA3) | (1<<PA4);
|
|
DDRB |= (1<<STP) | (1<<NET) | (1<<TWV);
|
|
|
|
PORTB |= (1<<NET); //Netzteil Off!
|
|
|
|
_delay_ms(500);
|
|
PORTA |= (1<<PA3);
|
|
|
|
_delay_ms(2000);
|
|
PORTB |= (1<<TWV); //12V Schiene On
|
|
PORTB |= (1<<STP); //Stepup On
|
|
PORTA &= ~(1<<PA3);
|
|
|
|
_delay_ms(2000);
|
|
PORTB &= ~(1<<NET); //Netzteil An!
|
|
PORTA |= (1<<PA3);
|
|
|
|
_delay_ms(5000);
|
|
//PORTB &= ~(1<<PB1);
|
|
PORTB &= ~(1<<STP); //Stepup Off!
|
|
PORTA &= ~(1<<PA3);
|
|
|
|
|
|
while(1) {
|
|
/*PORTA |= (1<<PA7);
|
|
_delay_ms(500);
|
|
PORTA &= ~((1<<PA7));
|
|
PORTA |= (1<<PA3);
|
|
_delay_ms(500);
|
|
PORTA &= ~((1<<PA3));
|
|
PORTA |= (1<<PA4);
|
|
_delay_ms(500);
|
|
PORTA &= ~((1<<PA4));*/
|
|
/*PORTA &= ~((1<<PA7));
|
|
if (PINB & (1<<PB1)) {
|
|
PORTA |= (1<<PA7);
|
|
}*/
|
|
_delay_ms(50);
|
|
}
|
|
}
|