Zur Übersicht - INFO - Neueste 50 Beiträge - Neuer Beitrag - Suchen - Zum C-Control-I-Forum - Zum C-Control-II-Forum

Re: One Wire DS18S20 auf AVR 32 Kategorie: Sonstige Hardware (von Bernd L. - 8.12.2013 16:06)
Als Antwort auf One Wire DS18S20 auf AVR 32 von Gordon Pipa - 24.11.2013 13:43

> Hallo, hat schonmal jemand die ONE WIRE Kommunikation auf dem neuen AVR 32 getestet.
> Wenn ich das demo programm laufen lasse bekomme ich einen Return value ret=1 für erfolgreiches
> finden eines one wire devices. Danach scheinen aber alle versuche das device zu lesen mit zu scheitern
> Jeder der lese Kommandos, sowohl für den rom_code als auch für scratch_pad(i)= OneWire_Read() ergeben
> bei mir nullen. Um auszuschliessen das der DS18S20 habe ich gleiches auf einer Pro128 getestet. Da
> läuft es. Den DS18S20 habe ich zusätzlich mit 3.3V versorgungsspannung versehen.
>
> Hat jemand ähnliches bemerkt ? Oder eine Lösung ?
>
> Angehängt das Demo programm:
>
> /*******************************************************************************
>
>  Project Name:      DS18S20.cprj
>  Required Libs's:   IntFunc_lib.cc
>  Files:             DS18S20.cbas
>  Writer:            CCPRO-TEAM
>  Date:              29.08.2013
>  Function:          Demonstrates OneWire functions
>
>  ------------------------------------------------------------------------------
>  AVR32 Serie:
>  Required the C-Control PRO AVR32-Bit UNIT Conrad BN: 192573
>  Applicationboard Conrad BN: 192587
>  Or Mainboard Conrad BN: 192702
>
>  MEGA Serie:
>  Required the C-Control PRO MEGA32 UNIT Conrad BN: 198206
>  and Evalationboard Conrad BN: 198245
>  Or Projectboard Conrad BN: 197287
>
>  Or C-Control PRO MEGA128 UNIT Conrad BN: 198219
>  Or C-Control PRO MEGA128CAN Conrad BN: 197989
>  and Evaluationboard Conrad BN: 198258
>  or Projectboard Conrad BN: 197313
>  ------------------------------------------------------------------------------
>
>  Note:
>  -----
>
>  Sample Code to read DS18S20 temperature sensor from Dallas Maxim
>  Conrad BN: 198284
>
> *******************************************************************************/
>
> ' C-Control PRO AVR32 Mainboard 1Wire port is P3
> #define 1WirePort   P3
>
>
> Dim text(40) As Char
> Dim ret,i As Integer
> Dim temp As Integer
> Dim rom_code(8) As Byte
> Dim scratch_pad(9) As Byte
>
>
> /*------------------------------------------------------------------------------
> name:           main
> input:          -
> output:         -
> description:    Read from sensor
> ------------------------------------------------------------------------------*/
> Sub main()
>
>     ret = OneWire_Reset(1WirePort)
>
>     If ret = 0 Then
>        text= "no device found"
>        Msg_WriteText(text)
>        Goto Ende
>     End If
>
>
>     OneWire_Write(0x33)                 ' Read slaveâ??s 64-bit ROM code cmd
>     For i = 0 To 8
>         rom_code(i) = OneWire_Read()    ' Read ROM code byte
>         Msg_WriteHex(rom_code(i))
>     Next
>     Msg_WriteChar(13)
>
>
>     OneWire_Reset(1WirePort)
>     OneWire_Write(0xcc)                 ' Skip ROM cmd
>     OneWire_Write(0x44)                 ' Start temperature measure cmd
>
>     AbsDelay(3000)
>
>     OneWire_Reset(1WirePort)            ' PortA.7
>     OneWire_Write(0xcc)                 ' Skip ROM cmd
>     OneWire_Write(0xbe)                 ' Read scratch_pad cmd
>
>     For i = 0 To 9                      ' Read whole scratchpad
>         scratch_pad(i)= OneWire_Read()
>         Msg_WriteHex(scratch_pad(i))
>     Next
>     Msg_WriteChar(13)
>
>     text = "Temperature: "
>     Msg_WriteText(text)
>
>     temp = scratch_pad(1) * 256 + scratch_pad(0)
>     Msg_WriteFloat(temp * 0.5)
>     Msg_WriteChar(99)
>     Msg_WriteChar(13)
>
>
>     Lab Ende
>
> End Sub
>
>
> /*******************************************************************************
>  * Info
>  *******************************************************************************
>  * Changelog:
>  * -
>  *
>  *******************************************************************************
>  * Bugs, feedback, questions and modifications can be posted on the
>  * C-Control Forum on http://www.c-control.de
>  * Of course you can also write us an e-mail to: webmaster@c-control.de
>  * We publish updates from time to time on www.c-control.de!
> /******************************************************************************/
>
> ' EOF

Hallo zusammen,

ich habe das gleiche Problem. Allerdings nur, wenn ich den DS18S20 mit 3,3V Strom versorge.
Im parasitären Betrieb funktioniert die Demo reibungslos.
Allerdings habe ich in der 3,3V Leitung noch einen Strombegrenzungswiderstand mit 4,7kOhm
eingesetzt, da sonst der DS18S20 hei�läuft.

Vermutlich stimmen jetzt die Pegel nicht mehr.
Es wäre schön, wenn einer von euch einen Tipp hätte. ;-)

Viele Grü�e
Bernd L.


    Antwort schreiben


Antworten: