Finally, my ambition project telah usai seiring project ini berakhir, kali ini saya akan menjelaskan mengenai bagaimana cara mengakses modul power line carrier KQ330 menggunakan mikrokontroller dan bahasa bascom avr. Sebelumnya apa itu power line carrier ??, PLC adalah sebuah sistem dimana kita bisa mengirimkan data dari master ke slave dalam satu line menggunakan tegangan 220VAC 50 Hz. jadi ini adalah inovasi terbaru dalam bidang elektronika, jika biasanya menggunakan kabel panjang dalam pengiriman data, sekarang bisa dengan mudah mengirimkan data melalui tegangan AC 220v 50 Hz. Aplikasi dari PLC ini yaitu misal dalam sebuah kantor terdapat lampu yang harus dikontrol melalui kontrol room, maka tidak perlu menggunakan kabel khusus yang terhubung ke kontroller, sambungkan saja kontroller ke PLC lalu PLC ke listrik 220V AC, di TKP terdapat kontroller penerima yang akan mematikan lampu sesuai perintah dari master / transmitter, itu hanya salah satu contoh saja, masih banyak lainnya. Untuk lebih jelasnya berikut skema dan programnya menggunakan bascom AVR.
a. Minimum System
b. Modul Power Line Carrier KQ330 / KQ 132K
d. Program Bascom AVR
'======================
' Program Master / Transmitter
'======================
$regfile = "m8def.dat"
$crystal = 12000000
$baud = 9600
Config Lcdpin = Pin , Rs = Portc.5 , E = Portc.4 , Db4 = Portc.3
Config Lcdpin = Pin , Db5 = Portc.2 , Db6 = Portc.1 , Db7 = Portc.0
Config Lcd = 16 * 2
Ddrb.0 = 0
Ddrb.1 = 0
Ddrb.2 = 0
Ddrd.7 = 0
Set Portb.0
Set Portb.1
Set Portb.2
Set Portd.7
Cls
Cursor Off
Do
Upperline
Lcd "Transmitter"
Lowerline
Lcd " 1 " ; " 2 " ; " 3 " ; " 4 "
If Pinb.0 = 0 Then
Cls
Do
Print "1"
Lowerline
Lcd "kirim data 1"
Loop Until Pind.7 = 0
Elseif Pinb.1 = 0 Then
Cls
Do
Print "2"
Lowerline
Lcd "kirim data 2"
Loop Until Pind.7 = 0
Elseif Pinb.2 = 0 Then
Do
Print "3"
Lowerline
Lcd "kirim data 3"
Loop Until Pind.7 = 0
Else
Lowerline
Print "0"
End If
Loop
$crystal = 12000000
$baud = 9600
Config Lcdpin = Pin , Rs = Portc.5 , E = Portc.4 , Db4 = Portc.3
Config Lcdpin = Pin , Db5 = Portc.2 , Db6 = Portc.1 , Db7 = Portc.0
Config Lcd = 16 * 2
Ddrb.0 = 0
Ddrb.1 = 0
Ddrb.2 = 0
Ddrd.7 = 0
Set Portb.0
Set Portb.1
Set Portb.2
Set Portd.7
Cls
Cursor Off
Do
Upperline
Lcd "Transmitter"
Lowerline
Lcd " 1 " ; " 2 " ; " 3 " ; " 4 "
If Pinb.0 = 0 Then
Cls
Do
Print "1"
Lowerline
Lcd "kirim data 1"
Loop Until Pind.7 = 0
Elseif Pinb.1 = 0 Then
Cls
Do
Print "2"
Lowerline
Lcd "kirim data 2"
Loop Until Pind.7 = 0
Elseif Pinb.2 = 0 Then
Do
Print "3"
Lowerline
Lcd "kirim data 3"
Loop Until Pind.7 = 0
Else
Lowerline
Print "0"
End If
Loop
'=========================
' Program Slave / Receiver 1 dan 2
'=========================
$regfile = "m16def.dat"
$crystal = 12000000
$baud = 9600
Config Lcdpin = Pin , Rs = Portc.0 , E = Portc.1 , Db4 = Portc.2
Config Lcdpin = Pin , Db5 = Portc.3 , Db6 = Portc.4 , Db7 = Portc.5
Config Lcd = 16 * 2
Ddrd.7 = 1
Ddrd.6 = 1
Ddrd.5 = 1
Ddrd.4 = 1
Dim Perintah As String * 1
Cls
Cursor Off
Upperline
Lcd "Receiver 1/2"
Do
Perintah = Waitkey()
Upperline
Lcd "Receiver 1/2"
Lowerline
Lcd "Data = " ; Perintah
Wait 1
Select Case Perintah
Case "0" :
Portd.7 = 0
Portd.6 = 0
Portd.5 = 0
Portd.4 = 0
Case "1" :
Portd.7 = 1
Portd.6 = 0
Portd.5 = 0
Portd.4 = 0
Case "2" :
Portd.7 = 0
Portd.6 = 1
Portd.5 = 0
Portd.4 = 0
Case "3" :
Portd.7 = 0
Portd.6 = 0
Portd.5 = 1
Portd.4 = 0
Case "0" :
Portd.7 = 0
Portd.6 = 0
Portd.5 = 0
Portd.4 = 1
End Select
Loop
$crystal = 12000000
$baud = 9600
Config Lcdpin = Pin , Rs = Portc.0 , E = Portc.1 , Db4 = Portc.2
Config Lcdpin = Pin , Db5 = Portc.3 , Db6 = Portc.4 , Db7 = Portc.5
Config Lcd = 16 * 2
Ddrd.7 = 1
Ddrd.6 = 1
Ddrd.5 = 1
Ddrd.4 = 1
Dim Perintah As String * 1
Cls
Cursor Off
Upperline
Lcd "Receiver 1/2"
Do
Perintah = Waitkey()
Upperline
Lcd "Receiver 1/2"
Lowerline
Lcd "Data = " ; Perintah
Wait 1
Select Case Perintah
Case "0" :
Portd.7 = 0
Portd.6 = 0
Portd.5 = 0
Portd.4 = 0
Case "1" :
Portd.7 = 1
Portd.6 = 0
Portd.5 = 0
Portd.4 = 0
Case "2" :
Portd.7 = 0
Portd.6 = 1
Portd.5 = 0
Portd.4 = 0
Case "3" :
Portd.7 = 0
Portd.6 = 0
Portd.5 = 1
Portd.4 = 0
Case "0" :
Portd.7 = 0
Portd.6 = 0
Portd.5 = 0
Portd.4 = 1
End Select
Loop
e. VIDEO HASILNYA
No comments:
Post a Comment