SPI mit UTFT usw Problem

Deine Hardware besteht aus einem AD-Wandler, der direkt Thermocouple-Sensoren in Temperaturen umwandeln kann und einem Multiplexer, der jeweils einen von acht Eingängen auf den AD-Wandler schaltet. Nun, dieser AD-Wandler braucht ca. 1/5 Sekunde, bis er den Eingang richtig gelesen hat. Da Du alle 8 Eingänge der Reihe nach auf den Wandler schaltest und den entsprechenden Wert einliest, dauert ein Durchgang beinahe 2 Sekunden. Diese Verzögerung, bis Du zu den Werten kommst, ist prinzipbedingt und kann nicht einfach eliminiert werden. Was allerdings möglich ist: der Arduino kann in der Zeit, die er jetzt mit Warten auf die fertige AD-Wandlung zubringt, etwas anderes tun. In Deinem Sketch hat er aber keine anderen Aufgaben.

Da es sich um Temperatur-Werte handelt, sollte allerdings die zeitliche Verzögerung nicht so stark in's Gewicht fallen, die Temperatur wird sich kaum so schnell verändern.

Hallo Pylon,
das Lesen ist OK

Aber der Aufbau auf dem Display....
da kann ich zusehen ( Pixel für Pixel / fast )

Ein Lesedurchgang dauert 6 Sec. das ist schon das mindeste was ich möchte.
Aber die Ausgabe auf den TFT =(
Jede Zeile kann ich beim aufbau betrachten, das ist nicht so schoen

Müste es nicht bei der Anzeige schneller gehen ?

Habe andere Anwendungen mit dem TFT da geht der Aufbau ratz fatz

Grüße
ratlos

Ändere mal die paar Zeilen in der Funktion "Read_Temperature":

  // read result
  digitalWrite(CS_TEMP,LOW); // Set MAX7765 /CS Low
  //delay(1);  // Ori 1
  SPI.begin();  // setup SPI hardware
  temp_reading = SPI.transfer(0xff) << 8;  
  temp_reading += SPI.transfer(0xff);
  SPI.end();  // release SPI hardware for bit banging interface
  digitalWrite(CS_TEMP,HIGH); // Set MAX7765 /CS High
  //delay(1);

Die TFT-Bibliothek verwendet nicht das SPI-Interface sondern emuliert es. Da Du das Display an den Hardware-SPI-Pins angeschlossen hast, entsteht ein Konflikt. Indem Du den SPI nach Gebrauch wieder deaktivierst, steht er dem Bit-Banging der UTFT-Bibliothek wieder zur Verfügung.

Hallo
danke für die super Hilfe.
Es ist so das das Display dann aus bleibt.
Wenn ich später "nach SPI.end(); // release SPI hardware for bit banging interface " wieder
SPI.begin(); setze geht es auch, abe rtrotzdem langsam :zipper_mouth_face:

Grüße
Ratlos

Ich habe die UTFT Version 2.01 vom 5. Februar 2013 heruntergeladen, dort aber keinen Support für den Hardware-SPI gefunden. Wieso hast Du trotzdem diesen Kommentar im Code?

    SPI.begin();          // ist neu zum Starten der SPI Dadurch zeigt das Dysplay schneller an

Versuche doch mal, nach dem SPI.end() noch folgenden Code einzufügen:

pinMode(sda, OUTPUT);
pinMode(scl, OUTPUT);

Damit sollte der Zustand dieser Pins wieder fast so sein, wie nach dem Konstruktor der TFT-Klasse.

Hallo
ohne das Starten des SPI.begin() geht das Display zwar auch, aber wie schon gesagt Langsam
Deshalb ist es bei mir mit dabei.
( Original UTFT hat es nicht )

Wenn ich den SPI.end setze ohne SPI.begin wieder anzuschalten, bleibt das Display dunkel.

int Read_Temperature(void)
{
unsigned int temp_reading;
//force conversion now..
delay(5); // Ori 5
digitalWrite(CS_TEMP,LOW); // Set MAX7765 /CS Low
delay(5); // Ori 5
SPI.begin(); // setup SPI hardware
digitalWrite(CS_TEMP,HIGH); // Set MAX7765 /CS High
delay(220); // Ori 250 wait for conversion to finish..
// read result
digitalWrite(CS_TEMP,LOW); // Set MAX7765 /CS Low
delay(1); // Ori 1
temp_reading = SPI.transfer(0xff) << 8;
temp_reading += SPI.transfer(0xff);
SPI.end(); // release SPI hardware for bit banging interface
pinMode(sda, OUTPUT);
pinMode(scl, OUTPUT);
SPI.begin(); // setup SPI hardware
digitalWrite(CS_TEMP,HIGH); // Set MAX7765 /CS High
//delay(1);

// check result
if(bitRead(temp_reading,2) == 1) // No Connection
{
return(-1); // Failed / NC Error
}
else
{
return((int)(temp_reading >> 5)); //Convert to Degc
}
//*/
}

habe es ohne SPI.begin() versucht, aber das Display bleibt dann dunkel.

Es war durch
pinMode(sda, OUTPUT);
pinMode(scl, OUTPUT);
keine Veränderung sichtbar

Hmmm eine harte Nuss :zipper_mouth_face:

Grüße
Ratlos

Was hältst Du davon, die UTFT-Bibliothek auf Hardware-SPI aufzurüsten, anstatt mühsam die Hardware wieder für das Bit-Banging frei zu machen? Es wäre eine relativ begrenzte Modifikation der Hardware-Abstraktionsschicht und des Initialisierungscodes.

Hallo,
klar würde ic hdas machen.
Aber so hoch ist mein wissenstand nicht.
Habe jetzt ca. 8 Wochen mit Schaltung AVR usw zu tun.

Aber wagen würde ich das.
Wiste nicht das es eine Hardware-SPI gibt
Mit hilfe von hier kann das was werden.

Grüße
Ratlos

Welchen Arduino verwendest Du? UNO? Mega2560?

Hallo
den 328 mit eigenem Layout.
Das Layou der Platuine zu ändern ist kein problem.
Fräse die Platinen bei mir im Keller selbst

Habe aber auch die anderen AVR´s benutzt zb 2324 / 94 /644 usw

Daher kann ich auch andere nehmen

Seit ca. 8 Wochen bin ich dabei ( Elektronik, AVR usw. )
Habe in der Zeit alles bisher hinbekommen ( mit Hilfe Forum )
1 Drehzahlanzeim Stundenzähler Momentanverbrauch und TFT
1 Seriales Abfragen und anzeige auf ein TFT
1 Scheinwerfersteierung uber 2 Achsen mit Servo und Mosfets zum Achalten.
usw

Daher denke ich das es mit eine rHardwäre SPI auch irgendwie gehen wird.

Grüße
Ratlos

Indem Du die folgende Methode in "HW_ATmega328P.h" ersetzt und in "UTFT.h" die Zeile

#define USE_HW_SPI 1

vor den Includes

#if defined(__AVR__)
	#include "Arduino.h"
	#include "HW_AVR_defines.h"
#elif defined(__PIC32MX__)
	#include "WProgram.h"
	#include "HW_PIC32_defines.h"
#elif defined(__arm__)
	#include "Arduino.h"
	#include "HW_ARM_defines.h"
#endif

einfügst, sollte die Bibliothek SPI fähig werden.

void UTFT::LCD_Writ_Bus(char VH,char VL, byte mode)
{
	switch (mode)
	{
	case 1:
		if (display_serial_mode==SERIAL_4PIN)
		{
		if (VH==1)
			sbi(P_SDA, B_SDA);
		else
			cbi(P_SDA, B_SDA);
		pulse_low(P_SCL, B_SCL);
		}
		else
		{
		if (VH==1)
			sbi(P_RS, B_RS);
		else
			cbi(P_RS, B_RS);
		}

#ifndef USE_HW_SPI
		if (VL & 0x80)
			sbi(P_SDA, B_SDA);
		else
			cbi(P_SDA, B_SDA);
		pulse_low(P_SCL, B_SCL);
		if (VL & 0x40)
			sbi(P_SDA, B_SDA);
		else
			cbi(P_SDA, B_SDA);
		pulse_low(P_SCL, B_SCL);
		if (VL & 0x20)
			sbi(P_SDA, B_SDA);
		else
			cbi(P_SDA, B_SDA);
		pulse_low(P_SCL, B_SCL);
		if (VL & 0x10)
			sbi(P_SDA, B_SDA);
		else
			cbi(P_SDA, B_SDA);
		pulse_low(P_SCL, B_SCL);
		if (VL & 0x08)
			sbi(P_SDA, B_SDA);
		else
			cbi(P_SDA, B_SDA);
		pulse_low(P_SCL, B_SCL);
		if (VL & 0x04)
			sbi(P_SDA, B_SDA);
		else
			cbi(P_SDA, B_SDA);
		pulse_low(P_SCL, B_SCL);
		if (VL & 0x02)
			sbi(P_SDA, B_SDA);
		else
			cbi(P_SDA, B_SDA);
		pulse_low(P_SCL, B_SCL);
		if (VL & 0x01)
			sbi(P_SDA, B_SDA);
		else
			cbi(P_SDA, B_SDA);
		pulse_low(P_SCL, B_SCL);
#else
		SPI.write(VL);
#endif
		break;
	case 8:
		PORTD = VH;
		pulse_low(P_WR, B_WR);
		PORTD = VL;
		pulse_low(P_WR, B_WR);
		break;
	case 16:
		PORTD = VH;
		cport(PORTC, 0xFC);
		sport(PORTC, (VL>>6) & 0x03);
		PORTB =  VL & 0x3F;
		pulse_low(P_WR, B_WR);
		break;
	case LATCHED_16:
		PORTD = VH;
		cbi(P_ALE, B_ALE);
		pulse_high(P_ALE, B_ALE);
		cbi(P_CS, B_CS);
		PORTD =  VL;
		pulse_low(P_WR, B_WR);
		sbi(P_CS, B_CS);
		break;
	}
}

In Read_Temperature() kannst Du dann die eingefügten Zeilen wieder rauslöschen.

Ich habe kein Display hier, um das auszuprobieren, das müsstest dann Du übernehmen. Laut Datenblatt laufen beide Chips im SPI Mode 0, mit der Geschwindigkeit sollten auch beide klar kommen. Aber das ist reine Theorie, in der Praxis sieht's manchmal anders aus.

Hallo,
habe es so gemacht wie von Dir beschrieben.

Es gab keine Fehlermeldung :wink:

Aber es brachte kein Displayaufbau vorteil =(

Ohne das Display ist es schon blöd

Grüße
Ratlos

Hast Du die Bibliotheksänderung auch mal mit dem Beispielsketch (Du musst natürlich ein SPI.begin() einfügen) ausprobiert?

Aber es brachte kein Displayaufbau vorteil

Das ist leider eine sehr schlechte Beschreibung. Bleibt das Display schwarz? Ist der Aufbau langsam? Kommt gar nichts?

Hallo, :~

Stimmt ist eine blöde Beschreibung

Es ist so das es normal Funtioniert aber halt so langsam wie ohne SPI

Wenn ich das Temperaturshild abnehme und nur das Display anstecke ist der fehler wie immer auch da.
Nur ohne die

int Read_Temperature(void)
{

rotine
Geht es schnell

Was komisch ist
mit der Libery von Adafruit

#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h>

geht die Temperaturanzeige und das Display schnell.

Adafruit hat leider nicht die möglichkeiten der Font´s usw nicht gegenüber UTFT

hier der Code mit Adafruit
#include <Adafruit_GFX.h>
#include <Adafruit_ST7735.h>
#include <SPI.h>
#define sclk 13
#define mosi 11
#define cs 10
#define dc 9
#define rst 8 // you can also connect this to the Arduino reset
Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, rst);
#define CS_TEMP 3 // MAX6674/6675 /CS Line
#define MUX_EN 7 // ADG608 MUX Enable
#define MUX_A0 4 // ADG608 Addr0
#define MUX_A1 5 // ADG608 Arrd1
#define MUX_A2 6 // ADG608 Addr2
byte Zaehler = 0 ;
String Geber = "";
float p = 3.1415926;
void setup(void) {
Serial.begin(9600);
// pinMode(10,OUTPUT); // Hardware /SS, need to be output
pinMode(CS_TEMP,OUTPUT); // MAX6675/6674 /CS Line
pinMode(MUX_EN,OUTPUT); // Enable pin on ADG608
pinMode(MUX_A0,OUTPUT); // A0 on ADG608
pinMode(MUX_A1,OUTPUT); // A1 on ADG608
pinMode(MUX_A2,OUTPUT); // A2 on ADG608
pinMode(10, OUTPUT); randomSeed(analogRead(0));
digitalWrite(CS_TEMP,HIGH); // Set MAX7765 /CS High
digitalWrite(MUX_EN,HIGH); // Enable on
tft.initR(INITR_REDTAB); // initialize a ST7735R chip, red tab
Serial.println("init");
uint16_t time = millis();
tft.fillScreen(ST7735_BLACK);
time = millis() - time;
Serial.println(time, DEC);
delay(50);
// Serial.println(tft.getRotation(), DEC); // Display drehen
tft.setRotation(tft.getRotation()+1); // Anzeige gedreht
tft.fillScreen(ST7735_BLACK);
tft.setTextSize(3);
tft.println("Hello World!");
tft.setTextColor(ST7735_BLUE);
tft.setTextSize(10);
tft.print(1234.567);
tft.setRotation(tft.getRotation()+1); // Anzeige gedreht
// tft print function!
// a single pixel
tft.drawPixel(tft.width()/2, tft.height()/2, ST7735_GREEN);
delay(50);
// line draw test
testlines(ST7735_YELLOW);
delay(50);
// optimized lines
testfastlines(ST7735_RED, ST7735_BLUE);
delay(50);
testdrawrects(ST7735_GREEN);
delay(50);
testfillrects(ST7735_YELLOW, ST7735_MAGENTA);
delay(50);
tft.fillScreen(ST7735_BLACK);
testfillcircles(10, ST7735_BLUE);
testdrawcircles(10, ST7735_WHITE);
delay(50);
testroundrects();
delay(50);
testtriangles();
delay(50);
Serial.println("done");
delay(1000);
}
void loop() {
int temperature = 0;
Zaehler = 0 ;
tft.fillScreen(ST7735_BLACK);
while(Zaehler < 8 )
{
Zaehler = Zaehler ++ ;
delay(1);
Set_Mux_Channel(Zaehler);
temperature = Read_Temperature();
tft.setTextSize(2);
tft.setCursor(0,Zaehler19-19);
tft.setTextColor(ST7735_YELLOW);
if(temperature == -1)
{
Geber = String(Zaehler);
Serial.println("N/C Sensor " + Geber);
tft.println("N/C " + Geber );
// myGLCD.print("N/C Se", Zaehler * 19 -14,125,270); //
// myGLCD.print("N/C Se" + Geber + " ", Temp * 19 -14,125,270); //
}
else
{
Serial.print(temperature,DEC);
Geber = String(Zaehler);
Serial.println(" C Sensor " + Geber);
tft.println("H" + String(temperature,DEC) +" " + Geber );
// myGLCD.print(String(temperature,DEC)+"Test", Zaehler * 19 -14,125,270); //
// myGLCD.print(String(temperature,DEC)+ " C Se" + Geber + " ", Temp * 19 -14,125,270); //
Serial.println(Geber);
}
}
}
void testlines(uint16_t color) {
tft.fillScreen(ST7735_BLACK);
for (int16_t x=0; x < tft.width(); x+=6) {
tft.drawLine(0, 0, x, tft.height()-1, color);
}
for (int16_t y=0; y < tft.height(); y+=6) {
tft.drawLine(0, 0, tft.width()-1, y, color);
}
tft.fillScreen(ST7735_BLACK);
for (int16_t x=0; x < tft.width(); x+=6) {
tft.drawLine(tft.width()-1, 0, x, tft.height()-1, color);
}
for (int16_t y=0; y < tft.height(); y+=6) {
tft.drawLine(tft.width()-1, 0, 0, y, color);
}
tft.fillScreen(ST7735_BLACK);
for (int16_t x=0; x < tft.width(); x+=6) {
tft.drawLine(0, tft.height()-1, x, 0, color);
}
for (int16_t y=0; y < tft.height(); y+=6) {
tft.drawLine(0, tft.height()-1, tft.width()-1, y, color);
}
tft.fillScreen(ST7735_BLACK);
for (int16_t x=0; x < tft.width(); x+=6) {
tft.drawLine(tft.width()-1, tft.height()-1, x, 0, color);
}
for (int16_t y=0; y < tft.height(); y+=6) {
tft.drawLine(tft.width()-1, tft.height()-1, 0, y, color);
}
}
void testdrawtext(char text, uint16_t color) {
tft.setCursor(0, 0);
tft.setTextColor(color);
tft.setTextWrap(true);
tft.print(text);
}
void testfastlines(uint16_t color1, uint16_t color2) {
tft.fillScreen(ST7735_BLACK);
for (int16_t y=0; y < tft.height(); y+=5) {
tft.drawFastHLine(0, y, tft.width(), color1);
}
for (int16_t x=0; x < tft.width(); x+=5) {
tft.drawFastVLine(x, 0, tft.height(), color2);
}
}
void testdrawrects(uint16_t color) {
tft.fillScreen(ST7735_BLACK);
for (int16_t x=0; x < tft.width(); x+=6) {
tft.drawRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color);
}
}
void testfillrects(uint16_t color1, uint16_t color2) {
tft.fillScreen(ST7735_BLACK);
for (int16_t x=tft.width()-1; x > 6; x-=6) {
tft.fillRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color1);
tft.drawRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color2);
}
}
void testfillcircles(uint8_t radius, uint16_t color) {
for (int16_t x=radius; x < tft.width(); x+=radius
2) {
for (int16_t y=radius; y < tft.height(); y+=radius
2) {
tft.fillCircle(x, y, radius, color);
}
}
}
void testdrawcircles(uint8_t radius, uint16_t color) {
for (int16_t x=0; x < tft.width()+radius; x+=radius2) {
for (int16_t y=0; y < tft.height()+radius; y+=radius
2) {
tft.drawCircle(x, y, radius, color);
}
}
}
void testtriangles() {
tft.fillScreen(ST7735_BLACK);
int color = 0xF800;
int t;
int w = 63;
int x = 159;
int y = 0;
int z = 127;
for(t = 0 ; t <= 15; t+=1) {
tft.drawTriangle(w, y, y, x, z, x, color);
x-=4;
y+=4;
z-=4;
color+=100;
}
}
void testroundrects() {
tft.fillScreen(ST7735_BLACK);
int color = 100;
int i;
int t;
for(t = 0 ; t <= 4; t+=1) {
int x = 0;
int y = 0;
int w = 127;
int h = 159;
for(i = 0 ; i <= 24; i+=1) {
tft.drawRoundRect(x, y, w, h, 5, color);
x+=2;
y+=3;
w-=4;
h-=6;
color+=1100;
}
color+=100;
}
}
void Set_Mux_Channel(unsigned char chan)
{
switch(chan)
{
case 1:
digitalWrite(MUX_A0,LOW);
digitalWrite(MUX_A1,LOW);
digitalWrite(MUX_A2,LOW);
break;
case 2:
digitalWrite(MUX_A0,HIGH);
digitalWrite(MUX_A1,LOW);
digitalWrite(MUX_A2,LOW);
break;
case 3:
digitalWrite(MUX_A0,LOW);
digitalWrite(MUX_A1,HIGH);
digitalWrite(MUX_A2,LOW);
break;
case 4:
digitalWrite(MUX_A0,HIGH);
digitalWrite(MUX_A1,HIGH);
digitalWrite(MUX_A2,LOW);
break;
case 5:
digitalWrite(MUX_A0,LOW);
digitalWrite(MUX_A1,LOW);
digitalWrite(MUX_A2,HIGH);
break;
case 6:
digitalWrite(MUX_A0,HIGH);
digitalWrite(MUX_A1,LOW);
digitalWrite(MUX_A2,HIGH);
break;
case 7:
digitalWrite(MUX_A0,LOW);
digitalWrite(MUX_A1,HIGH);
digitalWrite(MUX_A2,HIGH);
break;
case 8:
digitalWrite(MUX_A0,HIGH);
digitalWrite(MUX_A1,HIGH);
digitalWrite(MUX_A2,HIGH);
break;
default:
break;
}
}
int Read_Temperature(void)
{
unsigned int temp_reading;
//force conversion now..
delay(5); // Ori 5
digitalWrite(CS_TEMP,LOW); // Set MAX7765 /CS Low
delay(5); // Ori 5
digitalWrite(CS_TEMP,HIGH); // Set MAX7765 /CS High
delay(250); // Ori 250 wait for conversion to finish..
// read result
digitalWrite(CS_TEMP,LOW); // Set MAX7765 /CS Low
delay(1); // Ori 1
temp_reading = SPI.transfer(0xff) << 8;
temp_reading += SPI.transfer(0xff);
digitalWrite(CS_TEMP,HIGH); // Set MAX7765 /CS High
//delay(1);
// check result
if(bitRead(temp_reading,2) == 1) // No Connection
{
return(-1); // Failed / NC Error
}
else
{
return((int)(temp_reading >> 5)); //Convert to Degc
}
}

