Offline
Jr. Member
Karma: 0
Posts: 68
|
 |
« Reply #15 on: February 15, 2013, 02:12:57 am » |
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
|
|
|
|
|
Logged
|
|
|
|
|
Switzerland
Offline
Faraday Member
Karma: 69
Posts: 3310
|
 |
« Reply #16 on: February 15, 2013, 01:54:54 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 68
|
 |
« Reply #17 on: February 15, 2013, 03:37:20 pm » |
Hallo, habe es so gemacht wie von Dir beschrieben. Es gab keine Fehlermeldung  Aber es brachte kein Displayaufbau vorteil  Ohne das Display ist es schon blöd Grüße Ratlos
|
|
|
|
|
Logged
|
|
|
|
|
Switzerland
Offline
Faraday Member
Karma: 69
Posts: 3310
|
 |
« Reply #18 on: February 18, 2013, 05:28:12 am » |
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?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 68
|
 |
« Reply #19 on: February 18, 2013, 11:30:43 am » |
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,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 } }Grüße Ratlos
|
|
|
|
|
Logged
|
|
|
|
|
Switzerland
Offline
Faraday Member
Karma: 69
Posts: 3310
|
 |
« Reply #20 on: February 18, 2013, 12:09:55 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 68
|
 |
« Reply #21 on: February 18, 2013, 03:28:28 pm » |
Hallo meine Schuld hatte nicht richtig geklickt und nicht weiter konntrolliert  #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 } }
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 68
|
 |
« Reply #22 on: February 20, 2013, 06:30:23 am » |
Hallo, habe mal den MAX6675 gegen den MAX31855 getauscht. Es haben bei das SPI problem, bei verwendung von weiteren SPI geräten.  werde jetzt mal den ADG595 verwenden. Da der ohne SPI arbeitet müste es ja gehen. Grüße Ratlos
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 68
|
 |
« Reply #23 on: February 22, 2013, 09:35:30 am » |
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
|
|
|
|
|
Logged
|
|
|
|
|
|