Witam.
Zakupiłem sobie pcb do zestawu Avt 3003 i po zmontowaniu pojawił się problem mianowicie.
Pomiar do wartości mniej niż 200 kHz jest ok a jak uzyska się tą granice lub poda więcej na wejście podaje bzdury.
W spisie jest 74s00 zastosowałem 74hc00n
74s74 zastosowałem 74hc74b1
Schemat i opis w załączniku.
Program
Dzięki za pomoc
Zakupiłem sobie pcb do zestawu Avt 3003 i po zmontowaniu pojawił się problem mianowicie.
Pomiar do wartości mniej niż 200 kHz jest ok a jak uzyska się tą granice lub poda więcej na wejście podaje bzdury.
W spisie jest 74s00 zastosowałem 74hc00n
74s74 zastosowałem 74hc74b1
Schemat i opis w załączniku.
Program
$regfile = "attiny2313.dat"
$crystal = 10000000
Config Lcd = 16 * 1a
Config Lcdpin = Pin , Db4 = Pb.4 , Db5 = Pb.5 , Db6 = Pb.6 , Db7 = Pb.7 , E = Pb.3 , Rs = Pb.2
Dim Ccount As Byte
Dim Maincounter As Long
Dim C_counter As Word
Dim Flag1 As Bit
Dim Flag2 As Word
Dim Tuning As Word
Config Pind.0 = Input
Config Pind.1 = Input
Config Pind.2 = Input
Config Pind.3 = Input
Config Pind.4 = Input
Config Pind.5 = Input
Config Pind.6 = Output
Config Pinb.0 = Output
Load Timer0 20
Declare Sub Frequency
Declare Sub Events
S1 Alias Pind.1
S2 Alias Pind.0
S3 Alias Pind.3
S4 Alias Pind.4
Set Portd.6
Tuning = 4844
Flag2 = 1
Call Frequency
Cls
Sub Frequency
Config Timer0 = Timer , Prescale = 8
Config Timer1 = Counter , Edge = Falling , Noice Cancel = 1
C_counter = 0
Set Portd.6
Cls
Cursor Off
Enable Timer0
Enable Interrupts
On Timer0 Timint
Enable Timer1
Ccount = 0
On Timer1 Int_0
Start Timer0
Start Timer1
Timer1 = 0
Do
Set Pind.1
Debounce Pind.1 , 0 , Main , Sub
Loop
End Sub
Timint:
Incr C_counter
If C_counter = Tuning Then
Stop Timer1
Stop Timer0
Maincounter = Ccount * 65536
Maincounter = Maincounter + Timer1
If Maincounter = 1 Then
Maincounter = 0
End If
If Maincounter < 30000 Then
If Portd.6 = 1 Then
Reset Portd.6
End If : End If
If Maincounter > 4500000 Then
If Portd.6 = 0 Then
Set Portd.6
End If : End If
If Maincounter = 0 Then
Set Portd.6
End If
If Portd.6 = 1 Then
Maincounter = Maincounter / 31
End If
Ccount = 0
If Portd.6 = 0 Then
Tuning = 4884
Else
Tuning = 4844
End If
Timer0 = 0
Cls
If Portd.6 = 0 Then
Lcd "F [Hz]="
Else
Lcd "F[kHz]="
End If
Locate 2 , 1
Lcd " "
Locate 2 , 1
Lcd Maincounter ;
Locate 2 , 8
Lcd "*"
Waitms 200
Locate 2 , 8
Lcd " "
C_counter = 0
Maincounter = 0
Timer1 = 0
Start Timer0
Start Timer1
End If
Return
Int_0:
Incr Ccount
Return
Main:
Disable Timer0
Incr Flag2
If Flag2 > 2 Then
Flag2 = 1
End If
Select Case Flag2
Case 1 : Call Frequency
Case 2 : Call Events
End Select
Return
Sub Events
Cls
Stop Timer1
Locate 2 , 7
Lcd "E."
Wait 1
Counter1 = 0
Do
Debounce Pind.1 , 0 , Main , Sub
Home
Lcd Counter1
Set Portd.3
If Pind.3 = 0 Then Counter1 = 0
Set Portd.4
If Pind.4 = 0 Then Stop Timer1
Set Portd.0
If Pind.0 = 0 Then Start Timer1
If Counter1 > 64000 Then Counter1 = 0
Loop
End Sub
Dzięki za pomoc

![[AtTiny2313]-Miernik częstotliwości - problem [AtTiny2313]-Miernik częstotliwości - problem](https://obrazki.elektroda.pl/26_1233847075.jpg)