24,14 → 24,6 |
volatile unsigned char ch3; |
volatile unsigned char ch4; |
volatile unsigned char ch5; |
volatile unsigned char ch0_tmp; |
volatile unsigned char ch1_tmp; |
volatile unsigned char ch2_tmp; |
volatile unsigned char ch3_tmp; |
volatile unsigned char ch4_tmp; |
volatile unsigned char ch5_tmp; |
|
|
unsigned int timer; |
|
SIGNAL(SIG_OVERFLOW1) |
74,12 → 66,8 |
|
SIGNAL(SIG_OVERFLOW0) |
{ |
// this function is called every 32us, |
// it is very important that it's execution time is as short as possible |
// currently it's about 20us |
|
static unsigned char counter = 254; |
static unsigned char ms1 = 0; |
static unsigned char counter; |
static unsigned char ms1; |
unsigned char PORTB_BAK; |
unsigned char PORTD_BAK; |
|
90,21 → 78,15 |
{ |
PORTB_BAK LEDON (CH0_B | CH1_B | CH2_B); |
PORTD_BAK LEDON (CH3_D | CH4_D | CH5_D); |
ch0_tmp = ch0; |
ch1_tmp = ch1; |
ch2_tmp = ch2; |
ch3_tmp = ch3; |
ch4_tmp = ch4; |
ch5_tmp = ch5; |
counter = 0; |
} |
|
if (ch0_tmp == counter) PORTB_BAK LEDOFF CH0_B; |
if (ch1_tmp == counter) PORTB_BAK LEDOFF CH1_B; |
if (ch2_tmp == counter) PORTB_BAK LEDOFF CH2_B; |
if (ch3_tmp == counter) PORTD_BAK LEDOFF CH3_D; |
if (ch4_tmp == counter) PORTD_BAK LEDOFF CH4_D; |
if (ch5_tmp == counter) PORTD_BAK LEDOFF CH5_D; |
if (ch0 == counter) PORTB_BAK LEDOFF CH0_B; |
if (ch1 == counter) PORTB_BAK LEDOFF CH1_B; |
if (ch2 == counter) PORTB_BAK LEDOFF CH2_B; |
if (ch3 == counter) PORTD_BAK LEDOFF CH3_D; |
if (ch4 == counter) PORTD_BAK LEDOFF CH4_D; |
if (ch5 == counter) PORTD_BAK LEDOFF CH5_D; |
|
PORTB = PORTB_BAK; |
PORTD = PORTD_BAK; |
163,6 → 145,7 |
|
|
|
|
/*##############################################################################*/ |
void StartPPM(void) |
{ |
180,7 → 163,6 |
|
|
|
/*##############################################################################*/ |
int GetPPM(void) |
{ |
//this routines seems to be nesseccary, as reading a 16 bit value |
206,7 → 188,7 |
{ |
unsigned int i; |
unsigned char colorState; |
unsigned char nextcolorState=0; |
unsigned char nextcolorState; |
|
DDRB = (CH0_B|CH1_B|CH2_B); |
PORTB = 0x00; |
231,7 → 213,7 |
sei(); |
|
|
// Farbablauf: rot > Violett > blau > tuerkis > gruen > gelb > |
//rot > Violett > Blau > Türkis > Grün > Gelb > |
|
|
colorState = 0; |
246,12 → 228,12 |
switch(colorState) |
{ |
case 0: |
ch0 = i; //fade in (ch0) red |
ch0 = i; //fade in (ch0) red |
nextcolorState = 2; |
break; |
|
case 2: |
ch1 = i; //fade in (ch1) blue to get pure purple (red + blue) |
ch1 = i; //fade in (ch1) blue to get purple (red + blue) |
nextcolorState = 4; |
break; |
|
261,7 → 243,7 |
break; |
|
case 6: |
ch2 = i; //fade in (ch2) green to get pure cyan (blue + green) |
ch2 = i; //fade in (ch2) green to get cyan (blue + green) |
nextcolorState = 8; |
break; |
|
271,7 → 253,7 |
break; |
|
case 10: |
ch0 = i; //fade in (ch0) red to get yellow pure (green + red) |
ch0 = i; //fade in (ch0) red to get yellow (green + red) |
nextcolorState = 12; |
break; |
|
282,13 → 264,12 |
} |
|
|
timer = SetDelay(5); //wait 10ms |
timer = SetDelay(1); |
while (!CheckDelay(timer)); |
} |
|
colorState = nextcolorState; |
|
timer = SetDelay(3); //hold pure colors for additional 3ms |
timer = SetDelay(3); |
while (!CheckDelay(timer)); |
|
|
296,86 → 277,3 |
|
|
} |
|
|
|
/* |
170 00fa 1F92 push __zero_reg__ |
171 00fc 0F92 push __tmp_reg__ |
172 00fe 0FB6 in __tmp_reg__,__SREG__ |
173 0100 0F92 push __tmp_reg__ |
174 0102 1124 clr __zero_reg__ |
175 0104 2F93 push r18 |
176 0106 3F93 push r19 |
177 0108 8F93 push r24 |
178 010a 9F93 push r25 |
181 010c 38B3 in r19,56-0x20 |
184 010e 22B3 in r18,50-0x20 |
187 0110 8091 0000 lds r24,counter.1797 |
188 0114 8F5F subi r24,lo8(-(1)) |
189 0116 8093 0000 sts counter.1797,r24 |
190 011a 8F3F cpi r24,lo8(-1) |
191 011c 01F4 brne .L15 |
193 011e 3E60 ori r19,lo8(14) |
195 0120 2863 ori r18,lo8(56) |
197 0122 8091 0000 lds r24,ch0 |
198 0126 8093 0000 sts ch0_tmp,r24 |
200 012a 8091 0000 lds r24,ch1 |
201 012e 8093 0000 sts ch1_tmp,r24 |
203 0132 8091 0000 lds r24,ch2 |
204 0136 8093 0000 sts ch2_tmp,r24 |
206 013a 8091 0000 lds r24,ch3 |
207 013e 8093 0000 sts ch3_tmp,r24 |
209 0142 8091 0000 lds r24,ch4 |
210 0146 8093 0000 sts ch4_tmp,r24 |
212 014a 8091 0000 lds r24,ch5 |
213 014e 8093 0000 sts ch5_tmp,r24 |
215 0152 1092 0000 sts counter.1797,__zero_reg__ |
218 0156 8091 0000 lds r24,ch0_tmp |
219 015a 9091 0000 lds r25,counter.1797 |
220 015e 8917 cp r24,r25 |
221 0160 01F4 brne .L17 |
222 0162 377F andi r19,lo8(-9) |
225 0164 8091 0000 lds r24,ch1_tmp |
226 0168 8917 cp r24,r25 |
227 016a 01F4 brne .L19 |
228 016c 3B7F andi r19,lo8(-5) |
231 016e 8091 0000 lds r24,ch2_tmp |
232 0172 8917 cp r24,r25 |
233 0174 01F4 brne .L21 |
234 0176 3D7F andi r19,lo8(-3) |
237 0178 8091 0000 lds r24,ch3_tmp |
238 017c 8917 cp r24,r25 |
239 017e 01F4 brne .L23 |
240 0180 277F andi r18,lo8(-9) |
243 0182 8091 0000 lds r24,ch4_tmp |
244 0186 8917 cp r24,r25 |
245 0188 01F4 brne .L25 |
246 018a 2F7E andi r18,lo8(-17) |
249 018c 8091 0000 lds r24,ch5_tmp |
250 0190 8917 cp r24,r25 |
251 0192 01F4 brne .L27 |
252 0194 2F7D andi r18,lo8(-33) |
255 0196 38BB out 56-0x20,r19 |
257 0198 22BB out 50-0x20,r18 |
259 019a 8091 0000 lds r24,ms1.1798 |
260 019e 8F5F subi r24,lo8(-(1)) |
261 01a0 8093 0000 sts ms1.1798,r24 |
262 01a4 8132 cpi r24,lo8(33) |
263 01a6 01F4 brne .L31 |
265 01a8 1092 0000 sts ms1.1798,__zero_reg__ |
267 01ac 8091 0000 lds r24,TMR1MS |
268 01b0 9091 0000 lds r25,(TMR1MS)+1 |
269 01b4 0196 adiw r24,1 |
270 01b6 9093 0000 sts (TMR1MS)+1,r25 |
271 01ba 8093 0000 sts TMR1MS,r24 |
274 01be 9F91 pop r25 |
275 01c0 8F91 pop r24 |
276 01c2 3F91 pop r19 |
277 01c4 2F91 pop r18 |
278 01c6 0F90 pop __tmp_reg__ |
279 01c8 0FBE out __SREG__,__tmp_reg__ |
280 01ca 0F90 pop __tmp_reg__ |
281 01cc 1F90 pop __zero_reg__ |
282 01ce 1895 reti |
*/ |