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: SHT 75 c-control Programm Kategorie: C-Control I V1.1 (von FollowTheZorn - 1.08.2007 20:41)
 Als Antwort auf SHT 75 c-control Programm von FollowTheZorn - 1.08.2007 19:33
FollowTheZorn nutzt:  CC1-Unit V1.1
ich bins nochmal...
hier das Programm von cctools
vielleicht kann es jemand compilieren, ob der fehler nur bei mir auftritt!?
kämpf nun schon länger mit diesem problem....
also besten dank im vorraus

MFG
Mario

--------------------------------------------------------------
'Ansteuerungsbeispiel f¸r Feuchtesensor SHT15 (#1515-0)
'CCTools 2005 cctools.hs-control.de (19.04.2005)
'--------------------------------------------------------------
'Die rH-Wert ist nicht Temperaturkompensiert !

define Clock port[7]
define Data port[8]

define tempW word[1] '‹berlappung mit Byte 1 & 2 !!!!
define temp  byte[1] 'tempor‰res Datenbyte
define temp2 byte[2] 'tempor‰res Datenbyte
define i     byte[3]
define ack   byte[4]

define dataW word[3]
 define dataWhi byte[5]
 define dataWlo byte[6]

define Temperatur word[4]
define Feuchte    word[5]

define tempW2     word[6]


gosub SHTinit
#loop

 Temperatur = SHTgettemp
 Feuchte = SHTgethyg
 
 put 12
 print "Temperatur:",
 print Temperatur/100;",";abs((Temperatur/10))mod 10;abs(Temperatur mod 10);"∞C"
 print "Feuchte: ",
 if Feuchte>=0 then print Feuchte/10;",";Feuchte mod 10;"%rH" else print "Fehler"
 pause 50
goto loop

#SHTinit
 deact Data
 Clock = 0
 for i=0 to 10 pulse Clock
return
 
#SHTstart
 Clock =-1
 Data  = 0
 Clock = 0
 Clock =-1
 deact Data
 Clock = 0
return

#SHTwrite
 for i=0 to 7
  if (temp shl i) and &h80 then deact Data else Data = 0
  pulse Clock
 next i
 deact Data
 Clock = -1
 temp=(Data=0)
 Clock =0
return temp

#SHTread
 temp=0
 for i=0 to 7
  Clock =-1
  temp=(temp shl 1) or (Data and 1)
  Clock = 0
 next i
 if ack then Data = 0 else deact Data
 pulse Clock
 deact Data
return temp

#SHTreadint
 tempW = timer
 #SHTwloop
  if timer-tempW>=50 then return &hF000
 if Data then goto SHTwloop
 ack = 1
 dataWhi=SHTread 'High-Byte
 ack = 0
 dataWlo=SHTread 'Low-Byte
return dataW

#SHTgettemp
 gosub SHTstart
 temp = &b00011 : gosub SHTwrite
 dataW = SHTreadint-4000
return dataW

#SHTgethyg
 gosub SHTstart
 temp = &b00101 : gosub SHTwrite
 Feuchte=SHTreadint
 if Feuchte and &h8000 then return -1
 tempW = Feuchte shr 4
 i = Feuchte mod 16
 looktab shtab,tempW,tempW2
 tempW = tempW - 1
 looktab shtab,tempW,tempW
 tempW2 = ((tempW2 - tempW) * i) shr 4
 Feuchte = tempW + tempW2
return Feuchte

table shtab "sht.tab"

 Antwort schreiben

Bisherige Antworten:

Re: SHT 75 c-control Programm (von André H. - 3.08.2007 11:48)
Re: SHT 75 c-control Programm (von joergm6 - 2.08.2007 16:46)