Grüße
Ratlos

Code gehört IMMER in code-Tags! Eine solche Wüste schaut sich keiner an. Bitte bearbeite den Post und füge die Tags noch ein.

Hallo
meine Schuld hatte nicht richtig geklickt und nicht weiter konntrolliert :zipper_mouth_face:

#include <Adafruit_GFX.h>   
#include <Adafruit_ST7735.h>
#include <SPI.h>
#define sclk 13
#define mosi 11
#define cs   10
#define dc   9
#define rst  8  // you can also connect this to the Arduino reset
Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, rst);
#define CS_TEMP  3 //   MAX6674/6675 /CS Line
#define MUX_EN   7 // ADG608 MUX Enable
#define MUX_A0   4 // ADG608 Addr0
#define MUX_A1   5 // ADG608 Arrd1
#define MUX_A2   6 // ADG608 Addr2
byte Zaehler = 0 ;
String Geber = "";
float p = 3.1415926;

void setup(void) {
  Serial.begin(9600);
 // pinMode(10,OUTPUT); // Hardware /SS, need to be output
  pinMode(CS_TEMP,OUTPUT); // MAX6675/6674 /CS Line
  pinMode(MUX_EN,OUTPUT); // Enable pin on ADG608
  pinMode(MUX_A0,OUTPUT); // A0 on ADG608
  pinMode(MUX_A1,OUTPUT); // A1 on ADG608
  pinMode(MUX_A2,OUTPUT); // A2 on ADG608
  pinMode(10, OUTPUT);    randomSeed(analogRead(0));
  digitalWrite(CS_TEMP,HIGH); // Set MAX7765 /CS High
  digitalWrite(MUX_EN,HIGH); // Enable on
  tft.initR(INITR_REDTAB);   // initialize a ST7735R chip, red tab
  Serial.println("init");
  uint16_t time = millis();
  tft.fillScreen(ST7735_BLACK);
  time = millis() - time;
  Serial.println(time, DEC);
  delay(50);
    //   Serial.println(tft.getRotation(), DEC); // Display drehen
        tft.setRotation(tft.getRotation()+1); // Anzeige  gedreht
          tft.fillScreen(ST7735_BLACK);
       tft.setTextSize(3);
  tft.println("Hello World!");
  tft.setTextColor(ST7735_BLUE);
  tft.setTextSize(10);
  tft.print(1234.567);

          tft.setRotation(tft.getRotation()+1); // Anzeige  gedreht 
  // tft print function!
  // a single pixel
  tft.drawPixel(tft.width()/2, tft.height()/2, ST7735_GREEN);
  delay(50);
  // line draw test
  testlines(ST7735_YELLOW);
  delay(50);
  // optimized lines
  testfastlines(ST7735_RED, ST7735_BLUE);
  delay(50);
  testdrawrects(ST7735_GREEN);
  delay(50);
  testfillrects(ST7735_YELLOW, ST7735_MAGENTA);
  delay(50);
  tft.fillScreen(ST7735_BLACK);
  testfillcircles(10, ST7735_BLUE);
  testdrawcircles(10, ST7735_WHITE);
  delay(50);
  testroundrects();
  delay(50);
  testtriangles();
  delay(50);
  Serial.println("done");
  delay(1000);
}

