Hallo, ich hoffe ihr können mich helfen
Ich hab ein ein aplausometer gebaut für die weihnachtsfeier von meine firma und die is morgen
, es handelt sich um ein led bargraph mit 48 spalten und 10 reihen leds , 3 led spalten sind eine stufe also 30 leds , benutze ein atmega 32 und benutze 2 ports (portd c und d ) , also hab ich ins gesamt 16 stufen. zum messen der lautstärke benutze ich ein elekret mikrophon , dazu hab ich ein verstärker gebaut am adc 0, zum einstellen der empfindlichkeit verwende ich ein poti am adc 1
Mein problem ist das ich erst heute fertig geworden bin mit dem bau , wegen lieferverzug von den leds , hab ein program geschrieben aber es ist nicht so wie ich es will
.
ich möchte das die leds ruhiger werden , und das der maximal wert länger angezeigt wird , ich hatte schon der tip bekommen das ich es mit ein kondensator versuchen soll oder mit ein wait in mein program mit beiden verlöschen die leds zu schnell , hatt jemand vieleicht eine idee wie ich das machen kann ? oder bin ich falsch vom einsatz her das ich das messen kann mit ein lautsprecher ?
da ist mein code
Code:
$regfile = "m32def.dat"
$crystal = 16000000
$hwstack = 32
$swstack = 10
$framesize = 40
Config Portc = Output
Config Portd = Output
Config Adc = Single , Prescaler = Auto , Reference = Internal
Dim Micro As Word
Dim Poti As Word
Dim Miceing As Word
Dim Zeit As Word
Dim A As Word
Dim B As Word
Dim C As Word
Dim D As Word
Dim E As Word
Dim F As Word
Dim G As Word
Dim H As Word
Dim I As Word
Dim J As Word
Dim K As Word
Dim L As Word
Dim M As Word
Dim N As Word
Dim O As Word
Dim P As Word
Start Adc
Do
Waitms 20
Poti = Getadc(1) - 130
Micro = Getadc(0) * 4
A = Poti + 700
B = Poti + 750
C = Poti + 850
D = Poti + 950
E = Poti + 1050
F = Poti + 1200
G = Poti + 1400
H = Poti + 1600
I = Poti + 1800
J = Poti + 2000
K = Poti + 2200
L = Poti + 2400
M = Poti + 2600
N = Poti + 2800
O = Poti + 3000
P = Poti + 3200
If Micro > A Then
Portc.1 = 0
Else
Portc.1 = 1
End If
If Micro > B Then
Portc.0 = 0
Else
Portc.0 = 1
End If
If Micro > C Then
Portc.3 = 0
Else
Portc.3 = 1
End If
If Micro > D Then
Portc.2 = 0
Else
Portc.2 = 1
End If
If Micro > E Then
Portc.5 = 0
Else
Portc.5 = 1
End If
If Micro > F Then
Portc.4 = 0
Else
Portc.4 = 1
End If
If Micro > G Then
Portc.7 = 0
Else
Portc.7 = 1
End If
If Micro > H Then
Portc.6 = 0
Else
Portc.6 = 1
End If
If Micro > I Then
Portd.1 = 0
Else
Portd.1 = 1
End If
If Micro > J Then
Portd.0 = 0
Else
Portd.0 = 1
End If
If Micro > K Then
Portd.3 = 0
Else
Portd.3 = 1
End If
If Micro > L Then
Portd.2 = 0
Else
Portd.2 = 1
End If
If Micro > M Then
Portd.5 = 0
Else
Portd.5 = 1
End If
If Micro > N Then
Portd.4 = 0
Else
Portd.4 = 1
End If
If Micro > O Then
Portd.7 = 0
Else
Portd.7 = 1
End If
If Micro > P Then
Portd.6 = 0
Else
Portd.6 = 1
End If
Loop
Lesezeichen