Selamat datang di ForSa! Forum diskusi seputar sains, teknologi dan pendidikan Indonesia.

Welcome to Forum Sains Indonesia. Please login or sign up.

Februari 24, 2024, 05:28:22 PM

Login with username, password and session length

Topik Baru

Artikel Sains

Anggota
Stats
  • Total Tulisan: 139,653
  • Total Topik: 10,405
  • Online today: 148
  • Online ever: 1,582
  • (Desember 22, 2022, 06:39:12 AM)
Pengguna Online
Users: 0
Guests: 44
Total: 44

Aku Cinta ForSa

ForSa on FB ForSa on Twitter

program switching power

Dimulai oleh caturpermadi, Juni 29, 2013, 01:24:59 AM

« sebelumnya - berikutnya »

0 Anggota dan 1 Pengunjung sedang melihat topik ini.

caturpermadi

bro and sist, mau tanya dong.
ane punya rangkaian nih gan. gambarnya dilampiran

trus listing programnya gini gan

'-------------------------------------
'Rancang Bangun Tablet Hardness Tester
'-------------------------------------
$regfile = "m8def.dat"
$crystal = 8000000
'==========================
Config Lcdpin = Pin , E = Portd.1 , Rs = Portd.0 ,
Config Lcdpin = Pin , Db4 = Portd.2 , Db5 = Portd.3 , Db6 = Portd.4 , Db7 = Portd.5
Config Lcd = 16 * 2

Config Pinb.1 = Input
Config Pinb.2 = Input
Saklar Alias Portb.0
Power_on Alias Pinb.1
Tombol_start Alias Pinb.2
Config Adc = Single , Prescaler = Auto , Reference = Internal
Dim Dataadc1 As Word , Intensitas1 As Single
Const Vreff = 5.00
Start Adc
'--------------------------
Cls
Cursor Off
Dim Switch_power As Byte
Switch_power = 0
'--------------------------
If Power_on = 0 Then
Saklar = 1
End If

Awal:
Locate 1 , 1
Lcd "Tablet Hardness "
Waitms 150
Locate 2 , 1
Lcd "    Tester      "
Waitms 300
Cls

Locate 1 , 1
Lcd "  Ahmad Kamal   "
Locate 2 , 1
Lcd "P2.31.38.010.004"
Waitms 300

Locate 1 , 1
Lcd "Pembimbing Modul"
Locate 2 , 1
Lcd "Drs. Tapsir, BE "
Waitms 300

Cls
Gosub Permulaan

Permulaan:
Ddrb.1 = 0
Do

Locate 1 , 1
Lcd " Put the tablet "
Locate 2 , 1
Lcd "in the test zone"
Waitms 300

Saklar = 1

If Power_on = 1 Then
Gosub Permulaan
End If

If Power_on = 0 Then
Gosub Shutdown
End If

Loop Until Tombol_start = 0
Bitwait Tombol_start , Set
Waitms 10

Gosub Ukur

Return

Ukur:
Dataadc1 = 0
Intensitas1 = 0

Dataadc1 = Getadc(0)
Intensitas1 = Dataadc1
Wait 1

Locate 1 , 1
Lcd "Checking up till"
Waitms 30
Locate 2 , 1
Lcd "the result come "
Wait 1

Do
Cls
Locate 1 , 1
Lcd "     Result1    "
Locate 2 , 1
Lcd Intensitas1
Locate 2 , 6
Lcd "Kgn"
Waitms 150
Loop Until Tombol_start = 0
Bitwait Tombol_start , Set

Gosub Permulaan
Return

Shutdown:
   Cls

   Locate 1 , 1
   Lcd " Please wait  "
   Locate 2 , 1
   Lcd " Shuting down "
   Wait 1

Portb.0 = 0

Return

pertanyaannya gini gan kenapa pas ane ngejajal tuh rangkaian, pas ane tekan push button dapet logika high. program jalan tuh gan, tapi kenapa pas program running saat gosub permulaan, malah ke detect logika low. trus malah langsung gosub shutdown. kira2 kenapa ya gan? mohon penjelasannya.. :)