Hallo Willi,
danke für deine Antwort.
Da gebe ich dir Recht, aber die Zeit ist auch nicht das Problem (das war nur meine erste Vermutung). Betreibst du deine Module an 5V?
Ich lese im Hauptprogramm die Temperatur alle 500ms aus und in deinem Programm jede Sekunde und trotzdem bekomme ich so wilde Werte das da auch mit Filtern nichts zu machen ist. (Im Hauptprogramm ist ein Filter drin)
Selbst die Referenztemperatur passt überhaupt nicht mehr...
Hier mal dein angepasster TestCode und ein paar Werte (bei Raumtemperatur ca. 22°C):Atmega328P_MAX31855.TXT
Code:'*******************************************************************************. '******************************************************************************* '******************************** MAX31855 ************************************* '******************************************************************************* '************************** 25.08.2020 by CYBORG ******************************* '******************************************************************************* '******************************************************************************* $regfile = "m328pdef.dat" $crystal = 8000000 $hwstack = 40 $swstack = 40 $framesize = 40 Baud = 9600 '*************************** UART - Interrupt ********************************** Dim Iuart As Integer On Urxc Onrxd 'Interrupt-Routine setzen Enable Urxc 'Interrupt URXC einschalten Enable Interrupts 'Interrupts global zulassen '************************* I2C - DISPLAY 1602 ********************************** $lib "YwRobot_Lcd_i2c.lib" 'My I2C driver for the LCD Const Pcf8574_lcd = &H4E 'Defines the address of the I/O expander for LCD Dim Lcd_backlight As Byte Lcd_backlight = 1 'Hintergrundbeleuchtung einschalten (1/0) Config Scl = Portc.5 'Configure I2C SCL Config Sda = Portc.4 'Configure I2C SDA Config Lcd = 16 * 2 'nicht unbedingt nötig Config I2cdelay = 1 Waitms 300 'warte bis Kondensator bei Ta0 geladen, auch für LCD-Init! '**************************** SPI - MAX31855 ************************************ Config Spi = Hard , Interrupt = Off , Data_Order = Msb , Master = Yes , Polarity = High , Phase = 1 , Clockrate = 16 , Noss = 1 Spiinit Config Portb.3 = Output Max_cs Alias Portb.3 Max_cs = 1 Dim Text11 As String * 40 Dim Temp_s As Single Dim Element As Integer Dim Element_l As Byte At Element Overlay Dim Element_h As Byte At Element + 1 Overlay Dim Referenz As Integer Dim Referenz_l As Byte At Referenz Overlay Dim Referenz_h As Byte At Referenz + 1 Overlay print "Start" Locate 1 , 1 Lcd "Start" wait 1 '**************************** HAUPTSCHLEIFE ************************************ Do Max_cs = 0 Spiin Element_h , 1 Spiin Element_l , 1 Spiin Referenz_h , 1 Spiin Referenz_l , 1 Max_cs = 1 cls Text11 = Bin(referenz) print text11 Locate 1 , 8 Lcd Text11 Text11 = Bin(element) print text11 Locate 1 , 1 Lcd Text11 Shift Referenz , Right , 4 Temp_s = Referenz \ 16 Text11 = Fusing(temp_s , "#.#") print text11 Locate 2 , 1 Lcd Text11 Shift Element , Right , 2 Temp_s = Element \ 4 Text11 = Fusing(temp_s , "#.#") print text11 Locate 2 , 8 Lcd temp_s waitms 1000 Loop end '**************************** UART - Interrupt ********************************* Onrxd: Iuart = Udr Print "+++ Empfangen: " ; Iuart Select Case Iuart 'RESET Case 123 Print "+++ Reset: " ; Iuart Goto &H3C00 'M328 Case Else Print "+++ Unbekannter Befehl: " ; Iuart End Select Return







Zitieren


Lesezeichen