VERSION 5.00 Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX" Begin VB.Form Frekuensi Caption = "Frekuensi" ClientHeight = 3285 ClientLeft = 60 ClientTop = 450 ClientWidth = 5775 LinkTopic = "Frekuensi" ScaleHeight = 3285 ScaleWidth = 5775 StartUpPosition = 3 'Windows Default Begin VB.TextBox Text3 Height = 495 Left = 120 TabIndex = 8 Top = 1320 Width = 495 End Begin VB.TextBox Text1 Height = 495 Left = 120 TabIndex = 7 Top = 720 Width = 495 End Begin VB.Timer Timer2 Enabled = 0 'False Interval = 100 Left = 1920 Top = 0 End Begin VB.TextBox indikator Height = 375 Left = 3960 TabIndex = 6 Top = 1200 Width = 495 End Begin VB.ComboBox Combo1 Height = 315 ItemData = "Form1.frx":0000 Left = 3840 List = "Form1.frx":0018 TabIndex = 5 Text = "1,00 detik" Top = 480 Width = 1335 End Begin VB.Timer Timer1 Enabled = 0 'False Left = 960 Top = 0 End Begin VB.TextBox d_frekuensi Alignment = 2 'Center BeginProperty DataFormat Type = 0 Format = "0,00" HaveTrueFalseNull= 0 FirstDayOfWeek = 0 FirstWeekOfYear = 0 LCID = 1057 SubFormatType = 0 EndProperty BeginProperty Font Name = "Arial Black" Size = 27.75 Charset = 0 Weight = 900 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 975 Left = 840 TabIndex = 3 Text = "00,00" Top = 720 Width = 2535 End Begin VB.CommandButton Command3 Caption = "Exit" Height = 375 Left = 2880 TabIndex = 2 Top = 2040 Width = 615 End Begin VB.CommandButton Command2 Caption = "Stop" Enabled = 0 'False Height = 375 Left = 1800 TabIndex = 1 Top = 2040 Width = 615 End Begin VB.CommandButton Command1 Caption = "Start" Height = 375 Left = 600 TabIndex = 0 Top = 2040 Width = 615 End Begin MSCommLib.MSComm MSComm1 Left = 120 Top = 0 _ExtentX = 1005 _ExtentY = 1005 _Version = 393216 CommPort = 3 DTREnable = 0 'False End Begin VB.Label Label2 Caption = "com" Height = 255 Left = 3840 TabIndex = 10 Top = 2760 Width = 615 End Begin VB.Label Label1 Caption = "3" Height = 375 Left = 3960 TabIndex = 9 Top = 2040 Width = 495 End Begin VB.Label FREKUENSI Alignment = 2 'Center Caption = "FREKUENSI" BeginProperty Font Name = "Arial" Size = 21.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 615 Left = 720 TabIndex = 4 Top = 0 Width = 2535 End End Attribute VB_Name = "Frekuensi" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Dim counter As Integer Dim ulg, slh As Integer Private Sub Command1_Click() Dim waktu As Integer If Combo1.Text = "0,25 detik" Then waktu = 250 End If If Combo1.Text = "0,50 detik" Then waktu = 500 End If If Combo1.Text = "0,75 detik" Then waktu = 750 End If If Combo1.Text = "1,00 detik" Then waktu = 1000 End If Timer1.Interval = waktu Timer1.Enabled = True Command1.Enabled = False Command2.Enabled = True Combo1.Enabled = False counter = 0 slh = 0 End Sub Private Sub Command2_Click() If MSComm1.PortOpen = True Then MSComm1.PortOpen = False End If Timer1.Enabled = False Timer2.Enabled = False Command2.Enabled = False Command1.Enabled = True Combo1.Enabled = True End Sub Private Sub Command3_Click() If MSComm1.PortOpen = True Then MSComm1.PortOpen = False End If Timer1.Enabled = False Timer2.Enabled = False Unload Me End Sub Private Sub Form_Load() Dim waktu As Integer If Combo1.Text = "0,25 detik" Then waktu = 250 End If If Combo1.Text = "0,50 detik" Then waktu = 500 End If If Combo1.Text = "0,75 detik" Then waktu = 750 End If If Combo1.Text = "1,00 detik" Then waktu = 1000 End If Timer1.Interval = waktu Timer1.Enabled = True Command1.Enabled = False Command2.Enabled = True Combo1.Enabled = False counter = 0 slh = 0 End Sub Private Sub Timer1_Timer() On Error Resume Next If MSComm1.PortOpen = False Then MSComm1.PortOpen = True End If MSComm1.Output = "1" Timer2.Enabled = True Do dummy = DoEvents() Loop Until MSComm1.InBufferCount >= 7 Or ulg >= 2 If MSComm1.InBufferCount >= 7 Then d_frekuensi.Text = Format(1000000 / (MSComm1.Input * 2), "0.00") slh = 0 End If If ulg >= 2 Then ulg = 0 slh = slh + 1 End If Timer2.Enabled = False If MSComm1.PortOpen = True Then MSComm1.PortOpen = False End If If slh >= 5 Then d_frekuensi.Text = "00,00" End If Text3.Text = slh counter = counter + 1 indikator.Text = counter If indikator.Text = "2" Then counter = 0 indikator.BackColor = &HFF0000 Else indikator.BackColor = &HFFC0C0 End If If d_frekuensi.Text > 48 And d_frekuensi.Text < 52 Then namefile = App.Path & "\freq.text" Open namefile For Output As 1 Print #1, d_frekuensi.Text Close #1 End If End Sub Private Sub Timer2_Timer() ulg = ulg + 1 Text1.Text = ulg If Text1.Text = "2" Then Text1.BackColor = &HFF0000 Else Text1.BackColor = &HFFC0C0 End If End Sub