Hallo
Habe ein MyAVR Starterboard mit LCD. Hab versucht jetzt einen DS1820
auszulesen.
Code sieht so aus :
1 | '------------------------------------------------------------------------------
|
2 | ' LCD: Db4-Db7 = Portd.4-Portd.7 E = Portd.3 Rs = Portd.2 Backlight = Portb.1
|
3 | ' I2C: Sda = Portc.4 Scl = Portc.5
|
4 | ' UART: RxD = Portd.0 TxD = Portd.1
|
5 | ' 1wire Portb.0
|
6 | ' Frei: Portb.2-Portb.5 Portc.0-Portc.3
|
7 | '------------------------------------------------------------------------------
|
8 | $regfile = "m8def.dat"
|
9 | $crystal = 3686411
|
10 |
|
11 | zuordnen
|
12 | Ddrd = &HFF
|
13 | Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.3 , Rs = Portd.2
|
14 | Config Lcd = 16 * 2
|
15 |
|
16 | durch Software realisiert
|
17 | Config 1wire = Portc.5
|
18 |
|
19 | Dim Ar(2) As Byte
|
20 |
|
21 | Cls
|
22 |
|
23 | Do
|
24 | 1wreset
|
25 | 1wwrite &HCC
|
26 | 1wwrite &H44
|
27 | 1wreset
|
28 | 1wwrite &HCC
|
29 | 1wwrite &HBE
|
30 | Ar(1) = 1wread(2)
|
31 |
|
32 | Waitms 500
|
33 | Locate 1 , 1
|
34 | Lcd Hex(ar(2)) ; Hex(ar(1))
|
35 | Locate 2 , 1
|
36 | Shift Ar(1) , Right , 1
|
37 | Lcd Ar(1)
|
38 | Loop
|
39 |
|
40 | End
|
Als Ausgabe erhalte ich jedoch nichts. Der Chip antwortet nicht. Hab die
Wairms auch schon mal höher angesetzt jedoch kommt da nix.
Widerstand von 4,7k oder 10k zwischen VDD und Pinc5 hatte ich auch. Geht
ohne nicht und geht auch mit nicht.
Habe ich einen Fehler im Code oder ist der Chip defekt?
Danke für die Hilfe!!!
P.S. Mache alles im BASCOM
Grüsse