Rev 34 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | ingob | 1 | #ifndef _MAIN_H |
2 | #define _MAIN_H |
||
3 | |||
34 | Nick666 | 4 | #define MOTORADRESSE 4 // Adresse (1-4) |
1 | ingob | 5 | #define MANUELL_PWM 0 // zur manuellen Vorgabe der PWM Werte: 0-255 |
6 | #define TEST_MANUELL 0 // zum Testen der Hardware ohne Kommutierungsdetektion Werte: 0-255 (PWM) |
||
7 | #define TEST_SCHUB 0 // Erzeugt ein Schubmuster Werte: 0 = normal 1 = Test |
||
31 | Nick666 | 8 | #define POLANZAHL 14 // Anzahl der Pole (Magnete) Wird nur zur Drehzahlausgabe über Debug gebraucht |
1 | ingob | 9 | #define MAX_PWM 255 |
10 | #define MIN_PWM 3 |
||
11 | #define MIN_PPM 10 // ab hier (PPM-Signal) schaltet der Regler erst ein |
||
40 | Nick666 | 12 | #define FILTER_PPM 14 // wie stark soll das PPM-Signal gefiltert werden (Werte: 0-30)? |
1 | ingob | 13 | |
14 | #define SIO_DEBUG 0 // Testwertausgaben auf der seriellen Schnittstelle |
||
15 | #define X3D_SIO 1 // serielles Protokoll des X3D (38400Bd) Achtung: dann muss SIO_DEBUG = 0 sein |
||
16 | |||
17 | |||
18 | #define _16KHZ // Schaltfrequenz -- die gewünschte einkommentieren |
||
19 | //#define _32KHZ // Schaltfrequenz -- die gewünschte einkommentieren |
||
20 | |||
21 | |||
22 | #ifdef _16KHZ |
||
23 | #define MAX_STROM 130 // ab ca. 13A PWM ausschalten |
||
24 | #define LIMIT_STROM 65 // ab ca. 6,5A PWM begrenzen |
||
25 | #endif |
||
26 | |||
27 | #ifdef _32KHZ |
||
28 | #define MAX_STROM 130 // ab ca. 13A PWM ausschalten |
||
29 | #define LIMIT_STROM 50 // ab ca. 5,0A PWM begrenzen |
||
30 | #endif |
||
31 | |||
31 | Nick666 | 32 | #define SYSCLK 4000000L //Quarz Frequenz in Hz |
1 | ingob | 33 | |
34 | |||
35 | //Robbe Roxxy 2824-34 mit Todd 10x4,5 bei 16kHz |
||
36 | //PWM Strom Schub |
||
37 | //10 0,18A 21g |
||
38 | //20 0,30A 38g |
||
39 | //30 0,40A 49g |
||
40 | //40 0,54A 60g |
||
41 | //50 0,70A 83g |
||
42 | //60 0,95A 102g |
||
43 | //70 1,25A 128g |
||
44 | //80 1,50A 151g |
||
45 | //90 1,83A 175g |
||
46 | //100 2,25A 206g |
||
47 | //110 2,66A 228g |
||
48 | //120 3,10A 257g |
||
49 | //130 3,55A 278g |
||
50 | //140 4,00A 305g |
||
51 | //150 4,50A 330g |
||
52 | //160 5,30A 355g |
||
53 | //170 5,85A 387g |
||
54 | //180 6,40A 400g |
||
55 | //190 7,10A 425g |
||
56 | //200 7,60A 460g |
||
57 | |||
58 | //0,5A 63g 14% |
||
59 | //1,0A 110g 24% |
||
60 | //1,5A 170g 32% |
||
61 | //2,0A 195g 37% |
||
62 | //2,5A 230g 41% |
||
63 | //3,0A 260g 46% |
||
64 | //3,5A 290g 50% |
||
65 | //4,0A 310g 53% |
||
66 | //4,5A 340g 58% |
||
67 | //5,0A 360g 63% |
||
68 | //5,5A 380g 67% |
||
69 | //6,0A 400g 68% |
||
70 | //6,5A 420g 70% |
||
71 | //7,0A 450g 75% |
||
72 | //7,5A 460g 78% |
||
73 | //8,0A 475g 82% |
||
74 | //9,0A 550g 86% |
||
75 | //11 A 600g 100% |
||
76 | |||
77 | |||
78 | #include <stdio.h> |
||
79 | #include <stdlib.h> |
||
80 | #include <string.h> |
||
81 | #include <avr/io.h> |
||
82 | #include <avr/pgmspace.h> |
||
83 | #include <avr/interrupt.h> |
||
84 | #include <avr/eeprom.h> |
||
85 | #include <avr/boot.h> |
||
86 | #include <avr/wdt.h> |
||
87 | |||
88 | #include "twislave.h" |
||
89 | #include "old_macros.h" |
||
90 | #include "analog.h" |
||
91 | #include "uart.h" |
||
92 | #include "timer0.h" |
||
93 | #include "BLMC.h" |
||
94 | |||
95 | #include "PPM_Decode.h" |
||
96 | |||
97 | extern unsigned int I2C_Timeout; |
||
98 | extern unsigned char SIO_Timeout; |
||
99 | extern unsigned int PWM; |
||
100 | extern unsigned int Strom; //ca. in 0,1A |
||
101 | extern unsigned char Strom_max; |
||
102 | extern unsigned char Mittelstrom; |
||
103 | extern unsigned int CntKommutierungen; |
||
104 | extern unsigned char MotorAnwerfen; |
||
105 | extern unsigned char MotorGestoppt; |
||
106 | extern unsigned char ZeitZumAdWandeln; |
||
107 | extern unsigned char MaxPWM; |
||
108 | |||
109 | #define ROT 0x08 |
||
110 | #define GRUEN 0x80 |
||
111 | |||
112 | #if defined(__AVR_ATmega8__) |
||
113 | # define OC1 PB1 |
||
114 | # define DDROC DDRB |
||
115 | # define OCR OCR1A |
||
116 | # define PWM10 WGM10 |
||
117 | # define PWM11 WGM11 |
||
118 | #endif |
||
119 | |||
120 | |||
121 | #endif //_MAIN_H |
||
122 | |||
123 | |||
124 | |||
125 | |||
126 |