Hi Darrel,
Uuuuhhh......
DW is not working for PIC16F.... it places a WORD packed in 2 BYTEs with a RETLW added.
READCODE cannot adress the table direct, you have to use the macro, i guess. (but I will see what this CON EXT will be...)
LOOKDOWN2 is ... I don't use it. My routine looks like this:
;================================================= =========================
NTC2Temp:
@ SetI2CText _Tab_NTC
I=0 ;Anfangstemperatur der Tabelle
Gosub ReadWord ;Anfangsspannungswert ADC
While DummyW ;solange die Tabelle noch nicht durch ist
Dummy2W=DummyW:Gosub ReadWord
For J=1 to 5
If ADC_NTC<Dummy2W Then ;wenn Temperatur noch nicht gefunden
Dummy2W=Dummy2W-(Dummy2W-DummyW)/(6-J):I=I+1
Endif
Next J
Wend
Dummy=I:Return
;================================================= =========================
;Umrechnung NTC
;gemessener ADC-Wert auf Temperatur
Tab_NTC:
@ DW 879,852,821,786,747,704 ;0-25°C
@ DW 659,612,564,516,468,419 ;30-55°C
@ DW 375,338,303,270,239,211 ;60-85°C
@ DW 187,166,147,130,116,103 ;90-115°C
@ DW 92,82,73,65,58,52,47 ;120-150°C
@ DW 0
;================================================= =========================
the datapoints (every 5 degrees) must be interpolated, so LOOKDOWN2 is not realy good to me.
PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2
Bookmarks