Das Open-Control-Projekt - Die Alternative zur C-Control-I


Das Forum zur C-Control-1
Welche C-Control-Varianten existieren?
Übersicht - Suchen - Neueste 50 Beiträge - Neuer Beitrag - Login - Registrieren
INFO - FAQ - CC2-Forum - CCPro-Forum 

 Re: DS1631: 10, 11 oder 12 Bits Konfigurieren/lesen Kategorie: C-Control I V1.2/2.0 (von Daniel - 26.10.2005 17:16)
 Als Antwort auf Re: DS1631: 10, 11 oder 12 Bits Konfigurieren/lesen von Henrik - 26.10.2005 15:15
Daniel nutzt:  CC1-M-Unit V1.2/2.0

>
> Hello Daniel,
>
> > Thank You Henrik, but I'm a bit old fashioned (and >60) and I do use traditional CCBasic 2.0 with a driver
> > developed by Die Hard (see below), modified recently by himself. I would rather be able to modify the driver for 11 bits precision.
>
> well, to change Die Hards sample is not very usefull.
> But anyway, if you want to stick to CC-Basic - I've written a sample for this Purpose in former times. Sorry the program ist written with explanations in German, hope you come come along.
>
> Here ist is ( for you the only important thing is the Subroutine Readtemp):
>
>
> 'Test für I2C mit Dallas Temperatursensor
> '
> '
> '---- Variablen definieren-----------------------------------------
>
> define value      word
> define DEV1       byte
> define TEMP       byte
> define DATA       byte
> define temperatur byte
> define counter    byte
> define slope      byte
> define keyboard   ad[7]
>
>
> #INIT
>
> print"#ON_CONFIG#";             'UMGELEITET
> get TEMP                        'den aktuellen Wert lesen
> put (TEMP or &B0011000)         'Bits setzten und zurück schreiben
> print"#OFF#";                   'Umleitung abschalten
>
>
> print"#ON_LCD#";
> print"#INIT#";
> print"1621 TEST";:pause 50
> print"#CLR#";:print"#OFF#";
>
>
> '--------- HAUPTPROGRAMM -----------------------------------------
>
>
> #genau
> dev1 = 144
> gosub READTEMP
>
> print "#ON_LCD#";
> print "#L101#";
> print value/10; ","; value mod 10;
>
> 'pause 50
> print "#OFF";
>
> goto genau
>
> '--------------------------------------------------------------------
> #READTEMP
>
> print "#ON_IIC#";
>
> print"#START#";
> put DEV1
> put &hEE       'temperaturmessung anstoßen
> print"#STOP#";
>
> pause 10
>
> print"#START#";
> put DEV1
> put &h22       'temperaturmessung stoppen
> print"#STOP#";
>
> '---------------------------
>
> print"#START#";
> put DEV1
> put &hAA           'temperaturmessung Lesekommando
> print"#STOP#";
>
>
> print"#START#";
> put DEV1+1         'lowtemperaturbyte auslesen
> get value
> temperatur = value
> 'get value          'dummy auslesung
> print"#STOP#";
> '------------------------------
> print"#START#";
> put DEV1
> put &hA8           'Counter Lesekommando
> print"#STOP#";
>
> print"#START#";
> put DEV1+1         'Counter auslesen
> get value
> counter = value
> print"#STOP#";
> '-----------------------------
>
> print"#START#";
> put DEV1
> put &hA9           'Slope Lesekommando
> print"#STOP#";
>
>
> print"#START#";
> put DEV1+1         'Slope auslesen
> get value
> slope = value
> print"#STOP#";
>
> print"#OFF#";
>
> value = ((temperatur*100-25) + ((slope-counter)*100/slope*100)/100)/10
>
> return
>
>
> Best regards
> Henrik

Thanks Henrik, I'll test this in the coming week. Regards. Daniel
PS: German is not a problem but I did loose practice in writing.

 Antwort schreiben

Bisherige Antworten:

Re: DS1631: 10, 11 oder 12 Bits Konfigurieren/lesen (von Daniel - 29.10.2005 9:00)