Willkommen! Anmelden Ein neues Profil erzeugen

Erweiterte Suche

PID-Regelung mit lookup-table

geschrieben von eztam 
PID-Regelung mit lookup-table
11. November 2013 03:48
Hallo zusammen,

ich möchte gerne (unabhängig von de Firmware) vom 100k Widerstand (Semitec 104GT-2) die Temperatur auslesen, um später eine Regelung aufzubauen.
Verdrahtet ist schon alles und ich bekomme auch die "passenden" Analogwerte rein. Hab mir die lookup-table von der Marlin-Firmware geholt, weiß aber jetz nicht wie ich vom Analogwert des Eingangs auf die Temperatur komm. Hier mal der Code:

int sensorPin = A1;
#define OVERSAMPLENR 16

const short temps[][2] PROGMEM = {
// ATC Semitec 104GT-2 (Used in ParCan)
// Verified by linagee. Source: [shop.arcol.hu]
// Calculated using 4.7kohm pullup, voltage divider math, and manufacturer provided temp/resistance
{1*OVERSAMPLENR, 713},
{17*OVERSAMPLENR, 300}, //top rating 300C
{20*OVERSAMPLENR, 290},
{23*OVERSAMPLENR, 280},
{27*OVERSAMPLENR, 270},
{31*OVERSAMPLENR, 260},
{37*OVERSAMPLENR, 250},
{43*OVERSAMPLENR, 240},
{51*OVERSAMPLENR, 230},
{61*OVERSAMPLENR, 220},
{73*OVERSAMPLENR, 210},
{87*OVERSAMPLENR, 200},
{106*OVERSAMPLENR, 190},
{128*OVERSAMPLENR, 180},
{155*OVERSAMPLENR, 170},
{189*OVERSAMPLENR, 160},
{230*OVERSAMPLENR, 150},
{278*OVERSAMPLENR, 140},
{336*OVERSAMPLENR, 130},
{402*OVERSAMPLENR, 120},
{476*OVERSAMPLENR, 110},
{554*OVERSAMPLENR, 100},
{635*OVERSAMPLENR, 90},
{713*OVERSAMPLENR, 80},
{784*OVERSAMPLENR, 70},
{846*OVERSAMPLENR, 60},
{897*OVERSAMPLENR, 50},
{937*OVERSAMPLENR, 40},
{966*OVERSAMPLENR, 30},
{986*OVERSAMPLENR, 20},
{1000*OVERSAMPLENR, 10},
{1010*OVERSAMPLENR, 0}
};



void setup(){
Serial.begin(9600);

}

void loop()
{
int therm;
therm=analogRead(sensorPin);
therm=pgm_read_word(&temps[therm]);
Serial.println(therm, DEC);
delay(500);
}

hoffe mir kann jemand helfen.
Gruß
In diesem Forum dürfen leider nur registrierte Teilnehmer schreiben.

Klicke hier, um Dich einzuloggen