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: Durchflussmesser+CControl mit 2 Freqeingängen Kategorie: Programmierung Basic (von Christoph berninger - 11.06.2005 13:20)
 Als Antwort auf Re: Durchflussmesser+CControl mit 2 Freqeingängen von Michael - 10.06.2005 19:59
Christoph berninger nutzt:  Micro

> poste doch mal bitte das programm.
> w√ľrd mich interessieren da ich im moment auch so etwas baue



define da1 da   [1]
define da2 da   [2]

define ad1 ad   [1]
define ad2 ad   [2]

define b1   byte [1]
define b2   byte [2]
define b3   byte [3]
define b4   byte [4]
define b5   byte [5]
define b6   byte [6]
define lcd_param byte [7]
define lcd_buf   byte [8]
define b7   byte [9]
define b10  byte [10]
define b11  byte [11]
define b12  byte [12]
define b13  byte [13]
define b14  byte [14]
define b15  byte [15]
define b16  byte [16]
define wie  word [9]
define w1   word [10]
define w2   word [11]
define w3   word [12]

define lcd_rs         port  [14]
define lcd_rw         port  [13]
define lcd_e          port  [15]
define lcd_port       byteport   [2]

b2 = 255
wie = 1
w3 = 1
gosub LCD_INIT

#loop
'läuft der Motor abfage durch schprittzähler!!!
b1 = second
if b2 > 4 then b2 = 255
b2 = b2 + 1
b3 = freq2 - freq1
w2 = w2 + b3
print "w2",w2
if b3 = 0 then beep 100,1,0

if b3 > 100 then b3 = 0

'b3 = ad1- ad2
print "freq2",freq2 *36
print "freq",freq *36
'print "abweichung" ,1000 *freq/freq2
on b2 gosub A,B,C,D,E
'Momentanverbrauch
b4 = (b10 + b11 + b12 + b13 + b14 + b15)*72/10
da1 = b4

'Durchschnitt ab Start
b6 = w3 / (wie) * 36
'Zähler1
w1 = w1 + b3 'zählbedingung
'Zähler2
'w2 = w2 + b3

'Zähler ab start
w3 = w3 + b3

if w1 > 9999 or  w3 > 32000 or wie = > 32000 then gosub zu
'anzeige option
lcd_param = &H80: gosub LCD_WRITECMD
lcd_param = 32:gosub LCD_WRITECHAR
lcd_param = 77:gosub LCD_WRITECHAR
lcd_param = b4 /100 + 48 :gosub LCD_WRITECHAR
lcd_param = (b4-(b4 /100)*100)/10 + 48 :gosub LCD_WRITECHAR
lcd_param = 44 :gosub LCD_WRITECHAR
lcd_param = (b4-(b4 /10)*10) + 48 :gosub LCD_WRITECHAR
lcd_param = 32:gosub LCD_WRITECHAR
lcd_param = 32:gosub LCD_WRITECHAR
lcd_param = 32:gosub LCD_WRITECHAR
lcd_param = 68:gosub LCD_WRITECHAR
lcd_param = b6 /100 + 48 :gosub LCD_WRITECHAR
lcd_param = (b6 -(b6 /100)*100)/10 + 48 :gosub LCD_WRITECHAR
lcd_param = 44 :gosub LCD_WRITECHAR
lcd_param = (b6 -(b6 /10)*10) + 48 :gosub LCD_WRITECHAR

lcd_param = &HC0: gosub LCD_WRITECMD
lcd_param = 83:gosub LCD_WRITECHAR
lcd_param = (b7 /10) + 48 :gosub LCD_WRITECHAR
lcd_param = (b7 -(b7 /10)*10) + 48 :gosub LCD_WRITECHAR
lcd_param = (w1-(w1/10000)*10000)/1000 + 48 :gosub LCD_WRITECHAR
lcd_param = 44 :gosub LCD_WRITECHAR
lcd_param = (w1-(w1/1000)*1000)/100 + 48 :gosub LCD_WRITECHAR
lcd_param = (w1-(w1/100)*100)/10 + 48 :gosub LCD_WRITECHAR
lcd_param = (w1-(w1/10)*10) + 48 :gosub LCD_WRITECHAR
lcd_param = 70:gosub LCD_WRITECHAR
lcd_param = (b16 /10) + 48 :gosub LCD_WRITECHAR
lcd_param = (b16 -(b16 /10)*10) + 48 :gosub LCD_WRITECHAR
lcd_param = (w2-(w2/10000)*10000)/1000 + 48 :gosub LCD_WRITECHAR
lcd_param = 44 :gosub LCD_WRITECHAR
lcd_param = (w2-(w2/1000)*1000)/100 + 48 :gosub LCD_WRITECHAR
lcd_param = (w2-(w2/100)*100)/10 + 48 :gosub LCD_WRITECHAR
lcd_param = (w2-(w2/10)*10) + 48 :gosub LCD_WRITECHAR


if second <> b1 then beep 100,10,0 else wait second <> b1
wie = wie + 1
goto loop

#zu
beep 100,10,0
if w1 > 9999 then b7  = b7  + 1
if w1 > 9999 then w1 = (w1-(w1/10000)*10000)
if w2 > 9999 then b16  = b16  + 1
if w2 > 9999 then w2 = (w2-(w2/10000)*10000)
if w3 > 32000 or wie = > 32000 then w3 = w3/10
if w3 > 32000 or wie = > 32000 then wie = wie /10

return

#a
b10 = b3
return
#b
b11 = b3
return
#c
b12 = b3
return
#d
b13 = b3
return
#e
b14 = b3
return
#f
b15 = b3
return

#LCD_INIT

  lcd_port = OFF

  lcd_param=&H38 : gosub LCD_WRITECMD

  lcd_port=&B00000010
  tog lcd_e
  tog lcd_e

  lcd_param = &H28 : gosub LCD_WRITECMD
  lcd_param = &H0C : gosub LCD_WRITECMD

#LCD_CLS
  lcd_param = &H02 : gosub LCD_WRITECMD
  lcd_param = &H01 : gosub LCD_WRITECMD
return

#LCD_WRITECMD
  lcd_buf = OFF
  goto LCD_WRITE

#LCD_WRITECHAR
  lcd_buf = &B00100000

#LCD_WRITE
  lcd_port = lcd_buf or (lcd_param shr 4) ' Hi-Nibble
  tog lcd_e
  tog lcd_e
  lcd_port = lcd_buf or (lcd_param and &H0F)  ' Lo-Nibble
  tog lcd_e
  tog lcd_e
return

 Antwort schreiben

Bisherige Antworten: