Rev 1 |
Rev 7 |
Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
#ifndef _MAIN_H
#define _MAIN_H
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include <avr/eeprom.h>
#include <avr/boot.h>
#include <avr/wdt.h>
#include "twislave.h"
#include "old_macros.h"
#include "analog.h"
#include "uart.h"
#include "timer0.h"
#if defined(__AVR_ATmega8__)
# define OC1 PB1
# define DDROC DDRB
# define OCR OCR1A
# define PWM10 WGM10
# define PWM11 WGM11
#endif
#define SYSCLK 8000000L //Quarz Frequenz in Hz
#define INT0_ENABLE GIMSK |= 0x40
#define INT0_DISABLE GIMSK &= ~0x40
#define TIM0_START TIMSK0 |= _BV(TOIE0)
#define TIM0_STOPP TIMSK0 &= ~_BV(TOIE0)
#define ICP_INT_ENABLE TIMSK0 |= 0x20
#define ICP_INT_DISABLE TIMSK0 &= ~0x20
#define TIMER1_INT_ENABLE TIMSK0 |= 0x04
#define TIMER1_INT_DISABLE TIMSK0 &= ~0x04
#define TIMER2_INT_ENABLE TIMSK0 |= 0x40
#define TIMER2_INT_DISABLE TIMSK0 &= ~0x40
#define INT0_POS_FLANKE MCUCR |= 0x01
#define INT0_ANY_FLANKE MCUCR |= 0x01
#define INT0_NEG_FLANKE MCUCR &= ~0x01
#define CLR_INT0_FLAG GIFR &= ~0x40
#define INIT_INT0_FLANKE MCUCR &= ~0x03; MCUCR |= 0x02;
#define TIMER0_PRESCALER TCCR0
#define ICP_POS_FLANKE TCCR1B |= (1<<ICES1)
#define ICP_NEG_FLANKE TCCR1B &= ~(1<<ICES1)
#define LED_ON PORTD |= 0x80
#define LED_OFF PORTD &= ~0x80
#define FLIP_HIGH PORTD |= 0x60
#define FLIP_LOW PORTD &= ~0x60
extern unsigned int PwmHeading;
extern unsigned char PC_Connected;
extern int Heading;
extern signed int MagnetN,MagnetR,MagnetZ;
#endif //_MAIN_H