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