-
This is default featured slide 1 title
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.
-
This is default featured slide 2 title
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.
-
This is default featured slide 3 title
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.
-
This is default featured slide 4 title
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.
-
This is default featured slide 5 title
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.
Pengetahuan Dasar Pemrograman C untuk modul Arduino
Program Animasi LED 24x24 Dot Matrik
$regfile = "m32def.dat"
$crystal = 8000000
$hwstack = 32
$swstack = 32
$framesize = 24
'---- this section from Gif Properties
Const Total_frame = 8
Const Width = 24
Const Height = 24
'---- end of Gif Properties
Const Number_of_matrix_in_row = Width / 8
Const Byte_in_col = Height / 8
Const Frame_size = Width * Byte_in_col
Const Number_of_byte_in_8_col = Byte_in_col * 8
Declare Sub Readframe(byval Frame_number As Word)
' Port A for COL refresh
Config Porta = Output
' Port D for 74595 register
Config Portd = Output
Config Timer0 = Timer , Prescale = 64 'Clock value: 15.625 kHz
On Ovf0 Refresh
Enable Timer0 ' enable the timer interrupt
Enable Interrupts
Sh_cp Alias Portd.3
Ds Alias Portd.4
St_cp Alias Portd.5
Mr Alias Portd.6
Oe Alias Portd.7
Col_port Alias Porta
Dim Col As Byte
Dim Buf(frame_size) As Byte
Dim I As Byte
Dim Matrix_counter As Word
Dim Buf_idx As Word
Dim Col_number_in_buf As Byte
Dim Frame_count As Word
Reset Mr
Set Mr
Reset Oe
Do
For Frame_count = 1 To Total_frame
Readframe Frame_count
Waitms 200
Next Frame_count
Loop
End 'end program
Sub Readframe(byval Frame_number As Word)
Local Idx As Word
Local Lookup_idx As Word
Disable Timer0
Decr Frame_number
'Start of Frame in lookup table
Lookup_idx = Frame_number * Frame_size
For Idx = 0 To Frame_size
Buf(idx) = Lookup(lookup_idx , Ani )
Incr Lookup_idx
Next Idx
Enable Timer0
End Sub
Refresh:
Reset Mr
Set Mr
Col_port = &H00
Set Oe
Col_port = 2 ^ Col
For Matrix_counter = 1 To Number_of_matrix_in_row
Col_number_in_buf = Number_of_matrix_in_row - Matrix_counter
Col_number_in_buf = Col_number_in_buf * Number_of_byte_in_8_col
Buf_idx = Col * Byte_in_col
Buf_idx = Buf_idx + Col_number_in_buf
For I = 1 To Byte_in_col
Shiftout Ds , Sh_cp , Buf(buf_idx) , 1 , 8
Incr Buf_idx
Next I
Next Matrix_counter
Reset St_cp
Set St_cp
Reset Oe
If Col < 7 Then
Incr Col
Else
Col = 0
End If
Return
'---- this delay table from Frame Properties
Delay:
'Frame 1
Data 200%
'Frame 2
Data 100%
'Frame 3
Data 100%
'Frame 4
Data 100%
'Frame 5
Data 100%
'Frame 6
Data 100%
'Frame 7
Data 100%
'Frame 8
Data 100%
Ani:
Data &H18, &H00, &H18 '...##..............##...
Data &H30, &H00, &H0C '..##................##..
Data &H6F, &HF7, &HE6 '.##.########.######..##.
Data &HDF, &HFC, &H23 '##.###########....#...##
Data &HBF, &HFE, &H21 '#.#############...#....#
Data &H00, &H7F, &H20 '.........#######..#.....
Data &H00, &HFF, &HA0 '........#########.#.....
Data &H3F, &HEF, &HE0 '..#########.#######.....
Data &H3F, &HDB, &HE0 '..########.##.#####.....
Data &H37, &H91, &HDE '..##.####..#...###.####.
Data &H00, &H17, &HBF '...........#.####.######
Data &H00, &H3C, &H3F '..........####....######
Data &H30, &HE0, &H3F '..##....###.......######
Data &H38, &H40, &H3F '..###....#........######
Data &H3C, &H80, &H1E '..####..#..........####.
Data &H3E, &H80, &H00 '..#####.#...............
Data &H3F, &H00, &H00 '..######................
Data &H3D, &H00, &H00 '..####.#................
Data &H3A, &H00, &H00 '..###.#.................
Data &HB6, &H00, &H01 '#.##.##................#
Data &HC6, &H00, &H03 '##...##...............##
Data &H6C, &H00, &H06 '.##.##...............##.
Data &H3C, &H00, &H0C '..####..............##..
Data &H18, &H00, &H18 '...##..............##...
' Frame 2
' Delay : 100ms
Data &H18, &H10, &H18 '...##......#.......##...
Data &H30, &H0F, &HEC '..##........#######.##..
Data &H6F, &HFC, &H26 '.##.##########....#..##.
Data &HDF, &HFF, &H23 '##.#############..#...##
Data &HBF, &HFF, &H21 '#.##############..#....#
Data &H00, &H7F, &HA0 '.........########.#.....
Data &H00, &HFF, &HE0 '........###########.....
Data &H3F, &HEB, &HE0 '..#########.#.#####.....
Data &H3F, &HC9, &HE0 '..########..#..####.....
Data &H37, &H90, &HDE '..##.####..#....##.####.
Data &H00, &H3F, &HBF '..........#######.######
Data &H00, &H10, &H3F '...........#......######
Data &H30, &H20, &H3F '..##......#.......######
Data &H38, &H20, &H3F '..###.....#.......######
Data &H3C, &H20, &H1E '..####....#........####.
Data &H3E, &H40, &H00 '..#####..#..............
Data &H3E, &H40, &H00 '..#####..#..............
Data &H3C, &H40, &H00 '..####...#..............
Data &H38, &HC0, &H00 '..###...##..............
Data &HB1, &H80, &H01 '#.##...##..............#
Data &HC1, &H80, &H03 '##.....##.............##
Data &H61, &H80, &H06 '.##....##............##.
Data &H31, &H80, &H0C '..##...##...........##..
Data &H18, &H80, &H18 '...##...#..........##...
' Frame 3
' Delay : 100ms
Data &H18, &H10, &H18 '...##......#.......##...
Data &H30, &H0F, &HEC '..##........#######.##..
Data &H6F, &HFC, &H26 '.##.##########....#..##.
Data &HDF, &HFF, &H23 '##.#############..#...##
Data &HBF, &HFF, &H21 '#.##############..#....#
Data &H00, &H7F, &HA0 '.........########.#.....
Data &H00, &HFF, &HE0 '........###########.....
Data &H3F, &HEB, &HE0 '..#########.#.#####.....
Data &H3F, &HC9, &HE0 '..########..#..####.....
Data &H37, &H88, &HDE '..##.####...#...##.####.
Data &H00, &H1F, &HBF '...........######.######
Data &H00, &H08, &H3F '............#.....######
Data &H30, &H08, &H3F '..##........#.....######
Data &H38, &H08, &H3F '..###.......#.....######
Data &H3C, &H08, &H1E '..####......#......####.
Data &H3E, &H08, &H00 '..#####.....#...........
Data &H3E, &H18, &H00 '..#####....##...........
Data &H3C, &H18, &H00 '..####.....##...........
Data &H38, &H18, &H00 '..###......##...........
Data &HB0, &H18, &H01 '#.##.......##..........#
Data &HC0, &H18, &H03 '##.........##.........##
Data &H60, &H08, &H06 '.##.........#........##.
Data &H30, &H00, &H0C '..##................##..
Data &H18, &H00, &H18 '...##..............##...
' Frame 4
' Delay : 100ms
Data &H18, &H10, &H18 '...##......#.......##...
Data &H30, &H0F, &HEC '..##........#######.##..
Data &H6F, &HFC, &H26 '.##.##########....#..##.
Data &HDF, &HFF, &H23 '##.#############..#...##
Data &HBF, &HFF, &H21 '#.##############..#....#
Data &H00, &H7F, &HA0 '.........########.#.....
Data &H00, &HFF, &HE0 '........###########.....
Data &H3F, &HEB, &HE0 '..#########.#.#####.....
Data &H3F, &HC9, &HE0 '..########..#..####.....
Data &H37, &H88, &HDE '..##.####...#...##.####.
Data &H00, &H1F, &HBF '...........######.######
Data &H00, &H08, &H3F '............#.....######
Data &H30, &H08, &H3F '..##........#.....######
Data &H38, &H08, &H3F '..###.......#.....######
Data &H3C, &H08, &H1E '..####......#......####.
Data &H3E, &H08, &H00 '..#####.....#...........
Data &H3E, &H1C, &H00 '..#####....###..........
Data &H3C, &H1C, &H00 '..####.....###..........
Data &H38, &H1C, &H00 '..###......###..........
Data &HB0, &HDC, &H01 '#.##....##.###.........#
Data &HC0, &H1C, &H03 '##.........###........##
Data &H61, &HA8, &H06 '.##....##.#.#........##.
Data &H30, &H20, &H0C '..##......#.........##..
Data &H18, &H00, &H18 '...##..............##...
' Frame 5
' Delay : 100ms
Data &H18, &H10, &H18 '...##......#.......##...
Data &H30, &H0F, &HEC '..##........#######.##..
Data &H6F, &HFC, &H26 '.##.##########....#..##.
Data &HDF, &HFF, &H23 '##.#############..#...##
Data &HBF, &HFF, &H21 '#.##############..#....#
Data &H00, &H7F, &HA0 '.........########.#.....
Data &H00, &HFF, &HE0 '........###########.....
Data &H3F, &HEB, &HE0 '..#########.#.#####.....
Data &H3F, &HC9, &HE0 '..########..#..####.....
Data &H37, &H88, &HDE '..##.####...#...##.####.
Data &H00, &H1F, &HBF '...........######.######
Data &H00, &H08, &H3F '............#.....######
Data &H30, &H08, &H3F '..##........#.....######
Data &H38, &H08, &H3F '..###.......#.....######
Data &H3C, &H08, &H1E '..####......#......####.
Data &H3E, &H08, &H00 '..#####.....#...........
Data &H3E, &H1C, &H00 '..#####....###..........
Data &H3C, &H1C, &H00 '..####.....###..........
Data &H38, &H1C, &H00 '..###......###..........
Data &HB1, &H9C, &H01 '#.##...##..###.........#
Data &HC0, &H1C, &H03 '##.........###........##
Data &H63, &H48, &H06 '.##...##.#..#........##.
Data &H30, &H40, &H0C '..##.....#..........##..
Data &H18, &H00, &H18 '...##..............##...
' Frame 6
' Delay : 100ms
Data &H18, &H10, &H18 '...##......#.......##...
Data &H30, &H0F, &HEC '..##........#######.##..
Data &H6F, &HFC, &H26 '.##.##########....#..##.
Data &HDF, &HFF, &H23 '##.#############..#...##
Data &HBF, &HFF, &H21 '#.##############..#....#
Data &H00, &H7F, &HA0 '.........########.#.....
Data &H00, &HFF, &HE0 '........###########.....
Data &H3F, &HEB, &HE0 '..#########.#.#####.....
Data &H3F, &HC9, &HE0 '..########..#..####.....
Data &H37, &H88, &HDE '..##.####...#...##.####.
Data &H00, &H1F, &HBF '...........######.######
Data &H00, &H08, &H3F '............#.....######
Data &H30, &H08, &H3F '..##........#.....######
Data &H38, &H08, &H3F '..###.......#.....######
Data &H3C, &H08, &H1E '..####......#......####.
Data &H3E, &H08, &H00 '..#####.....#...........
Data &H3E, &H3E, &H00 '..#####...#####.........
Data &H3C, &H3E, &H00 '..####....#####.........
Data &H38, &H3E, &H00 '..###.....#####.........
Data &HB3, &H3E, &H01 '#.##..##..#####........#
Data &HC0, &H1C, &H03 '##.........###........##
Data &H66, &HC8, &H06 '.##..##.##..#........##.
Data &H30, &HC0, &H0C '..##....##..........##..
Data &H18, &H00, &H18 '...##..............##...
' Frame 7
' Delay : 100ms
Data &H18, &H10, &H18 '...##......#.......##...
Data &H30, &H0F, &HEC '..##........#######.##..
Data &H6F, &HFC, &H26 '.##.##########....#..##.
Data &HDF, &HFF, &H23 '##.#############..#...##
Data &HBF, &HFF, &H21 '#.##############..#....#
Data &H00, &H7F, &HA0 '.........########.#.....
Data &H00, &HFF, &HE0 '........###########.....
Data &H3F, &HEB, &HE0 '..#########.#.#####.....
Data &H3F, &HC9, &HE0 '..########..#..####.....
Data &H37, &H88, &HDE '..##.####...#...##.####.
Data &H00, &H1F, &HBF '...........######.######
Data &H00, &H08, &H3F '............#.....######
Data &H30, &H08, &H3F '..##........#.....######
Data &H38, &H08, &H3F '..###.......#.....######
Data &H3C, &H08, &H1E '..####......#......####.
Data &H3E, &H08, &H00 '..#####.....#...........
Data &H3E, &H3E, &H00 '..#####...#####.........
Data &H3C, &H3E, &H00 '..####....#####.........
Data &H38, &H3E, &H00 '..###.....#####.........
Data &HBC, &H3E, &H01 '#.####....#####........#
Data &HC0, &H1C, &H03 '##.........###........##
Data &H7B, &H08, &H06 '.####.##....#........##.
Data &H33, &H00, &H0C '..##..##............##..
Data &H18, &H00, &H18 '...##..............##...
' Frame 8
' Delay : 100ms
Data &H18, &H10, &H18 '...##......#.......##...
Data &H30, &H0F, &HEC '..##........#######.##..
Data &H6F, &HFC, &H26 '.##.##########....#..##.
Data &HDF, &HFF, &H23 '##.#############..#...##
Data &HBF, &HFF, &H21 '#.##############..#....#
Data &H00, &H7F, &HA0 '.........########.#.....
Data &H00, &HFF, &HE0 '........###########.....
Data &H3F, &HEB, &HE0 '..#########.#.#####.....
Data &H3F, &HC9, &HE0 '..########..#..####.....
Data &H37, &H88, &HDE '..##.####...#...##.####.
Data &H00, &H1F, &HBF '...........######.######
Data &H00, &H08, &H3F '............#.....######
Data &H30, &H08, &H3F '..##........#.....######
Data &H38, &H08, &H3F '..###.......#.....######
Data &H3C, &H08, &H1E '..####......#......####.
Data &H3E, &H08, &H00 '..#####.....#...........
Data &H3E, &H3E, &H00 '..#####...#####.........
Data &H3C, &H3E, &H00 '..####....#####.........
Data &H38, &H3E, &H00 '..###.....#####.........
Data &HB0, &H3E, &H01 '#.##......#####........#
Data &HF0, &H1C, &H03 '####.......###........##
Data &H70, &H08, &H06 '.###........#........##.
Data &H30, &H00, &H0C '..##................##..
Data &H18, &H00, &H18 '...##..............##...
Cara Disable IIS saat startup pada Windows 7
Cari World Wide Web Publishing Service lalu klik kanan pada World Wide Web Publishing Service tersebut lalu pilih Properties
Di bawah tab General, pada Startup Type pilih Manual.
Klik OK dan sekarang setelah restart IIS tidak akan langsung start. Jika Anda ingin menjalankan, maka jalankan secara manual.
Apa Itu WEP, WPA, WPA2, TKIP ?
WEP merupakan standart keamanan & enkripsi pertama yang digunakan pada wireless, WEP (Wired
Equivalent Privacy) adalah suatu metoda pengamanan jaringan nirkabel, disebut juga dengan Shared Key Authentication. Shared Key Authentication adalah metoda otentikasi yang membutuhkan penggunaan WEP.
- Client meminta asosiasi ke access point, langkah ini sama seperti Open System Authentication.
- Access point mengirimkan text challenge ke client secara transparan.
- Client akan memberikan respon dengan mengenkripsi text challenge dengan menggunakan kunci WEP dan mengirimkan kembali ke access point.
- Access point memberi respon atas tanggapan client, akses point akan melakukan decrypt terhadap respon enkripsi dari client untuk melakukan verifikasi bahwa text challenge dienkripsi dengan menggunakan WEP key yang sesuai. Pada proses ini, access point akan menentukan apakah client sudah memberikan kunci WEP yang sesuai. Apabila kunci WEP yang diberikan oleh client sudah benar, maka access point akan merespon positif dan langsung meng-authentikasi client. Namun bila kunci WEP yang dimasukkan client adalah salah, maka access point akan merespon negatif dan client tidak akan diberi authentikasi. Dengan demikian, client tidak akan terauthentikasi dan tidak terasosiasi.
- Masalah kunci yang lemah, algoritma RC4 yang digunakan dapat dipecahkan.
- WEP menggunakan kunci yang bersifat statis
- Masalah initialization vector (IV) WEP
- Masalah integritas pesan Cyclic Redundancy Check (CRC-32)
Serangan-serangan pada kelemahan WEP antara lain :
- Serangan terhadap kelemahan inisialisasi vektor (IV), sering disebut FMS attack. FMS singkatan dari nama ketiga penemu kelemahan IV yakni Fluhrer, Mantin, dan Shamir. Serangan ini dilakukan dengan cara mengumpulkan IV yang lemah sebanyak-banyaknya. Semakin banyak IV lemah yang diperoleh, semakin cepat ditemukan kunci yang digunakan
- Mendapatkan IV yang unik melalui packet data yang diperoleh untuk diolah untuk proses cracking kunci WEP dengan lebih cepat. Cara ini disebut chopping attack, pertama kali ditemukan oleh h1kari. Teknik ini hanya membutuhkan IV yang unik sehingga mengurangi kebutuhan IV yang lemah dalam melakukan cracking WEP.
- Kedua serangan diatas membutuhkan waktu dan packet yang cukup, untuk mempersingkat waktu, para hacker biasanya melakukan traffic injection. Traffic Injection yang sering dilakukan adalah dengan cara mengumpulkan packet ARP kemudian mengirimkan kembali ke access point. Hal ini mengakibatkan pengumpulan initial vektor lebih mudah dan cepat. Berbeda dengan serangan pertama dan kedua, untuk serangan traffic injection,diperlukan spesifikasi alat dan aplikasi tertentu yang mulai jarang ditemui di toko-toko, mulai dari chipset, versi firmware, dan versi driver serta tidak jarang harus melakukan patching terhadap driver dan aplikasinya. sumber
Wireless Apliccation Protokol disingkat WAP adalah standar internasional terbuka untuk aplikasi yang menggunakan komunikasi nirkabel. Tujuan utamanya untuk membangun aplikasi yang dapat mengakses internet dari telepon genggam atau PDA.
Standar protokol untuk aplikasi wireless (seperti yang digunakan pada ponsel). WAP adalah sebuah protocol atau sebuah teknik messaging service yang memungkinkan sebuah hp digital atau terminal mobile yang mempunyai fasilitas WAP, melihat/membaca isi sebuah situs di internet dalam sebuah format text khusus. Situs internet ini harus merupakan situs dengan fasilitas WAP.
WPA2 adalah sertifikasi produk yang tersedia melalui Wi-Fi Alliance. WPA2 Sertifikasi hanya menyatakan bahwa peralatan nirkabel yang kompatibel dengan standar IEEE 802.11i. WPA2 sertifikasi produk yang secara resmi menggantikan wired equivalent privacy (WEP) dan fitur keamanan lain yang asli standar IEEE 802.11. WPA2 tujuan dari sertifikasi adalah untuk mendukung wajib tambahan fitur keamanan standar IEEE 802.11i yang tidak sudah termasuk untuk produk-produk yang mendukung WPA. sumber
Dalam dunia komputer, TKIP atau Temporal Key Integrity Protocol adalah sebuah protokol yang didefinisikan oleh IEEE 802.11i yang mengkhususkan untuk jaringan nirkabel untuk menggantikan WEP. TKIP didesain untuk menggantikan WEP tanpa mengubah / mengganti perangkat keras. Hal ini diperlukan karena “buruknya” jenis pengamanan WEP meninggalkan jaringan nirkabel tanpa aktif mengamankan link-layer. Solusi untuk masalah ini tidak akan menunggu untuk menggantikan manfaat dari perangkat keras. Untuk alasan tersebut, TKIP (Baca: tee-kip), seperti WEP, menggunakan skema kunci berdasarkan RC4, tetapi tidak seperti WEP, TKIP meng-enkripsi semua paket data yang dikirimkan dengan kunci enkripsi yang unik nya itu sendiri.
Simulator Arduino Gratis
Windows simulasi bebas dari Arduino Uno
Sesampai di sana, tidak mengandalkan intuisi dan pengalaman untuk melakukan download. Mencatat saran sebagai berikut ...
Membuat radio FM dengan Arduino dan Nokia 5110
di bawah ini ada bebrapa komponen serta program yang disiapkan untuk pembuatan radio ini antara lain :
1. Modul Arduino UNO
2. TEA 5767
3. LCD Nokia 5110
4 Rangkaian lengkap dengan Firtsing
5 Sketch
// TEA5767 und Nokia 5110 LCD Display
#include
#include
#include
#include
// D3 - Serial clock out (CLK oder SCLK)
// D4 - Serial data out (DIN)
// D5 - Data/Command select (DC oder D/C)
// D6 - LCD chip select (CE oder CS)
// D7 - LCD reset (RST)
Adafruit_PCD8544 lcd = Adafruit_PCD8544(3,4,5,6,7);
#define button_frequency_up 13
#define button_frequency_down 12
#define button_mute 11
#define TEA5767_mute_left_right 0x06
#define TEA5767_MUTE_FULL 0x80
#define TEA5767_ADC_LEVEL_MASK 0xF0
#define TEA5767_STEREO_MASK 0x80
int old_frequency=-1;
int frequency=9000; //frekuensi default
byte old_stereo=0;
byte stereo=1;
byte old_mute=1;
byte mute=0;
byte old_signal_level=1;
byte signal_level=0;
unsigned long last_pressed;
void setup(void) {
pinMode(button_frequency_up, INPUT);
pinMode(button_frequency_down, INPUT);
pinMode(button_mute, INPUT);
Wire.begin();
TEA5767_set_frequency();
lcd.begin();
lcd.setContrast(60);
lcd.clearDisplay();
set_text(1,2,"FM Radio",BLACK,1);
//set_text(14,147,"blog.simtronyx.de",BLACK,1);
}
void loop() {
if(frequency!=old_frequency){
set_text(old_frequency>=10000?6:14,17,value_to_string(old_frequency),WHITE,2);
set_text(frequency>=10000?6:14,17,value_to_string(frequency),BLACK,2);
old_frequency=frequency;
}
TEA5767_read_data();
if(old_stereo!=stereo){
set_text(old_stereo?22:28,39,old_stereo?"Stereo":"Mono",WHITE,1);
set_text(stereo?22:28,39,stereo?"Stereo":"Mono",BLACK,1);
old_stereo=stereo;
}
if(old_signal_level!=signal_level){
set_text(old_signal_level<10 br="" int="" old_signal_level="" tring=""> set_text(signal_level<10 br="" int="" signal_level="" tring=""> old_signal_level=signal_level;
show_signal_level(signal_level);
}
if(old_mute!=mute){
set_text(1,39,old_mute?"M":"S",WHITE,1);
set_text(1,39,mute?"M":"S",BLACK,1);
old_mute=mute;
}
delay(50);
if(digitalRead(button_frequency_down)==HIGH){
frequency=frequency-5;
if(frequency<8750 frequency="10800;<br"> TEA5767_set_frequency();
}
if(digitalRead(button_frequency_up)==HIGH){
frequency=frequency+5;
if(frequency>10800)frequency=8750;
TEA5767_set_frequency();
}
if(digitalRead(button_mute)==HIGH){
TEA5767_mute();
}
delay(50);
}
unsigned char frequencyH = 0;
unsigned char frequencyL = 0;
unsigned int frequencyB;
unsigned char TEA5767_buffer[5]={0x00,0x00,0xB0,0x10,0x00};
void TEA5767_write_data(byte data_size){
delay(50);
Wire.beginTransmission(0x60);
for(byte i=0;i
Wire.endTransmission();
delay(50);
}
void TEA5767_mute(){
if(!mute){
mute = 1;
TEA5767_buffer[0] |= TEA5767_MUTE_FULL;
TEA5767_write_data(2);
// TEA5767_buffer[0] &= ~TEA5767_mute;
// TEA5767_buffer[2] |= TEA5767_mute_left_right;
}
else{
mute = 0;
TEA5767_buffer[0] &= ~TEA5767_MUTE_FULL;
TEA5767_write_data(2);
// TEA5767_buffer[0] |= TEA5767_mute;
// TEA5767_buffer[2] &= ~TEA5767_mute_left_right;
}
// TEA5767_write_data(3);
}
void TEA5767_set_frequency()
{
frequencyB = 4 * (frequency * 10000 + 225000) / 32768;
TEA5767_buffer[0] = frequencyB >> 8;
if(mute)TEA5767_buffer[0] |= TEA5767_MUTE_FULL;
TEA5767_buffer[1] = frequencyB & 0XFF;
TEA5767_write_data(5);
}
int TEA5767_read_data() {
unsigned char buf[5];
memset (buf, 0, 5);
Wire.requestFrom (0x60, 5);
if (Wire.available ()) {
for (int i = 0; i < 5; i++) {
buf[i] = Wire.read ();
}
stereo = (buf[2] & TEA5767_STEREO_MASK)?1:0;
signal_level = ((buf[3] & TEA5767_ADC_LEVEL_MASK) >> 4);
return 1;
}
else return 0;
}
void show_signal_level(int level){
byte xs=68;
byte ys=8;
for(int i=0;i<15 br="" i=""> if(i%2!=0)lcd.drawLine(xs+i,ys,xs+i,ys-i/2,level>=i?BLACK:WHITE);
}
}
void set_text(int x,int y,String text,int color,int textsize){
lcd.setTextSize(textsize);
lcd.setTextColor(color);
lcd.setCursor(x,y);
lcd.println(text);
lcd.display();
}
String value_to_string(int value){
String value_string = String(value / 100);
value_string = value_string + '.' + ((value%100<10 100="" br="" value=""> return value_string;
}10>15>
Membuat Radio Digital FM Stereo dng Arduino
Bahan yanh diperlukan antara lain :
1. Modul Arduino UNO R3
2. LCD 16x2 warna terserah anda
3. 2 Push Button untuk seting radio
4. 2 LED indikator Flashing dan Alarm
5. 4 Resistor 1K
6. 2 Resistor 220 Ohm
7. Modul Tuner TEA5767
8. IC24C04 untuk menyimpan data memory
9. Kabel jumper secukupnya
Modul Arduino UNO R3
Modul FM TEA5767
LCD 16x2
Block TEA5767 dengan memori
Rangkaiannya :
Skema belum jadi donk :
Source Kodenya Ini Lho :
// Membuat Jam dan Radio FM TEA5767
// LIKNO01
// Programmer Suparno, S.Pd, M.Pd
// 24/01/2015
#include < avr/io.h>
#include < avr/interrupt.h>
#include < LiquidCrystal.h>
#include < Wire.h>
#include < EEPROM.h>
#define debug 0
byte LedPin=8;
byte LedPin2=9;
byte e1Pin=12;
byte e2Pin=13;
byte jam,menit,detik;
byte Ajam,Amenit,Adetik;
byte flag=1;
int sleep;
byte alarm; //0-1 alarm ON, 3-alarm OFF
char VARI[20];
int z,zz;
byte bz;
unsigned char frequencyH = 0;
unsigned char frequencyL = 0;
unsigned int frequencyB;
double frequency = 0;
byte bfrequency;
double gfrequency;
byte rdata[7];
byte signal;
int reading;
char *menu[]={" ","SLEEP","MODE_MEMO","MODE_SCAN","MODE_DIAL","ALARM","MEMORY","LEVEL-SCAN","TIME"};
char *menu1[]={" ","DIAL","CH: ","SCAN"};//mymode
byte bmemory;
byte memo;
byte mymenu;
byte mymode;
byte mylevel;
byte flag2;
LiquidCrystal lcd(7,6,5,4,3,2);
void setup(){
Serial.begin(9600);
lcd.begin(16, 4);
Wire.begin();
pinMode(LedPin, OUTPUT);
pinMode(LedPin2, OUTPUT);
pinMode(e1Pin, INPUT);
pinMode(e2Pin, INPUT);
//==================================
lcd.setCursor(-4,2);
lcd.print("Radio FM Mikro");
lcd.setCursor(-4,3);
lcd.print("Prog. : Suparno");
//==================================
cli();
TCCR1A=0;
TCCR1B=0;
OCR1A=15624;
TCCR1B |= (1<
mymenu=0;
mymode=2; //si queremos que cuando se encienda la radio este en modo Dial poner 1
mylevel=2;
sleep=0;
alarm=3;
memo=0;
flag2=0;
bfrequency = EEPROM.read(0);
frequency=875+bfrequency; //aslinya :875
frequency/=10;
setFrequency();
}
void loop()
{
if(!digitalRead(e1Pin))
{
mymenu++;
if(mymenu>8)mymenu=0;
lcd.clear();
lcd.setCursor(0,0);
lcd.print(menu[mymenu]);
if(flag2==1)mymenu=0;
flag2=0;
delay(100);
while(!digitalRead(e1Pin));
}
switch(mymenu)
{
case 0:
switch(mymode)
{
case 1:
reading = analogRead(0);
frequency = ((double)reading * (108.0 - 87.5)) / 1024.0 + 87.5;
frequency = ((double)reading * 20.5) / 1024.0 + 87.5;
frequency = ((int)(frequency * 10)) / 10.0;
setFrequency();
if(!digitalRead(e2Pin))
{
if(debug)Serial.println(bfrequency);
while(!digitalRead(e2Pin));
}
break;
case 2:
if(!digitalRead(e2Pin))
{
memo++;
if(memo>19)memo=0;
bfrequency = EEPROM.read(memo);
frequency=875+bfrequency;
frequency/=10;
setFrequency();
while(!digitalRead(e2Pin));
}
break;
case 3:
if(!digitalRead(e2Pin))
{
menuScan();
while(!digitalRead(e2Pin));
}
break;
}
lcd.setCursor(0,0);
lcd.print(frequency);
lcd.print(" MHz ");
if(flag)
{
flag=0;
if(alarm==1) { sleep=10; alarm=0;}
if(sleep<1 br=""> {
digitalWrite(LedPin2,LOW);
lcd.setCursor(12,0);
lcd.print("OFF ");
}
else
{
if(!digitalRead(LedPin2))
{
digitalWrite(LedPin2,HIGH);
delay(500);
setFrequency();
delay(500);
setFrequency();
}
getDatos();
signal=rdata[4] >> 4;
lcd.setCursor(12,0);
if(detik & 2)
{
lcd.print("Pw");
lcd.print(signal);
lcd.print(" ");
}
else
{
if(rdata[3] & 128)
lcd.print("STE ");
else
lcd.print("MONO");
}
}
lcd.setCursor(0,1);
lcd.print(menu1[mymode]);
if(mymode==2)
{
lcd.print(memo);
lcd.print(" ");
}
lcd.setCursor(6, 1);
if(alarm==3)
lcd.print(" ");
else
lcd.print("A");
digitalWrite(LedPin, !digitalRead(LedPin));
sprintf(VARI,"%02d:%02d:%02d",jam,menit,detik);
if(debug)Serial.println(VARI);
lcd.setCursor(8, 1);
lcd.print(VARI);
}
break;
case 1:
lcd.setCursor(0,1);
lcd.print(sleep);
lcd.print(" menit ");
if(!digitalRead(e2Pin))
{
if(sleep>11)
sleep-=10;
else
sleep--;
if(sleep<0 sleep="60;<br"> flag2=1;
while(!digitalRead(e2Pin));
}
break;
case 2:
if(!digitalRead(e2Pin))
{
mymode=2;
mymenu=0;
bfrequency = EEPROM.read(memo);
frequency=875+bfrequency;
frequency/=10;
setFrequency();
while(!digitalRead(e2Pin));
}
break;
case 3:
if(!digitalRead(e2Pin))
{
mymode=3;
mymenu=0;
while(!digitalRead(e2Pin));
}
break;
case 4:
if(!digitalRead(e2Pin))
{
mymode=1;
mymenu=0;
while(!digitalRead(e2Pin));
}
break;
case 5:
sprintf(VARI,"%02d:%02d",Ajam,Amenit);
lcd.setCursor(0, 1);
lcd.print(VARI);
if(!digitalRead(e2Pin))
{
menuAlarm();
mymenu=0;
lcd.clear();
while(!digitalRead(e2Pin));
}
break;
case 6:
if(!digitalRead(e2Pin))
{
menuMemory();
while(!digitalRead(e2Pin));
lcd.clear();
mymenu=0;
}
break;
case 7:
lcd.setCursor(0,1);
lcd.print(mylevel);
if(!digitalRead(e2Pin))
{
mylevel++; if(mylevel>3)mylevel=1;
flag2=1;
while(!digitalRead(e2Pin));
}
break;
case 8:
sprintf(VARI,"%02d:%02d",jam,menit);
lcd.setCursor(0, 1);
lcd.print(VARI);
if(!digitalRead(e2Pin))
{
menuTime();
mymenu=0;
lcd.clear();
while(!digitalRead(e2Pin));
}
break;
}
}
void calculo()
{
bfrequency=frequency*10-875;
frequencyB = 4 * (frequency * 1000000 + 225000) / 32768;
frequencyH = frequencyB >> 8;
frequencyL = frequencyB & 0XFF;
}
void menuMemory()
{
lcd.setCursor(0,1);
lcd.print(memo);
lcd.setCursor(8,0);
lcd.print(frequency);
delay(500);
while(1)
{
if(!digitalRead(e2Pin))
{
memo++;
if(memo>19)memo=0;
lcd.setCursor(0,1);
lcd.print(memo);
lcd.print(" ");
while(!digitalRead(e2Pin));
}
if(!digitalRead(e1Pin))
{
if(debug)Serial.println(memo);
if(debug)Serial.println(bfrequency);
EEPROM.write(memo,bfrequency );
while(!digitalRead(e1Pin));
return;
}
}
}
void menuScan()
{
delay(100);
frequency+=0.1;
if(frequency>108)frequency=88.5;
calculo();
bz=mylevel<<5 br=""> bz=bz | 0x90;
Wire.beginTransmission(0x60);
Wire.write(frequencyH+0x40);
Wire.write(frequencyL);
Wire.write(bz);
Wire.write(0x1F);
Wire.write((byte)0x00);
Wire.endTransmission();
delay(100);
getDatos();
gfrequency=(((rdata[1]&0x3F)<<8 br="" rdata=""> if(debug)for (int i=1; i<6 br="" i="" rdata="" serial.println=""> frequency=gfrequency/10000;
if(debug)Serial.println(frequency);
z=frequency;
zz=z+5; z/=10; zz/=10;
if(debug)Serial.println(z);
if(debug)Serial.println(zz);
if(zz>z)
frequency=zz;
else
frequency=z;
frequency/=10;
if(debug)Serial.println(frequency);
calculo();
delay(100);
Wire.beginTransmission(0x60);
Wire.write(frequencyH);
Wire.write(frequencyL);
Wire.write(0xB0);
Wire.write(0x1F);
Wire.write((byte)0x00);
Wire.endTransmission();
delay(100);
}
void menuAlarm()
{
while(1)
{
lcd.setCursor(0,1);
lcd.print("Alarm ");
if(alarm==3)
lcd.print("OFF");
else
lcd.print("ON ");
if(!digitalRead(e2Pin))
{
if(alarm==3)
alarm=0;
else
alarm=3;
while(!digitalRead(e2Pin));
}
if(!digitalRead(e1Pin))
{
while(!digitalRead(e1Pin));
break;
}
}
while(1)
{
lcd.setCursor(0,1);
lcd.print("Hours ");
lcd.print(Ajam);
lcd.print(" ");
if(!digitalRead(e2Pin))
{
Ajam++;
if(Ajam==24)Ajam=0;
while(!digitalRead(e2Pin));
}
if(!digitalRead(e1Pin))
{
while(!digitalRead(e1Pin));
break;
}
}
while(1)
{
lcd.setCursor(0,1);
lcd.print("Minutes ");
lcd.print(Amenit);
lcd.print(" ");
if(!digitalRead(e2Pin))
{
Amenit++;
Adetik=0;
if(Amenit==60)Amenit=0;
while(!digitalRead(e2Pin));
}
if(!digitalRead(e1Pin))
{
while(!digitalRead(e1Pin));
break;
}
}
}
void menuTime()
{
while(1)
{
lcd.setCursor(0,1);
lcd.print("Hours ");
lcd.print(jam);
lcd.print(" ");
if(!digitalRead(e2Pin))
{
jam++;
if(jam==24)jam=0;
while(!digitalRead(e2Pin));
}
if(!digitalRead(e1Pin))
{
while(!digitalRead(e1Pin));
break;
}
}
while(1)
{
lcd.setCursor(0,1);
lcd.print("Minutes ");
lcd.print(menit);
lcd.print(" ");
if(!digitalRead(e2Pin))
{
menit++;
detik=0;
if(menit==60)menit=0;
while(!digitalRead(e2Pin));
}
if(!digitalRead(e1Pin))
{
while(!digitalRead(e1Pin));
break;
}
}
}
void setFrequency()
{
calculo();
//delay(100);
Wire.beginTransmission(0x60);
Wire.write(frequencyH);
Wire.write(frequencyL);
Wire.write(0xB0);
Wire.write(0x10);
Wire.write((byte)0x00);
Wire.endTransmission();
//delay(100);
}
void getDatos()
{
Wire.requestFrom(0x60,5); //reading TEA5767
if (Wire.available())
{
for (int i=1; i<6 br="" i="" rdata="" wire.read=""> }
}
ISR(TIMER1_COMPA_vect) //alarm yake
{
flag=1;
detik++;
if(detik>59)
{
detik=0;
menit++;
if(sleep>0)sleep--;
if(menit>59)
{
menit=0;
jam++;
if(jam>23)
{
detik=0;
menit=0;
jam=0;
}
}
}
if(alarm==0 && detik==0 && menit==Amenit && jam==Ajam)alarm=1;
}6>6>8>5>0>1>