Hallo,
ich habe zwei Schieberegister (74HC595) an meinem Arduino Uno
angeschlossen. Ich benutze die Funktion ShiftOut() um bei den
Schieberegistern bestimmte Werte zu setzen was auch soweit ganz gut
funktioniert. (Die Schieberegister sind im Moment an zwei
7-Segment-Displays angeschlossen)
Jetzt wollte ich den Serial Monitor von Arduino in mein Projekt
integrieren, was allerdings dazu führt dass meine Schieberegister bzw.
die Funktion ShiftOut() nicht mehr wie zuvor funktionieren. Ich kann mir
allerdings nicht erklären weshalb, eine (ziemlich ausführliche) Suche im
Web hat mich auch nicht weiter gebracht.
Hier ist der Code der funktioniert (also ohne den Serial Monitor):
1 | const int latchPin = 2;//Pin connected to ST_CP of 74HC595
|
2 | const int clockPin = 3;//Pin connected to SH_CP of 74HC595
|
3 | const int dataPin = 1; //Pin connected to DS of 74HC595
|
4 |
|
5 | int value = 111;
|
6 |
|
7 | void setup()
|
8 | {
|
9 | pinMode(latchPin,OUTPUT);
|
10 | pinMode(clockPin,OUTPUT);
|
11 | pinMode(dataPin,OUTPUT);
|
12 |
|
13 |
|
14 | digitalWrite(latchPin,LOW);
|
15 |
|
16 | shiftOut(dataPin,clockPin,MSBFIRST,(value >> 8)); // Zweites Schieberegister
|
17 | shiftOut(dataPin,clockPin,MSBFIRST,value); // Erstes
|
18 |
|
19 | digitalWrite(latchPin,HIGH);
|
20 |
|
21 |
|
22 | }
|
23 |
|
24 | void loop()
|
25 | {
|
26 |
|
27 | }
|
und sobald ich den Serial Monitor integrieren will funktioniert nichts
mehr:
1 | const int latchPin = 2;//Pin connected to ST_CP of 74HC595
|
2 | const int clockPin = 3;//Pin connected to SH_CP of 74HC595
|
3 | const int dataPin = 1; //Pin connected to DS of 74HC595
|
4 |
|
5 | int value = 111;
|
6 |
|
7 | void setup()
|
8 | {
|
9 | pinMode(latchPin,OUTPUT);
|
10 | pinMode(clockPin,OUTPUT);
|
11 | pinMode(dataPin,OUTPUT);
|
12 |
|
13 |
|
14 | Serial.begin(9600);
|
15 | Serial.println("Start message");
|
16 |
|
17 | digitalWrite(latchPin,LOW);
|
18 |
|
19 | shiftOut(dataPin,clockPin,MSBFIRST,(value >> 8)); // Zweites Schieberegister
|
20 | shiftOut(dataPin,clockPin,MSBFIRST,value); // Erstes
|
21 |
|
22 | digitalWrite(latchPin,HIGH);
|
23 |
|
24 |
|
25 | }
|
26 |
|
27 | void loop()
|
28 | {
|
29 |
|
30 | }
|
Im zweiten Fall leuchten beide 7-Segment-Displays komplett, egal welchen
Wert ich setze. Im ersten Fall funktioniert noch alles wie gewünscht.
Ich hoffe mein Problem ist verständlich und wäre sehr froh wenn mir hier
jemand weiterhelfen könnte...