Dla wyjaśnienia dodam co to jest roger beep- jest to krótki sygnał dźwiękowy generowany po zwolnieniu przycisku nadawania w nadajniku radiowym.
Poniżej przedstawiam wersie NASA, czyli jeden ton na początku transmisji drugi na końcu. Podobne tony można było usłyszeć podczas misji Apollo.
Płytka dwustronna została zaprojektowana w KICAD a oprogramowanie napisane w Bascom AVR v2.0.4

Uploaded with ImageShack.us






Poniżej widoczna jest wstępna wersja kodu z komunikacją przez rs232, co pomogło mi na szybsze dobranie odpowiedniego tonu i czasu.
W kolejnej wersji planuje zastąpienie bascomowego sound, timerem a także zlikwidowanie wait , oraz dodanie wyłącznika na portb.0 który w tym momencie nie działa.
Kod: Zaznacz cały
$regfile = "attiny2313.dat"
$baud = 9600
$crystal = 8000000
$hwstack = 32
$swstack = 8
$framesize = 24
Dim Tim_e1 As Word
Dim Tim_e2 As Word
Dim Tone1 As Word
Dim Tone2 As Word
Dim Flag1 As Bit
Dim Flag2 As Bit
Dim Flag3 As Bit
Dim Serial_flag As Byte
Dim Wait_time As Byte
Config Portd.4 = Output
Portd.4 = 0
Config Portb.0 = Input
Portb.0 = 1
Ptt Alias Portd.4
Config Portd.5 = Output
Portd.5 = 0
Beep Alias Portd.5
Config Portd.2 = Input
Portd.2 = 1
Config Portd.3 = Input
Portd.3 = 1
Config Portd.6 = Output
Portd.6 = 1
Config Int0 = Falling
Config Int1 = Rising
Enable Interrupts
Enable Int0
Enable Int1
On Int0 Ptt_on
On Int1 Ptt_off
Wait_time = 120
Tim_e1 = 200
Tone1 = 270
Tim_e2 = 600
Tone2 = 275
Do
Serial_flag = Ischarwaiting() 'jesli jakis znak w buforze to ustaw flage na 1
If Serial_flag = 1 Then
Input "did you press enter?"
Input "120-input delay PTT" , Wait_time
Input "200-firts beep Time=" , Tim_e1
Print "Time of first beep is =" ; Tim_e1 ; Chr(13)
Input "270-input tone of first beep =" , Tone1
Print "tone of first beep is = " ; Tone1 ; Chr(13)
Print
Input "600-input second beep Time=" , Tim_e2
Print "Time of second beep is =" ; Tim_e2 ; Chr(13)
Input "275-input tone of second beep =" , Tone2
Print "tone of second beep is = " ; Tone2 ; Chr(13)
End If
Debounce Pinb.0 , 0 , Pr
If Flag1 = 1 Then
Waitms Wait_time
Set Beep
Sound Portd.6 , Tim_e1 , Tone1
Reset Flag1
Reset Beep
End If
'Waitms 100
If Flag2 = 1 Then
Set Beep
Sound Portd.6 , Tim_e2 , Tone2
Reset Flag2
Reset Beep
Reset Ptt
End If
Loop
End
Ptt_on:
Set Ptt
Set Flag1
Return
Ptt_off:
Set Flag2
Return
'Pr:
Reset Portd.4
Reset Portd.5
Return
[ Dodano: 2011-02-07, 19:53 ]
Dla zainteresowanych dodaje plik rar a w nim cały projekt plus kod.