- LiFePO4 Speicher Test         
Seite 4 von 6 ErsteErste ... 23456 LetzteLetzte
Ergebnis 31 bis 40 von 55

Thema: DS1621 auslesen

  1. #31
    Neuer Benutzer Öfters hier
    Registriert seit
    31.03.2005
    Beiträge
    10
    Anzeige

    Praxistest und DIY Projekte
    hast du auch an Pullup Widerstände gedacht bei mir geht ohne die gar nix !!

  2. #32
    Erfahrener Benutzer Roboter Genie
    Registriert seit
    09.07.2005
    Ort
    127.0.0.1
    Alter
    32
    Beiträge
    824
    Hallo

    Die Pullup Wiederstände sind bei mir schon auf dem Board (RN-Control)
    Aber ich denke es liegt an meinem Sensor, werde mir bei gelegenheit mal 2 bestellen.

    mfg Luca
    Sollte ein Bild von mir nicht angezeigt werden, einfach eine PM schicken!

  3. #33
    Neuer Benutzer Öfters hier
    Registriert seit
    16.10.2006
    Ort
    Essen
    Beiträge
    26
    Hallo zusammen,

    Pullups sind bei mir auch drauf (rncontrol). Weil ich es erst nicht wußte habe ich auf der DS1621 Platine noch zweimal 4,7K gelötet. Macht aber im Ergebnis keinen Unterschied.

    @Drifter2006:

    Kannst Du deutsch lesen?
    Dein Programm klappt es super!!!!!!!

    Ich habe es gerade auf meinen ATMEGA32 übertragen. Die Temperatur wird z.B. als 23.56 C angezeigt. Jetzt ist die Anzeige schon zu genau, die letzte Stelle verändert sich recht schnell.

    Kann man die Anzeige etwas "dämpfen"?

    Ich sehe auch, dass die Hunderterstelle sich immer in Schritten von 6 oder 7 verändert. Das heißt z.B. 23.81 dann 23.87 dann 23.93 beim erwärmen.

    Gruß Peter

  4. #34
    Erfahrener Benutzer Roboter Genie
    Registriert seit
    16.02.2006
    Beiträge
    1.113
    Ich schätze, dass die Auflösung 1/16° C ist, genau wie beim DS1820.
    Besser du zeigst die letzte Stelle garnicht an.

  5. #35
    Neuer Benutzer Öfters hier
    Registriert seit
    16.10.2006
    Ort
    Essen
    Beiträge
    26
    @for_ro

    Ja das denke ich auch. Ich versuche sie gerade durch ein Format auzublenden.

    Gruß Peter

  6. #36
    Benutzer Stammmitglied
    Registriert seit
    28.08.2006
    Beiträge
    48
    Zitat Zitat von peter02
    Kannst Du deutsch lesen?
    Dein Programm klappt es super!!!!!!!

    Ich habe es gerade auf meinen ATMEGA32 übertragen. Die Temperatur wird z.B. als 23.56 C angezeigt. Jetzt ist die Anzeige schon zu genau, die letzte Stelle verändert sich recht schnell.

    Kann man die Anzeige etwas "dämpfen"?

    Ich sehe auch, dass die Hunderterstelle sich immer in Schritten von 6 oder 7 verändert. Das heißt z.B. 23.81 dann 23.87 dann 23.93 beim erwärmen.

    Gruß Peter
    Hello,
    I’m glad you like it!
    I have made a few small changes and now the increments are 0,1°C.
    Try it out and let me know if it Works.
    Greetings,
    Windt H.J.

    Code:
    '***************************************'
    '* WINDT SYSTEMS                       *'
    '* DS1621 v1.2 for 89S8252 Flash Board *'
    '* 2006 / H.J. WINDT                   *'
    '***************************************'
    '----------------------------------------------------------------------------------------------------'
    'This software for the 89S8252 will read the DS1621 8 bit Temperature, Counter And Slope and'
    'display the data on a terminal as T = xxx , x°C in 0,1°C increments'
    'The temperature is read as -550 to 1250, the last digit is actually the digit behind the comma,'
    'example 1: temp_c = -15 is actually -1,5°C'
    'example 2: temp_c = 250 is actually 25,0°C.
    'Communication with the DS1621 is via the I2C bus.'
    'Feel free to use and share this software!'
    'DS1621 -->> DALLAS SEMICONDUCTOR Digital Thermometer and Thermostat'
    '----------------------------------------------------------------------------------------------------'
    '********************************* PORTS *********************************'
    Config Sda = P1.0
    Config Scl = P1.1
    '*************************************************************************'
    '******************************* VARIABLES *******************************'
    Dim I2c_byte As Byte
    Dim Loops1 As Byte
    Dim Count As Byte
    Dim Slope As Byte
    Dim Temp1 As Integer
    Dim Temp2 As Integer
    Dim Temp_c As Integer
    '*************************************************************************'
    '******************************* CONSTANTS *******************************'
    Const Ds1621_i2c_address = &H0
    Const Ds1621_i2c_r_address = &H1
    '*************************************************************************'
    '********************************* SETUP *********************************'
    Config I2cdelay = 800
    '*************************************************************************'
    '******************************** PROGRAM ********************************'
    Temp_c_loop:
    Gosub Get_ds1621_temperature
    
    Temp1 = Temp_c / 10
    Temp1 = Abs(temp1)
    
    Temp2 = Temp_c / 10
    Temp2 = Temp2 * 10
    Temp2 = Temp_c - Temp2
    Temp2 = Abs(temp2)
    
    Print "T = ";
    If Temp_c < 0 Then Print "-";
    Print Temp1 ; "," ; Temp2 ; "°C"
    
    Goto Temp_c_loop
    '*************************************************************************'
    '****************************** SUBROUTINES ******************************'
    Get_ds1621_temperature:
    
    For Loops1 = 1 To 2
    Ds1621_start_convert:
    I2cstart
    I2cwbyte Ds1621_i2c_address
    I2cwbyte &HEE
    I2cstop
    
    Ds1621_check_conversion_done:
    I2cstart
    I2cwbyte Ds1621_i2c_address
    I2cwbyte &HAC
    I2cstop
    I2cstart
    I2cwbyte Ds1621_i2c_r_address
    I2crbyte I2c_byte , Nack
    I2cstop
    Temp1 = I2c_byte And 1
    Temp2 = I2c_byte And 128
    If Temp1 = 1 Then If Temp2 = 128 Then Goto Ds1621_check_conversion_done
    
    Ds1621_read_temp:
    I2cstart
    I2cwbyte Ds1621_i2c_address
    I2cwbyte &HAA
    I2cstop
    I2cstart
    I2cwbyte Ds1621_i2c_r_address
    
    I2crbyte Temp_c , Nack
    If Temp_c > 127 Then Temp_c = Temp_c + &HFF00
    Temp_c = Temp_c * 100
    
    Ds1621_read_count:
    I2cstart
    I2cwbyte Ds1621_i2c_address
    I2cwbyte &HA8
    I2cstop
    I2cstart
    I2cwbyte Ds1621_i2c_r_address
    I2crbyte Count , Nack
    I2cstop
    
    Ds1621_read_slope:
    I2cstart
    I2cwbyte Ds1621_i2c_address
    I2cwbyte &HA9
    I2cstop
    I2cstart
    I2cwbyte Ds1621_i2c_r_address
    I2crbyte Slope , Nack
    I2cstop
    
    Temp1 = Count * 100
    Temp2 = Slope * 100
    
    Temp2 = Temp2 - Temp1
    Temp1 = Temp2 / Slope
    
    Temp_c = Temp_c - 25
    Temp_c = Temp_c + Temp1
    Temp_c = Temp_c / 10
    
    I2cstop
    Next
    Return
    '*************************************************************************'
    '********************************* DATA **********************************'
    
    '*************************************************************************'

  7. #37
    Neuer Benutzer Öfters hier
    Registriert seit
    16.10.2006
    Ort
    Essen
    Beiträge
    26
    Hi Drifter2006,
    ich probiere es gleich. Hier ist meine letzte Modifikation. Jetzt wird die Temperatur 24.1 also eine Stelle hintern Komma angezeigt. Das ist schon sehr gut.

    Code:

    '***************************************'
    '* WINDT SYSTEMS *'
    '* DS1621 v1.1 for 89S8252 Flash Board *'
    '* 2006 / H.J. WINDT *'
    '***************************************'
    '----------------------------------------------------------------------------------------------------'
    'This software for the 89S8252 will read the DS1621 8 bit Temperature, Counter And Slope and'
    'display the data on a terminal as T = xxx , xx°C'
    'The temperature is read as -5500 to 12500, the last 2 digits are actually the digits behind the comma,'
    'example 1: temp_c = -150 is actually -1,50°C'
    'example 2: temp_c = 2500 is actually 25,00°C.
    'Communication with the DS1621 is via the I2C bus.'
    'Feel free to use and share this software!'
    'DS1621 -->> DALLAS SEMICONDUCTOR Digital Thermometer and Thermostat'
    '----------------------------------------------------------------------------------------------------'
    '********************************* PORTS *********************************'
    $regfile = "M32def.dat" ' chip
    $crystal = 16000000 ' frequenz
    $baud = 9600 ' baud rate

    $hwstack = 32 ' default use 32 for the hardware stack
    $swstack = 10 ' default use 10 for the SW stack
    $framesize = 40 ' default use 40 for the frame space


    Config Scl = Portc.0 ' we need to provide the SCL pin name
    Config Sda = Portc.1 ' we need to provide the SDA pin name

    Config Lcdpin = Pin , Db4 = Portb.0 , Db5 = Portb.1 , Db6 = Portb.2 , Db7 = Portb.3 , E = Portb.5 , Rs = Portb.4
    Config Lcd = 16 * 2
    Config Portb = Output
    Config Lcdbus = 4

    '************************************************* ************************'
    '******************************* VARIABLES *******************************'
    Dim ___lcdno As Bit
    Dim I2c_byte As Byte
    Dim Loops1 As Byte
    Dim Count As Byte
    Dim Slope As Byte
    Dim Temp1 As Integer
    Dim Temp2 As Integer
    Dim Temp_c As Integer
    Dim Temp2_2 As String * 16

    '************************************************* ************************'
    '******************************* CONSTANTS *******************************'
    Const Ds1621_i2c_address = 144
    Const Ds1621_i2c_r_address = 145
    '************************************************* ************************'
    '********************************* SETUP *********************************'
    Config I2cdelay = 80
    '************************************************* ************************'
    '******************************** PROGRAM ********************************'

    Cls
    Cursor Off Noblink 'hide cursor
    Temp_c_loop:
    Gosub Get_ds1621_temperature

    Temp1 = Temp_c / 100
    Temp1 = Abs(temp1)

    Temp2 = Temp_c / 100
    Temp2 = Temp2 * 100
    Temp2 = Temp_c - Temp2
    Temp2 = Abs(temp2)

    Temp2 = Temp2 / 10
    Temp2 = Abs(temp2)

    Print "T = ";
    If Temp_c < 0 Then Print "-";
    Print Temp1 ; "," ;
    If Temp2 < 10 Then Print "0";
    Print Temp2 ; " C"


    Locate 1 , 1
    Wait 1
    Lcd Temp1 ; "." ; Temp2
    Locate 1 , 5
    Lcd " C Wohnraum"

    Goto Temp_c_loop
    '************************************************* ************************'
    '****************************** SUBROUTINES ******************************'
    Get_ds1621_temperature:

    For Loops1 = 1 To 2
    Ds1621_start_convert:
    I2cstart
    I2cwbyte Ds1621_i2c_address
    I2cwbyte &HEE
    I2cstop

    Ds1621_check_conversion_done:
    I2cstart
    I2cwbyte Ds1621_i2c_address
    I2cwbyte &HAC
    I2cstop
    I2cstart
    I2cwbyte Ds1621_i2c_r_address
    I2crbyte I2c_byte , Nack
    I2cstop
    Temp1 = I2c_byte And 1
    Temp2 = I2c_byte And 128
    If Temp1 = 1 Then If Temp2 = 128 Then Goto Ds1621_check_conversion_done

    Ds1621_read_temp:
    I2cstart
    I2cwbyte Ds1621_i2c_address
    I2cwbyte &HAA
    I2cstop
    I2cstart
    I2cwbyte Ds1621_i2c_r_address

    I2crbyte Temp_c , Nack
    If Temp_c > 127 Then Temp_c = Temp_c + &HFF00
    Temp_c = Temp_c * 100

    Ds1621_read_count:
    I2cstart
    I2cwbyte Ds1621_i2c_address
    I2cwbyte &HA8
    I2cstop
    I2cstart
    I2cwbyte Ds1621_i2c_r_address
    I2crbyte Count , Nack
    I2cstop

    Ds1621_read_slope:
    I2cstart
    I2cwbyte Ds1621_i2c_address
    I2cwbyte &HA9
    I2cstop
    I2cstart
    I2cwbyte Ds1621_i2c_r_address
    I2crbyte Slope , Nack
    I2cstop

    Temp1 = Count * 100
    Temp2 = Slope * 100

    Temp2 = Temp2 - Temp1
    Temp1 = Temp2 / Slope

    Temp_c = Temp_c - 25
    Temp_c = Temp_c + Temp1

    I2cstop
    Next
    Return

    '************************************************* ************************'
    '********************************* DATA **********************************'

    '************************************************* ************************'

  8. #38
    Neuer Benutzer Öfters hier
    Registriert seit
    16.10.2006
    Ort
    Essen
    Beiträge
    26
    Hi Drifter2006,

    es klappt genau so, wie meine Modifikation.

    Ich denke, es ist perfekt. Die Anzeige ist stabil und beim Erwärmen und Abkühlen geht die Anzeige in 0.1 Grad Schritten hoch oder runter.

    Danke,

    Peter

  9. #39
    Neuer Benutzer Öfters hier
    Registriert seit
    16.10.2006
    Ort
    Essen
    Beiträge
    26
    Drifter2006 hast Du noch ein paar Programme, die man mal ausprobieren kann? Ich bin noch recht neu dabei und sammel noch alles was ich bekommen kann.

    Gruß Peter

  10. #40
    Benutzer Stammmitglied
    Registriert seit
    28.08.2006
    Beiträge
    48
    Hello Peter,
    I think I found a small error in your modification:

    You wrote:

    Temp2 = Temp2 / 10
    Temp2 = Abs(temp2)
    Print "T = ";
    If Temp_c < 0 Then Print "-";
    Print Temp1 ; "," ;
    If Temp2 < 10 Then Print "0";
    Print Temp2 ; " C"
    Locate 1 , 1
    Wait 1
    Lcd Temp1 ; "." ; Temp2
    Locate 1 , 5
    Lcd " C Wohnraum"


    I think should be:

    Temp2 = Temp2 / 10
    Wait 1
    Locate 1 , 1
    If Temp_1 < 0 then Lcd "-";
    Lcd Temp1 ; "." ; Temp2 ; " C Wohnraum "

    The rest can be deleted.

    This was my first real attempt at writing a Bascom 8051 program so I don’t have any software, yet.
    Greetings,
    H.J. Windt

Seite 4 von 6 ErsteErste ... 23456 LetzteLetzte

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •  

12V Akku bauen