sblm chy

Rabu, 20 Maret 2013

Drive LED display in multiplexed mode



LED 7 segment
Sample experiment-2
Drive LED display in multiplexed mode

Buat object sbb :


Kemudian masukkan program :

Dim Number(0 To 9) As Integer
Dim Index As Integer
Dim Exits As Boolean
Dim interval As Double

Private Sub Command1_Click()
If Index < 10 Then
Out &H378, Number(Index)
Index = Index + 1
Else
Index = 0
End If
Out &H37A, &H5
End Sub

Private Sub Command2_Click()
Exits = False
Do
DoEvents
Out &H378, Number(1)
Out &H37A, &H5
Call delay
Out &H378, Number(2)
Out &H37A, &H6
Call delay
Out &H378, Number(3)
Out &H37A, &H0
Call delay
Out &H378, Number(4)
Out &H37A, &HC
Call delay
Out &H37A, &H4
Loop Until Exits = True
End Sub

Private Sub Command3_Click()
Exits = True
End Sub

Private Sub Form_Load()
Number(0) = &H3F
Number(1) = &H6
Number(2) = &H5B
Number(3) = &H4F
Number(4) = &H66
Number(5) = &H6D
Number(6) = &H7D
Number(7) = &H7
Number(8) = &H7F
Number(9) = &H6F
End Sub

Sub delay()
times = Timer
Do
DoEvents
Loop Until Timer >= times + interval
'For i = 1 To HScroll1.Value
'DoEvents
'Next i
End Sub

'Private Sub Timer2_Timer()
'Text1.Text = Format(Now, "hh:mm:ss")
'Index1 = Asc(Right(Text1.Text, 1)) - &H30
'Index2 = Asc(Mid(Text1.Text, 7, 1)) - &H30
'Index3 = Asc(Mid(Text1.Text, 5, 1)) - &H30
'Index4 = Asc(Mid(Text1.Text, 4, 1)) - &H30
'End Sub
Private Sub HScroll1_Change()
interval = HScroll1.Value / 100
End Sub

 Selamat mencoba ^_^

Sumber : Kuliah Praktik Teknik Antar Muka, 20Mart 2013

Tidak ada komentar:

Posting Komentar