void loop() {
  int temperature = 0;
Zaehler = 0 ;
tft.fillScreen(ST7735_BLACK);
while(Zaehler < 8 )
  {
        Zaehler = Zaehler ++ ;
    delay(1);
    Set_Mux_Channel(Zaehler);
   temperature = Read_Temperature();
   tft.setTextSize(2);
     tft.setCursor(0,Zaehler*19-19);
            tft.setTextColor(ST7735_YELLOW); 
    if(temperature == -1)
      {
          Geber = String(Zaehler);
       Serial.println("N/C  Sensor " + Geber);
         tft.println("N/C " + Geber );
     // myGLCD.print("N/C Se", Zaehler * 19 -14,125,270);   //
          //    myGLCD.print("N/C Se" + Geber + " ", Temp * 19 -14,125,270);   //
      }
      else
      {
       Serial.print(temperature,DEC);
        Geber = String(Zaehler);
       Serial.println(" C Sensor " + Geber);
  tft.println("H" + String(temperature,DEC) +" " + Geber );
      //      myGLCD.print(String(temperature,DEC)+"Test", Zaehler * 19 -14,125,270);   //
      // myGLCD.print(String(temperature,DEC)+ " C Se" + Geber + " ", Temp * 19 -14,125,270);   //
        Serial.println(Geber);
      }
  }
}

