hallo
Ich hab mein ein 2 tes program vielleicht wird es hier einfacher , ich muss nur die led anzeige ruhiger werden lassen , das die leds rauf und runter langsamer und das sie nicht plötzlich erscheinen ich hoffe das jemand eine lösung weisst , ich bin verzweifelt am probieren .
Code:
$regfile = "m32def.dat"
$crystal = 16000000
$hwstack = 32
$swstack = 10
$framesize = 40
$sim
Config Portc = Output
Config Portd = Output
Dim A As Word
Dim Led_pos As Word
Dim Bereich As Word
Dim Bar_muster As Word
Dim Mic As Word
Dim Poti As Word
Dim Maximal As Single
Const Schritt = 16
Config Adc = Single , Prescaler = Auto , Reference = Internal
Start Adc
Do
Bar_muster = Lookup(led_pos , Bar_form)
Portc.1 = Bar_muster.15
Portc.0 = Bar_muster.14
Portc.3 = Bar_muster.13
Portc.2 = Bar_muster.12
Portc.5 = Bar_muster.11
Portc.4 = Bar_muster.10
Portc.7 = Bar_muster.9
Portc.6 = Bar_muster.8
Portd.1 = Bar_muster.7
Portd.0 = Bar_muster.6
Portd.3 = Bar_muster.5
Portd.2 = Bar_muster.4
Portd.5 = Bar_muster.3
Portd.4 = Bar_muster.2
Portd.7 = Bar_muster.1
Portd.6 = Bar_muster.0
A = Getadc(0)
Poti = Getadc(1)
If Poti > 620 Then
Poti = 620
Else
Poti = Getadc(1)
End If
Maximal = Poti + 204
Mic = A - 140
Bereich = Maximal / Schritt
Led_pos = Mic / Bereich
Loop
Return
Bar_form:
Data &B1111111111111111%
Data &B1111111111111110%
Data &B1111111111111100%
Data &B1111111111111000%
Data &B1111111111110000%
Data &B1111111111100000%
Data &B1111111111000000%
Data &B1111111110000000%
Data &B1111111100000000%
Data &B1111111000000000%
Data &B1111110000000000%
Data &B1111100000000000%
Data &B1111000000000000%
Data &B1110000000000000%
Data &B1100000000000000%
Data &B1000000000000000%
Data &B0000000000000000%
Lesezeichen