-
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.
Perintah DOS (Disk Operating System Command)
Mengembalikan Task Manager Windows
Bila komputer anda mengalami masalah Task Manager tidak bisa di ampilkan dan pada saat anda menekan CTRL + ALT + DEL (tanpa plus) muncul pesan seperti berikut
sudah tentu bahwa DWORD value dalam regedit yang bernilai 0 (nol) sudah di ubah menjadi 1 (satu), nah untuk mengembalikannya ikuti langkah-langkah atau tips dari belajar ilmu komputer berikut :
Langkah pertama
Ini dilakukan dengan asusmi bahwa komputer anda sudah terbebas dari virus (lakukan pembersihan virus pada komputer anda terlebih dahulu)
Masuk regedit dengan cara ketik regedit pada run menu, caranya klik start - run kemudian ketik regedit dan tekan Enter atau klik OK
Langkah kedua
Klik menu Edit kemudian pilih Find dan ketikkan kata DisableTaskMgr (penulisan tidak tegantung huruf kecil/besar) kemudian klik Find Next hingga menemukan data seperti berikut
bila sudah menemukan data seperti di atas maka ikuti langkah berikut ini
Langkah ketiga
Mengubah Value data DisableTaskMgr dengan cara double klik pada kata DisableTaskMgr dan ubah angka 1 (satu) menjadi 0 (nol) dan tekan ENTER atau klik OK dengan maksud agar Task Manager di enable kan
Langkah keempat
Tutup regedit dan coba tekan CTRL + ALT+ DEL (tanpa plus ya..)
Meski artikelnya singkat namun blog belajar ilmu komputer mengharapkan agar tips ini dapat membantu para pengunjung setia blog BIK Pemula.
Kontrol Motor Stepper
Code List :
ORG 0H JMP MAIN ORG 0BH JMP TMR0 OK EQU 7FH N1 EQU 7EH N2 EQU 7DH ; BA ARZESH TARIN N21 EQU 7CH DN EQU 7BH TMP EQU 7AH DHTMP EQU 79H DLTMP EQU 78H DTMP1 EQU 77H DTMP2 EQU 76H MDTMP1 EQU 75H MDTMP2 EQU 74H STEPM EQU 73H KEYNUM EQU 72H SROTATION BIT 2FH PKEY EQU P1 ORG 30H MAIN: MOV P0,#0H MOV IE,#82H MOV TMOD,#1H MOV N1,#0 MOV N2,#0 SETB TR0 CLR SROTATION MOV STEPM,#99H M1: CALL KEY JNB SROTATION,M1 CALL BCD2DEC M2: CALL ROTAION DJNZ N21,M2 CLR SROTATION JMP M1 ;--------------------------- ROTAION ROTAION: CALL MDELAY MOV A,STEPM RR A MOV P0,A MOV STEPM,A CALL MDELAY RET ;--------------------------- TIMER 0 TMR0: MOV TMP,A MOV DHTMP,DPH MOV DLTMP,DPL MOV TH0,#0ECH MOV TL0,#077H CLR TR0 CALL DISPLAY SETB TR0 MOV DPH,DHTMP MOV DPL,DLTMP MOV A,TMP RETI ;--------------------------- DISPALY DISPLAY: MOV DN,N1 CALL NUM2SEG MOV A,DN CPL A MOV P2,A SETB P3.7 CALL DELAY CLR P3.7 MOV DN,N2 CALL NUM2SEG MOV A,DN CPL A MOV P2,A SETB P3.6 CALL DELAY CLR P3.6 RET ;---------------------------KEYBOARD KEY: MOV PKEY,#0FH MOV A,PKEY ANL A,#0FH CJNE A,#0FH,KEY2 ;KEY1 JMP KFNL KEY2: CALL MDELAY MOV A,PKEY ANL A,#0FH CJNE A,#0FH,KEY3 JMP KFNL KEY3: MOV R0,#4 KEY31: RRC A JNC KEY4 DJNZ R0,KEY31 JMP KFNL KEY4: CJNE R0,#4,KEY42 MOV DPTR,#ROW_1 JMP KEY5 KEY42: CJNE R0,#3,KEY43 MOV DPTR,#ROW_2 JMP KEY5 KEY43: CJNE R0,#2,KEY44 MOV DPTR,#ROW_3 JMP KEY5 KEY44: CJNE R0,#1,KFNL MOV DPTR,#ROW_4 JMP KEY5 ;---------- KEY5: MOV PKEY,#0FFH MOV PKEY,#0F0H NOP NOP NOP NOP MOV A,PKEY SWAP A ANL A,#0FH MOV R0,#4 KEY51: RRC A JNC KEY6 DJNZ R0,KEY51 JMP KFNL KEY6: CJNE R0,#4,KEY61 JMP KEY7 KEY61: CJNE R0,#3,KEY62 INC DPTR JMP KEY7 KEY62: CJNE R0,#2,KEY63 INC DPTR INC DPTR JMP KEY7 KEY63: CJNE R0,#1,KFNL INC DPTR INC DPTR INC DPTR JMP KEY7 ;---------- KEY7: MOV A,#0 MOVC A,@A+DPTR MOV KEYNUM,A MOV A,#N2 ADD A,R1 MOV R0,A MOV @R0,KEYNUM KEY8: MOV PKEY,#0FH MOV A,PKEY CJNE A,#0FH,KEY8 INC R1 CJNE R1,#2,KFNL MOV R1,#0 SETB SROTATION JMP KFNL KFNL: RET ;------------------------------------------------ NUM2SEG:MOV DPTR,#TABLE MOV A,DN MOVC A,@A+DPTR MOV DN,A RET ;--------------------------- DELAY DELAY: MOV DTMP1,#25 DD2: MOV DTMP2,#25 DD1: DJNZ DTMP2,DD1 DJNZ DTMP1,DD2 RET ;--------------------------- MOTOR DELAY MDELAY: MOV MDTMP1,#50 MDD2: MOV MDTMP2,#250 MDD1: DJNZ MDTMP2,MDD1 DJNZ MDTMP1,MDD2 RET ;--------------------------- DED2DEC BCD2DEC: MOV B,#10 MOV A,N2 MUL AB ADD A,N1 ADD A,#1 MOV N21,A RET ;------------------------------------------------ TABLE: DB 3FH,06H,5BH,4FH,66H,6DH,7DH,27H,7FH,6FH,00H,80H,40H ;------------------------------------------------ ROW_1: DB 1,2,3 ROW_2: DB 4,5,6 ROW_3: DB 7,8,9 ROW_4: DB '*',0,'#' END
Membuat Control Relay dengan Atmega8
Code List :
$regfile = "m8def.dat" $crystal = 1000000 $hwstack = 64 $swstack = 64 $framesize = 64 Config Kbd = Portb , Debounce = 150 , Delay = 200 Config Portb = Input Config Portc = Output Config Portd = Output Dim A As Byte Speaker Alias Pinc.0 Main: Wait 1 Sound Speaker , 120 , 100 Sound Speaker , 120 , 80 Do A = Getkbd() A = Lookup(a , Read_key) If A < 12 Then Select Case A Case 0: Sound Speaker , 120 , 20 Goto Main0 Case 1: Sound Speaker , 120 , 20 Goto Main1 Case 2: Sound Speaker , 120 , 20 Goto Main2 Case 3: Sound Speaker , 120 , 20 Goto Main3 Case 4: Sound Speaker , 120 , 20 Goto Main4 Case 5: Sound Speaker , 120 , 20 Goto Main5 Case 6: Sound Speaker , 120 , 20 Goto Main6 Case 7: Sound Speaker , 120 , 20 Goto Main7 Case 8: Sound Speaker , 120 , 20 Goto Main8 Case 9: Sound Speaker , 120 , 20 Goto Main9 Case 11: Sound Speaker , 120 , 20 Goto Main11 Case 10: Sound Speaker , 120 , 20 Goto Main10 End Select End If Loop End '_______________________________________________________________________________ Read_key: Data 1 , 4 , 7 , 11 , 2 , 5 , 8 , 0 , 3 , 6 , 9 , 10 '_______________________________________________________________________________ Main0: A = Getkbd() A = Lookup(a , Read_key) If A < 12 Then Select Case A Case 0 To 9: Sound Speaker , 120 , 500 Case 11: Portc.5 = 1 Sound Speaker , 120 , 100 Sound Speaker , 120 , 80 Sound Speaker , 120 , 60 Goto Main Case 10: Portc.5 = 0 Sound Speaker , 120 , 60 Sound Speaker , 120 , 80 Sound Speaker , 120 , 100 Goto Main End Select End If jmp main0 Main1: A = Getkbd() A = Lookup(a , Read_key) If A < 12 Then Select Case A Case 0 To 9: Sound Speaker , 120 , 500 Case 11: Portc.4 = 1 Sound Speaker , 120 , 100 Sound Speaker , 120 , 80 Sound Speaker , 120 , 60 Goto Main Case 10: Portc.4 = 0 Sound Speaker , 120 , 60 Sound Speaker , 120 , 80 Sound Speaker , 120 , 100 Goto Main End Select End If jmp main1 Main2: A = Getkbd() A = Lookup(a , Read_key) If A < 12 Then Select Case A Case 0 To 9: Sound Speaker , 120 , 500 Case 11: Portc.3 = 1 Sound Speaker , 120 , 100 Sound Speaker , 120 , 80 Sound Speaker , 120 , 60 Goto Main Case 10: Portc.3 = 0 Sound Speaker , 120 , 60 Sound Speaker , 120 , 80 Sound Speaker , 120 , 100 Goto Main End Select End If jmp main2 Main3: A = Getkbd() A = Lookup(a , Read_key) If A < 12 Then Select Case A Case 0 To 9: Sound Speaker , 120 , 500 Case 11: Portc.2 = 1 Sound Speaker , 120 , 100 Sound Speaker , 120 , 80 Sound Speaker , 120 , 60 Goto Main Case 10: Portc.2 = 0 Sound Speaker , 120 , 60 Sound Speaker , 120 , 80 Sound Speaker , 120 , 100 Goto Main End Select End If jmp main3 Main4: A = Getkbd() A = Lookup(a , Read_key) If A < 12 Then Select Case A Case 0 To 9: Sound Speaker , 120 , 500 Case 11: Portc.1 = 1 Sound Speaker , 120 , 100 Sound Speaker , 120 , 80 Sound Speaker , 120 , 60 Goto Main Case 10: Portc.1 = 0 Sound Speaker , 120 , 60 Sound Speaker , 120 , 80 Sound Speaker , 120 , 100 Goto Main End Select End If jmp main4 Main5: A = Getkbd() A = Lookup(a , Read_key) If A < 12 Then Select Case A Case 0 To 9: Sound Speaker , 120 , 500 Case 11: Portd.0 = 1 Sound Speaker , 120 , 100 Sound Speaker , 120 , 80 Sound Speaker , 120 , 60 Goto Main Case 10: Portd.0 = 0 Sound Speaker , 120 , 60 Sound Speaker , 120 , 80 Sound Speaker , 120 , 100 Goto Main End Select End If jmp main5 'www.bargh20.com Main6: A = Getkbd() A = Lookup(a , Read_key) If A < 12 Then Select Case A Case 0 To 9: Sound Speaker , 120 , 500 Case 11: Portd.1 = 1 Sound Speaker , 120 , 100 Sound Speaker , 120 , 80 Sound Speaker , 120 , 60 Goto Main Case 10: Portd.1 = 0 Sound Speaker , 120 , 60 Sound Speaker , 120 , 80 Sound Speaker , 120 , 100 Goto Main End Select End If jmp main6 Main7: A = Getkbd() A = Lookup(a , Read_key) If A < 12 Then Select Case A Case 0 To 9: Sound Speaker , 120 , 500 Case 11: Portd.2 = 1 Sound Speaker , 120 , 100 Sound Speaker , 120 , 80 Sound Speaker , 120 , 60 Goto Main Case 10: Portd.2 = 0 Sound Speaker , 120 , 60 Sound Speaker , 120 , 80 Sound Speaker , 120 , 100 Goto Main End Select End If jmp main7 Main8: A = Getkbd() A = Lookup(a , Read_key) If A < 12 Then Select Case A Case 0 To 9: Sound Speaker , 120 , 500 Case 11: Portd.3 = 1 Sound Speaker , 120 , 100 Sound Speaker , 120 , 80 Sound Speaker , 120 , 60 Goto Main Case 10: Portd.3 = 0 Sound Speaker , 120 , 60 Sound Speaker , 120 , 80 Sound Speaker , 120 , 100 Goto Main End Select End If jmp main8 Main9: A = Getkbd() A = Lookup(a , Read_key) If A < 12 Then Select Case A Case 0 To 9: Sound Speaker , 120 , 500 Case 11: Portd.4 = 1 Sound Speaker , 120 , 100 Sound Speaker , 120 , 80 Sound Speaker , 120 , 60 Goto Main Case 10: Portd.4 = 0 Sound Speaker , 120 , 60 Sound Speaker , 120 , 80 Sound Speaker , 120 , 100 Goto Main End Select End If jmp main9 Main11: Wait 3 A = Getkbd() A = Lookup(a , Read_key) If A = 11 Then Sound Speaker , 120 , 100 Sound Speaker , 120 , 80 Sound Speaker , 120 , 60 Portc.5 = 1 Portc.4 = 1 Portc.3 = 1 Portc.2 = 1 Portc.1 = 1 Portd.0 = 1 Portd.1 = 1 Portd.2 = 1 Portd.3 = 1 Portd.4 = 1 Goto Main Else Goto Main End If Main10: Wait 3 A = Getkbd() A = Lookup(a , Read_key) If A = 10 Then Sound Speaker , 120 , 60 Sound Speaker , 120 , 80 Sound Speaker , 120 , 100 Portc.5 = 0 Portc.4 = 0 Portc.3 = 0 Portc.2 = 0 Portc.1 = 0 Portd.0 = 0 Portd.1 = 0 Portd.2 = 0 Portd.3 = 0 Portd.4 = 0 Goto Main Else Goto Main End If
Menampilkan data dari database ke Combo Box (PHP)
<select name="pilihan"> <option value="belum milih" selected>-Silahkan Pilih makanan Kesukaan Anda-</option> <option value="sate">Sate</option> <option value="soto">Soto</option> <option value="nasi goreng">Nasi Goreng</option> <option value="nasi pecel">Nasi Pecel</option> </select>
RESULT :
<?php $host = "localhost"; // db host $username = "root"; // db username $password = "123456"; // db password $db = "combo"; // db name // Melakukan koneksi ke database mysql_connect($host,$username,$password) or die("Koneksi gagal"); mysql_select_db($db) or die("Database tidak bisa dibuka"); ?>Tampil anggota ke combo :
<?php include"koneksi.php"; echo "<select name='anggota'>"; $tampil=mysql_query("SELECT * FROM anggota_ludruk ORDER BY id"); echo "<option value='belum milih' selected>- Pilih Anggota Ludruk -</option>"; while($w=mysql_fetch_array($tampil)) { echo "<option value=$w[nama] selected>$w[nama]</option>"; } echo "</select>"; ?>Result :
Membuat User Online Sederhana Pada Halaman Website (PHP)
- Bagian Login, yang berfungsi untuk mengetahui siapa yang boleh mengakses aplikasi tsb, apakah user atau bukan. Disini juga akan dilakukan pencocokan user-id dan password user.
- Bagian User Log, Apabila berhasil melewati bagian pertama, data user akan di simpan ke dalam basis data (data yang di simpan meliputi : jam login, hari atau tanggal login, nama user, dan status login). Status login inilah yang saya istilahkan parameter baru.
- Bagian Penampil, Berfungsi untuk menampilkan siapa saja user yang sedang mengakses sistem (user online) mengacu pada status user.
Step 1
Buat Database dan Tabel-nya, seperti gambar berikut (hanya contoh) :
Database Name : user_online ; Tabel Name : user & log
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <script language="javascript"> function validasi(form){ if (form.username.value == ""){ alert("Anda belum mengisikan Username."); form.username.focus(); return (false); } if (form.password.value == ""){ alert("Anda belum mengisikan Password."); form.password.focus(); return (false); } return (true); } </script> <meta http-equiv="content-type" content="text/html;charset=UTF-8"> <head> <title>LOGIN</title> </head> <body> <form name="login" action="cek_login.php" method="POST" onSubmit="return validasi(this)"> <br /><br /><br /><br /> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><div align="center"> <table cellpadding="0" cellspacing="0"> <tr> <td height="25">Username :</td> <td> <input type="text" name="username" /></td></tr> <tr><td height="30">Password :</td> <td> <input type="password" name="password" /></td></tr> <tr><td colspan="2"><div align="right"> <input name="submit" type="submit" value="LOGIN" /></div></td> </tr> </table> </div> </td> </tr> </table> </form> </body> </html>Step 3
Membuat koneksi ke database (koneksi.php)
Source Code :
<?php // -- Host, Username dan Password Database $host = "localhost";//db-host $username = "root";//db-user $password = "123456";//db-password $db = "user_online";//db-name // Melakukan koneksi ke database mysql_connect($host,$username,$password) or die("Koneksi gagal"); mysql_select_db($db) or die("Database tidak bisa dibuka"); ?>Step 4
Proses Validasi / Pencocokan data user & password ke Database (cek_login.php)
Source Code :
<?php include "koneksi.php"; function antiinjection($data){ $filter_sql = mysql_real_escape_string(stripslashes(strip_tags(htmlspecialchars($data,ENT_QUOTES)))); return $filter_sql; } $username = antiinjection($_POST[username]); $pass = antiinjection($_POST[password]); $login=mysql_query("SELECT * FROM user WHERE username='$username' AND password='$pass'"); $ketemu=mysql_num_rows($login); $r=mysql_fetch_array($login); // Apabila username dan password ditemukan if ($ketemu > 0) { session_start(); session_register("username"); session_register("password"); $_SESSION[username] = $r[username]; $_SESSION[password] = $r[password]; $jam = date("H:i:s"); $tgl = date("Y-m-d"); mysql_query("INSERT INTO log(username, tanggal, jamin, jamout, status) VALUES('$_SESSION[username]', '$tgl', '$jam', 'logged', 'online')"); header('location:home.php'); } else { echo "<center><br><br><br><br><br><br><b>LOGIN GAGAL! </b><br> Username atau Password Anda tidak benar.<br>"; echo "<br>"; echo "<input type=button value='ULANGI LAGI' onclick=location.href='index.php'></a></center>"; } ?>Step 5
Proses selanjutnya bila login berhasil (home.php)
Source Code :
<?php include "koneksi.php"; session_start(); if (empty($_SESSION[username]) AND empty($_SESSION[password])) { header('location:index.php'); } else { ?> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>HOME</title> <style> th{ color: #FFFFFF; font-size: 8pt; text-transform: uppercase; text-align: center; padding: 0.1em; border-width: 1px; border-style: solid; border-color: #969BA5; border-collapse: collapse; background-color: #265180; } </style> </head> <body> <?php echo" <center>USER ONLINE <table border=1 width='650' align=center> <tr><th>No</th><th>Username</th><th>Tanggal Login</th><th>Jam Login</th><th>Jam Logout</th><th>Status</th></tr>"; $sql = mysql_query("SELECT * FROM log ORDER BY no DESC"); $no=1; while($d=mysql_fetch_array($sql)) { echo "<tr><td align=center>$no</td> <td align=center>$d[username]</td> <td align=center>$d[tanggal]</td> <td align=center>$d[jamin]</td> <td align=center>$d[jamout]</td>"; if($d[status]=='offline') { echo"<td style='background-color:red' align=center>OFFLINE</td>"; } else { echo"<td style='background-color:00ff00' align=center>ONLINE</td>"; } echo"</tr>"; $no++; } echo "</table>"; echo "<br /><br /><input type=button value='LOGOUT' onclick=location.href='logout.php'></a></center>"; ?> </body> </html> <?php } ?>
Step 6
Proses keluar / Logout (logout.php)
Source Code :
<?php include "koneksi.php"; $jam = date("H:i:s"); session_start(); mysql_query("UPDATE log SET jamout='$jam', status='offline' WHERE username = '$_SESSION[username]' AND jamout='logged' AND status='online'"); session_destroy(); header('location:index.php'); ?>Tamat ¦..
Pada aplikasi diatas masih memiliki beberapa kekurangan, mohon koreksi dari kawan-kawan dan para pembaca yang budiman. Saran kedepannya untuk user online ini akan lebih baik lagi apabila dipadukan dengan AJAX, sehingga user yang baru melakukan proses login dapat diketahui langsung tanpa me-reload atau me-refresh halaman website tersebut.
Bilingual Website (PHP & MySQL)
Gambar 1. Widget Google Translate
Diartikel edisi ini saya hanya ingin sekedar share tentang pembuatan website dwi bahasa tersebut. Sebenarnya tidak harus dwi bahasa sih, cm sebagai contoh aja biar ga banyak-banyak bikinnya. Mau pake multi bahasa juga gpp, sama aja prosesnya. Tetapi disini saya memberi contoh yang sangat sederhana sekali lho, mungkin kalau kita terapkan pada website yang komplek tentu kurang effisien. Yaaaah, namanya mencoba kan ga ada salahnya daripada tidak sama sekali.
Ok, kita mulai saja daripada banyak bicara kayak koruptor….hehehe..
Biar beda ama bahasa-bahasa yang tersedia di widget nya si-mbah google, kali ini kita akan membuat sebuah halaman website sederhana dimana terdapat 2 pilihan bahasa yang tersedia, yaitu : Bahasa Indonesia dan Bahasa Jawa. Demonya bisa kawan lihat pada tautan berikut :
Source Code : <?php session_register('bahasa'); include "koneksi.php"; if($_GET['lang']) { $_SESSION['bahasa']=$_GET['lang']; header('location:index.php'); } else { if(!$_SESSION['bahasa']) { $_SESSION['bahasa']='indonesia'; header('location:index.php'); } } include "".$_SESSION['bahasa'].".php"; ?>
Source code diatas merupakan bagian inti yang berfungsi untuk SWITCHING. Hah?? istilah apa lagi tuh ??? itu istilah saya sendiri alias ngawur.com. hahahaha…. Tetapi pada intinya code diatas berfungsi untuk proses peralihan dari bahasa satu ke bahasa lainnya dengan memanfaatkan session.
Ok, dech ga perlu panjang lebar langsung aja download Full Source Code nya Di SINI
Soalnya kalo Sorce nya di tulis semua disini jadi panjang dehhh artikel nya….hahahaha
-Selesai-
Widget Setup for Blogger
Step 1.
Get your widget code
Go to your Blog's profile on NetworkedBlogs, click the "Get Widget" link. Copy the text in for Option 1.Step 2.
Navigate to Layout > Page Elements, then click "Add a Gadget"
Step 3.
From the pop-up list, select "HTML/Javascript"
Step 4.
Paste the HTML code you copied from NetworkedBlogs into the text area and click save.
Step 5.
You're done. You can now verify your blog
Go to your Blog's profile on NetworkedBlogs, click the "Get Widget" link, then press the Verify button.http://infonetmu.blogspot.com/2011/02/download-kamus-indonesia-inggrisinggris.html
Stop Watch dengan Atmega32
$regfile = "m32def.dat" $crystal = 12000000 'deklarasi LCD Config Lcdpin = Pin , Db4 = Portc.5 , Db5 = Portc.4 , Db6 = Portc.3 , Db7 = Portc.2 , E = Portc.6 , Rs = Portc.7 Config Lcd = 16 * 2 Cursor Off Cls 'Deklarasi variabel Dim Pengali As Word Dim Detik_1 As Byte Dim Detik As Byte Dim Menit As Byte Dim Jam As Word Dim Status As Byte Dim Status2 As Byte Dim Status3 As Byte 'konfigurasi timer Config Timer0 = Timer , Prescale = 256 Config Debounce = 30 'setting porta Ddra = 0 Porta = 255 'pengaktifan interupsi timer On Ovf0 Int_timer0 'penggantian nama variabel Pin_reset Alias Pina.2 Pin_on_off Alias Pina.1 Pin_capture Alias Pina.0 'setting nilai awal variabel 'Pin_reset = 1 'Pin_on_off = 1 'Pin_capture = 1 Status = 0 Status2 = 1 'pengaktifan timer0 Enable Timer0 Do If Pin_capture = 0 Then Bitwait Pin_capture , Set Incr Status2 Cls Locate 1 , 1 Lcd "BINA ELEKTRONIK" Locate 2 , 1 Lcd Jam ; Locate 2 , 3 Lcd ":" ; Locate 2 , 4 Lcd Menit ; Locate 2 , 6 Lcd ":" ; Locate 2 , 7 Lcd Detik ; Locate 2 , 9 Lcd ":" ; Locate 2 , 10 Lcd Detik_1 ; Locate 2 , 12 Lcd Capture1 End If If Status2 = 2 Then Locate 2 , 13 Lcd "SLIP" End If If Status2 = 2 Then Locate 2 , 11 Lcd " " End If If Pin_on_off = 0 Then Bitwait Pin_on_off , Set Incr Status End If If Pin_reset = 0 Then Pengali = 0 Detik_1 = 00 Locate 2 , 1 Lcd "00" Locate 2 , 4 Lcd "00" Locate 2 , 7 Lcd "00" Locate 2 , 10 Lcd "00" Detik = 00 Menit = 00 Jam = 00 End If If Status > 2 Then Status = 1 End If If Status2 > 2 Then Status2 = 1 Cls End If If Status = 1 Then Enable Interrupts If Status = 2 Then Disable Interrupts If Status2 < 2 Then Locate 1 , 1 Lcd "STOPWATCH" Locate 2 , 1 Lcd Jam ; Locate 2 , 3 Lcd ":" ; Locate 2 , 4 Lcd Menit ; Locate 2 , 6 Lcd ":" ; Locate 2 , 7 Lcd Detik ; Locate 2 , 9 Lcd ":" ; Locate 2 , 10 Lcd Detik_1 ; End If If Status = 2 Then ' tambahan Locate 2 , 13 ' tambahan Lcd "STOP" ' tambahan End If ' tambahan If Status = 1 Then ' tambahan Locate 2 , 13 ' tambahan Lcd ">>>>" ' tambahan End If Loop Int_timer0: Incr Pengali If Pengali > 0 Then Pengali = 0 Incr Detik_1 End If If Detik_1 > 99 Then Detik_1 = 0 Incr Detik End If If Detik > 59 Then Detik = 0 Incr Menit End If If Menit > 59 Then Menit = 0 Incr Jam End If Return
Pengendali motor stepper dengan keypad
Code List :
$regfile = "m16def.dat"
$crystal = 1000000
Config Kbd = Portb
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portc.4 , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7 ,Rs = Portc.0 , E = Portc.1
Config Portd = Output
Config Porta = Input
Dim A As Byte , B As Byte , Key As Byte , C As Byte , D As Byte , E As Byte
Cls
Cursor Off
B = 0
D = 1
Q:
Locate 1 , 1
Lcd "Putaran :"
Locate 2 , 1
Lcd "Kecept :"
Do
'************Read Keyboard
A = Getkbd()
If A > 15 Then
Goto Q
Else
Key = Lookup(a , Dta)
If Key <= 9 Then
B = B * 10
B = B + Key
'*************Direction
If D = 0 Then Lcd B
Waitms 270
Elseif Key = 10 Then
Locate 1 , 11
Lcd "Kiri"
C = 1
D = 0
B = 0
Elseif Key = 11 Then
Locate 1 , 11
Lcd "Kanan"
C = 2
D = 0
B = 0
'****************reset
Elseif Key = 13 Then
Cls
D = 1
B = 0
Portd.0 = 0
Portd.1 = 0
Waitms 50
Goto Q
'****************Enter key
Elseif Key = 14 Then
If D = 0 Then
Select Case C
Case 1 : Gosub R
Case 2 : Gosub T
End Select
End If
End If
End If
Wait 1
Loop
End
Dta:
Data 7 , 8 , 9 , 10 , 4 , 5 , 6 , 11 , 1 , 2 , 3 , 12 , 13 , 0 , 14 , 15
R:
Do
Portd = &B00000001 : Waitms B
Portd = &B00000011 : Waitms B
Portd = &B00000010 : Waitms B
Portd = &B00000110 : Waitms B
Portd = &B00000100 : Waitms B
Portd = &B00001100 : Waitms B
Portd = &B00001000 : Waitms B
Portd = &B00001001 : Waitms B
If Pina.0 = 1 Then
Locate 2 , 1
Lcd "Kecept:"
B = 0
Lcd B ; " "
Return
End If
Loop
T:
Do
Portd = &B00001001 : Waitms B
Portd = &B00001000 : Waitms B
Portd = &B00001100 : Waitms B
Portd = &B00000100 : Waitms B
Portd = &B00000110 : Waitms B
Portd = &B00000010 : Waitms B
Portd = &B00000011 : Waitms B
Portd = &B00000001 : Waitms B
If Pina.0 = 1 Then
Locate 2 , 1
Lcd "Kecept:"
B = 0
Lcd B ; " "
Return
End If
Loop