MoinMoin, ich bastel grad ne kleine Zündmaschine für Silvester. Tiny13
steuert, 10Ohm als Zündkapsel, dicker Transistor und ne dicke Batterie
als Stromquelle.
Hardwareseitig läuft auch alles, Transistor schaltet durch, Widerstand
glüht auf, Lunte macht "zisch".
Wenn ich aber nun meine "Zündsequenz" im Simulator durchlaufen lass,
wird beim ersten Durchgang kein Pin geschaltet, erst beim 2ten Durchlauf
macht es, wie es soll.
Ist das ein Fehler im Simulator, oder in meinem Programm? Hab grad kein
Tiny13 mehr liegen, muss also nochma schnell los, wenn ich gesagt
bekomme "läuft, is nur n simulatorfehler".
MfG und nen guten Rutsch
euer Chaos
1 | /*
|
2 | * Zündmaschine.c
|
3 | *
|
4 | * Created: 30.12.2013 13:51:03
|
5 | * Author: Ich
|
6 | */
|
7 |
|
8 |
|
9 | #include <avr/io.h>
|
10 | #include <util/delay.h>
|
11 |
|
12 | void SekDelay(void);
|
13 |
|
14 | int main(void)
|
15 | {
|
16 | PORTB = 0;
|
17 | DDRB = 0b00111110;
|
18 |
|
19 | while(PINB == 0)
|
20 | {
|
21 |
|
22 | }
|
23 |
|
24 | while(1)
|
25 | {
|
26 | PORTB = 0b00000010;
|
27 |
|
28 | SekDelay();
|
29 | SekDelay();
|
30 | SekDelay();
|
31 | SekDelay();
|
32 | SekDelay();
|
33 |
|
34 | PORTB = 0b00000100;
|
35 |
|
36 | SekDelay();
|
37 | SekDelay();
|
38 | SekDelay();
|
39 | SekDelay();
|
40 | SekDelay();
|
41 |
|
42 | PORTB = 0b00001000;
|
43 |
|
44 | SekDelay();
|
45 | SekDelay();
|
46 | SekDelay();
|
47 | SekDelay();
|
48 | SekDelay();
|
49 |
|
50 | PORTB = 0b00010000;
|
51 |
|
52 | SekDelay();
|
53 | SekDelay();
|
54 | SekDelay();
|
55 | SekDelay();
|
56 | SekDelay();
|
57 |
|
58 | PORTB = 0b00100000;
|
59 | }
|
60 | }
|
61 |
|
62 | void SekDelay(void)
|
63 | {
|
64 | _delay_ms(250);
|
65 | _delay_ms(250);
|
66 | _delay_ms(250);
|
67 | _delay_ms(250);
|
68 | }
|