void testlines(uint16_t color) {
  tft.fillScreen(ST7735_BLACK);
  for (int16_t x=0; x < tft.width(); x+=6) {
    tft.drawLine(0, 0, x, tft.height()-1, color);
  }
  for (int16_t y=0; y < tft.height(); y+=6) {
    tft.drawLine(0, 0, tft.width()-1, y, color);
  }

  tft.fillScreen(ST7735_BLACK);
  for (int16_t x=0; x < tft.width(); x+=6) {
    tft.drawLine(tft.width()-1, 0, x, tft.height()-1, color);
  }
  for (int16_t y=0; y < tft.height(); y+=6) {
    tft.drawLine(tft.width()-1, 0, 0, y, color);
  }
  tft.fillScreen(ST7735_BLACK);
  for (int16_t x=0; x < tft.width(); x+=6) {
    tft.drawLine(0, tft.height()-1, x, 0, color);
  }
  for (int16_t y=0; y < tft.height(); y+=6) {
    tft.drawLine(0, tft.height()-1, tft.width()-1, y, color);
  }
  tft.fillScreen(ST7735_BLACK);
  for (int16_t x=0; x < tft.width(); x+=6) {
    tft.drawLine(tft.width()-1, tft.height()-1, x, 0, color);
  }
  for (int16_t y=0; y < tft.height(); y+=6) {
    tft.drawLine(tft.width()-1, tft.height()-1, 0, y, color);
  }
}
void testdrawtext(char *text, uint16_t color) {
  tft.setCursor(0, 0);
  tft.setTextColor(color);
  tft.setTextWrap(true);
  tft.print(text);
}
void testfastlines(uint16_t color1, uint16_t color2) {
  tft.fillScreen(ST7735_BLACK);
  for (int16_t y=0; y < tft.height(); y+=5) {
    tft.drawFastHLine(0, y, tft.width(), color1);
  }
  for (int16_t x=0; x < tft.width(); x+=5) {
    tft.drawFastVLine(x, 0, tft.height(), color2);
  }
}
void testdrawrects(uint16_t color) {
  tft.fillScreen(ST7735_BLACK);
  for (int16_t x=0; x < tft.width(); x+=6) {
    tft.drawRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color);
  }
}
void testfillrects(uint16_t color1, uint16_t color2) {
  tft.fillScreen(ST7735_BLACK);
  for (int16_t x=tft.width()-1; x > 6; x-=6) {
    tft.fillRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color1);
    tft.drawRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color2);
  }
}
void testfillcircles(uint8_t radius, uint16_t color) {
  for (int16_t x=radius; x < tft.width(); x+=radius*2) {
    for (int16_t y=radius; y < tft.height(); y+=radius*2) {
      tft.fillCircle(x, y, radius, color);
    }
  }
}
void testdrawcircles(uint8_t radius, uint16_t color) {
  for (int16_t x=0; x < tft.width()+radius; x+=radius*2) {
    for (int16_t y=0; y < tft.height()+radius; y+=radius*2) {
      tft.drawCircle(x, y, radius, color);
    }
  }
}
void testtriangles() {
  tft.fillScreen(ST7735_BLACK);
  int color = 0xF800;
  int t;
  int w = 63;
  int x = 159;
  int y = 0;
  int z = 127;
  for(t = 0 ; t <= 15; t+=1) {
    tft.drawTriangle(w, y, y, x, z, x, color);
    x-=4;
    y+=4;
    z-=4;
    color+=100;
  }
}
void testroundrects() {
  tft.fillScreen(ST7735_BLACK);
  int color = 100;
  int i;
  int t;
  for(t = 0 ; t <= 4; t+=1) {
    int x = 0;
    int y = 0;
    int w = 127;
    int h = 159;
    for(i = 0 ; i <= 24; i+=1) {
      tft.drawRoundRect(x, y, w, h, 5, color);
      x+=2;
      y+=3;
      w-=4;
      h-=6;
      color+=1100;
    }
    color+=100;
  }
}
void Set_Mux_Channel(unsigned char chan)
{
  switch(chan)
  {
    case 1:
      digitalWrite(MUX_A0,LOW);
      digitalWrite(MUX_A1,LOW);
      digitalWrite(MUX_A2,LOW);
      break;
    case 2:
      digitalWrite(MUX_A0,HIGH);
      digitalWrite(MUX_A1,LOW);
      digitalWrite(MUX_A2,LOW);
      break;
    case 3:
      digitalWrite(MUX_A0,LOW);
      digitalWrite(MUX_A1,HIGH);
      digitalWrite(MUX_A2,LOW);
      break;
    case 4:
      digitalWrite(MUX_A0,HIGH);
      digitalWrite(MUX_A1,HIGH);
      digitalWrite(MUX_A2,LOW);
      break;
    case 5:
      digitalWrite(MUX_A0,LOW);
      digitalWrite(MUX_A1,LOW);
      digitalWrite(MUX_A2,HIGH);
      break;
    case 6:
      digitalWrite(MUX_A0,HIGH);
      digitalWrite(MUX_A1,LOW);
      digitalWrite(MUX_A2,HIGH);
      break;
    case 7:
      digitalWrite(MUX_A0,LOW);
      digitalWrite(MUX_A1,HIGH);
      digitalWrite(MUX_A2,HIGH);
      break;
    case 8:
      digitalWrite(MUX_A0,HIGH);
      digitalWrite(MUX_A1,HIGH);
      digitalWrite(MUX_A2,HIGH);
      break;
    default:
      break;
  }
}
 int Read_Temperature(void)
{
unsigned int temp_reading;
   //force conversion now..
  delay(5); // Ori 5
  digitalWrite(CS_TEMP,LOW); // Set MAX7765 /CS Low
 delay(5); // Ori 5
  digitalWrite(CS_TEMP,HIGH); // Set MAX7765 /CS High
  delay(250); // Ori 250  wait for conversion to finish..
  // read result
  digitalWrite(CS_TEMP,LOW); // Set MAX7765 /CS Low
  delay(1);  // Ori 1
           temp_reading = SPI.transfer(0xff) << 8; 
           temp_reading += SPI.transfer(0xff); 
  digitalWrite(CS_TEMP,HIGH); // Set MAX7765 /CS High
  //delay(1);
  // check result
  if(bitRead(temp_reading,2) == 1) // No Connection
    {     
      return(-1); // Failed / NC Error
    }
    else
    {
      return((int)(temp_reading >> 5)); //Convert to Degc
    }
}

Hallo,
habe mal den MAX6675 gegen den MAX31855 getauscht.
Es haben bei das SPI problem, bei verwendung von weiteren SPI geräten. :zipper_mouth_face:

werde jetzt mal den ADG595 verwenden.
Da der ohne SPI arbeitet müste es ja gehen.

Grüße
Ratlos

Hallo,
da beide MAX IC´s das SPI problem haben.
Benutze ich jetzt ein AD595
Damit ist das problem gelöst

Danke noch einmal pylon ;o)

Grüße
Ratlos

Hallo,
der AD595 mit Multiplexen geht.

Da der AD595 bei 840°C doch arg daneben liegt habe ic hes mit einer Tabelle Korregiert.
Aber kann man anhand des Datenblattes nicht eine Formel benutzen ?

Leider bin ich nicht Klug genug dafür.
Hat jemend eine Libery oder eine Formel ?

Danke Grüße
Ratlos