Dim New As Bit
Dim Command As Byte , Subaddress As Byte , Volume As Byte
Reset P1.0
Reset P1.1
Reset P1.2
Reset P1.3
Reset P1.4
Reset P1.5
Reset P1.6
Reset P1.7
Reset Tcon.0
Volume = 50 'triggered by rising edge
On Int0 Receiverc5
Enable Int0
Enable Interrupts
Do
If New = 1 Then 'received new code
Disable Int0
If Command = 20 Then
Set P1.0
Waitms 200
Reset P1.0
End If
If Command = 3 Then
Set P1.1
Waitms 200
Reset P1.1
End If
If Command = 1 Then
Set P1.2
Waitms 200
Reset P1.2
End If
If Command = 2 Then
Set P1.3
Waitms 200
Reset P1.3
End If
If Command = 21 Then
Set P1.4
Waitms 200
Reset P1.4
End If
If Command = 19 Then
Set P1.5
Waitms 200
Reset P1.5
End If
If Command = 18 Then
Set P1.6
Waitms 200
Reset P1.6
End If
If Command = 13 Then
Set P1.7
Waitms 200
Reset P1.7
End If
If Command = 20 Then
Set P1.0
Waitms 200
Reset P1.0
End If
If Command = 3 Then
Set P1.1
Waitms 200
Reset P1.1
End If
If Command = 1 Then
Set P1.2
Waitms 200
Reset P1.2
End If
If Command = 2 Then
Set P1.3
Waitms 200
Reset P1.3
End If
If Command = 21 Then
Set P1.4
Waitms 200
Reset P1.4
End If
If Command = 19 Then
Set P1.5
Waitms 200
Reset P1.5
End If
If Command = 18 Then
Set P1.6
Waitms 200
Reset P1.6
End If
If Command = 13 Then
Set P1.7
Waitms 200
Reset P1.7
End If
If Command = 20 Then
Set P1.0
Waitms 200
Reset P1.0
End If
If Command = 3 Then
Set P1.1
Waitms 200
Reset P1.1
End If
If Command = 1 Then
Set P1.2
Waitms 200
Reset P1.2
End If
If Command = 2 Then
Set P1.3
Waitms 200
Reset P1.3
End If
If Command = 21 Then
Set P1.4
Waitms 200
Reset P1.4
End If
If Command = 19 Then
Set P1.5
Waitms 200
Reset P1.5
End If
If Command = 18 Then
Set P1.6
Waitms 200
Reset P1.6
End If
If Command = 13 Then
Set P1.7
Waitms 200
Reset P1.7
End If
If Command = 16 Then ' procedura zwiększania głosnosci
If Volume = 192 Then
Volume = 191
End If
Reset P3.5
Shiftout P3.3 , P3.4 , Volume , 3
Incr Volume
Set P3.5
Waitms 1
End If
If Command = 17 Then' procedura zmniejszaniai
If Volume = 0 Then
Volume = 1
End If
Reset P3.5
Decr Volume
Shiftout P3.3 , P3.4 , Volume , 3
Set P3.5
Waitms 1
End If
New = 0 'reset new bit
Enable Int0
End If
Loop
Receiverc5: 'interrupt routine
'the getrc5 routine uses 30 bytes ! of the stack for measuring
'the interval between the bits
Getrc5(subaddress , Command)
New = 1 'set flag
Return
Zrobiłem sobie w ten sposób sterowanie do odtwarzacza cd do którego nie maiłem pilota

tamte procedury na górze <if cośtam możesz wyrzucić> one są po to by generować impuls na kolejnych wyjściach procesora i w ten sposób właczyć kolejne funkcje w cd. zostaw tylko te procedury zwiekszania głośności. musisz mieć zwykły pilot do triluxa z kodem rc5 zrobisz głośniej i ciszej procesor odpowie i pga tez

. P3.5 dołaczasz do CS. p3.3 to wyjście danych a p3.4 to zegar wyjściowy. jak czegoś nie wiesz to pytaj. przepraszam że tak późno odpowiedziałem ale miałem egzaminy

. aaa i niech nikt nie mówi mi o jakims tda ze jest lepszy... Panowie Pga to zamiennik słynnego cs3310 i sadze że jeśli chodzi o potencjometry cyfrowe jest najlepszy. Dodam tylko że cs 3310 stosowano w przedwzmacniaczu hi end (nie pamiętam firmy)za .... 16000zł więc uważam że takowy do najgorszych nie należy

a co do zniekształceń THD.. hmm. czy to ważne czy ma 0.002 czy 0.009? pewnie że nie.. ważne sa szybkość i pasmo od nich zależa zniekształcenia TIM( na nie jesteśmy bardzo wrażliwi) a których większość producentów scalaków nie podaje

. z resztą pga2310 i tak mają najmniejsze o ile pmiętam to 0.0004:)