Thông báo

Collapse
No announcement yet.

mọi người cho mình hỏi đoạn code này là của ngôn ngữ gì? nội dung thế nào?

Collapse
X
 
  • Lọc
  • Giờ
  • Show
Clear All
new posts

  • mọi người cho mình hỏi đoạn code này là của ngôn ngữ gì? nội dung thế nào?

    Dim i, j, Position, LastPoint As Variant
    Dim d(100001), A(100001), An(100001), C(100001), Linia(100001), Population(3) As Variant
    Dim DataTrainLength, NumberOfAcc, Acc, N, Comp, Pulse1, Pulse2 As Integer
    Dim StartAcc As Boolean
    Dim Sequence, AccComplete As String
    Private Sub Command1_Click()
    Timer1.Interval = 0
    NumberOfAcc = HScroll8.Value
    Acc = 1
    StartAcc = True
    For i = 1 To DataTrainLength + 44
    A(i) = 0
    Next i
    Picture3.Cls
    Timer1.Interval = HScroll1.Value
    End Sub
    Private Sub Command2_Click()
    Timer1.Interval = 0
    End Sub
    Private Sub Command3_Click()
    Picture2.Cls
    Text11.Text = ""
    Text12.Text = ""
    Text13.Text = ""
    Text14.Text = ""
    Text15.Text = ""
    Text16.Text = ""
    Comp = 1
    j = 1
    For i = 1 To N / (2 * HScroll3.Value)
    An(i) = An(i) / NumberOfAcc
    j = j + 1
    Next i
    Ntotal = j - 1
    LastPoint = Ntotal - 3
    For i = 0 To 3
    Population(i) = 0
    Next i
    If HScroll9.Value > HScroll2.Value - 2 Then HScroll9.Value = HScroll2.Value - 2
    Position = HScroll9.Value
    For i = 1 To LastPoint
    Picture2.PSet (Picture2.Width * i / (HScroll2.Value), (Picture2.Height - 700 * Log(An(i)))), RGB(0, 255, 255)
    Next i
    Picture2.Line (Picture2.Width * Position / (HScroll2.Value), (Picture2.Height - 700 * Log(An(Position))))-Step(0, 200), RGB(255, 255, 255)
    End Sub
    Private Sub Command4_Click()
    Summa1 = 0
    Summa2 = 0
    Summa3 = 0
    Summa4 = 0
    For i = Position To LastPoint
    Summa1 = Summa1 + i
    Summa2 = Summa2 + i * i
    If Comp = 1 Then Summa3 = Summa3 + Log(An(i))
    If Comp > 1 Then Summa3 = Summa3 + Log(C(i))
    If Comp = 1 Then Summa4 = Summa4 + i * Log(An(i))
    If Comp > 1 Then Summa4 = Summa4 + i * Log(C(i))
    Next i
    Е = Summa1 * Summa1 - (LastPoint - Position + 1) * Summa2
    Slope = ((LastPoint - Position + 1) * Summa4 - Summa1 * Summa3) / Е
    Ll = (Summa1 * Summa4 - Summa2 * Summa3) / Е
    Population(Comp) = Exp(Ll)
    For i = 1 To LastPoint
    Linia(i) = Ll - Slope * i
    Next i
    For i = 1 To LastPoint
    Picture2.PSet (Picture2.Width * i / HScroll2.Value, (Picture2.Height - 700 * (Linia(i)))), RGB(255, 0, 0)
    Next i
    If Comp = 1 Then Text11.Text = Format(HScroll3.Value / (Slope * 10), "#,##0.0") & " ms"
    If Comp = 2 Then Text13.Text = Format(HScroll3.Value / (Slope * 10), "#,##0.0") & " ms"
    If Comp = 3 Then Text15.Text = Format(HScroll3.Value / (Slope * 10), "#,##0.0") & " ms"
    End Sub
    Private Sub Command5_Click()
    j = 0
    Subtr:
    j = j + 1
    If Comp = 1 Then C(j) = An(j) - Exp(Linia(j))
    If Comp > 1 Then C(j) = C(j) - Exp(Linia(j))
    If C(j) > 0.5 Then GoTo Subtr
    LastPoint = j - 1
    For i = 1 To LastPoint
    Picture2.PSet (Picture2.Width * i / HScroll2.Value, Picture2.Height - 700 * Log(C(i))), RGB(0, 255, 255)
    Next i
    Comp = Comp + 1
    Position = 1
    HScroll9.Value = 1
    End Sub
    Private Sub Command6_Click()
    For i = 1 To 3
    Total = Total + Population(i)
    Next i
    Population(1) = Int(100 * Population(1) / Total) / 100
    If Comp > 2 Then Population(2) = Int(100 * Population(2) / Total) / 100 Else Population(2) = 1 - Population(1)
    If Comp > 2 Then Population(3) = 1 - Population(1) - Population(2) Else Population(3) = 0
    Text12.Text = Format(Population(1), "0.00")
    Text14.Text = Format(Population(2), "0.00")
    Text16.Text = Format(Population(3), "0.00")
    StartAcc = False
    Acc = 1
    Timer1.Interval = HScroll1.Value
    End Sub
    Private Sub Form_Load()
    Timer1.Interval = 10
    Pulse1 = 10
    Pulse2 = 20
    HScroll1.Value = 100
    HScroll2.Value = 1
    HScroll3.Value = 1
    HScroll4.Value = Pulse1
    HScroll5.Value = Pulse2
    HScroll6.Value = 60
    HScroll7.Value = 127
    HScroll8.Value = 1
    HScroll9.Value = 1
    LastPoint = 3
    NumberOfAcc = 1
    Text1.Text = HScroll1.Value
    Text2.Text = HScroll2.Value
    Text3.Text = HScroll3.Value * 50
    Text4.Text = (HScroll4.Value + 1) * 0.5
    Text5.Text = (HScroll5.Value + 1) * 0.5
    Text6.Text = HScroll6.Value / 4
    Text7.Text = 9.8 + HScroll7.Value / 255
    Text8.Text = HScroll8.Value
    Text17.Text = HScroll9.Value
    Out &H37A, 1
    Out &H378, 1 'Mode 1 - Master Reset
    Out &H37A, 9
    Out &H37A, 1
    Out &H378, 2 'Mode 2 - Pulse 1
    Out &H37A, 9
    Out &H37A, 1
    Out &H37C, Pulse1 'Pulse 1 duration
    Out &H378, 4 'Pulse 2
    Out &H37A, 9
    Out &H37A, 1
    Out &H37C, Pulse2 'Pulse 2 duration
    Out &H378, 64 'Run
    Out &H37A, 9
    Out &H37A, 1
    Call DataTrain
    End Sub
    Private Sub HScroll1_Change()
    Timer1.Interval = HScroll1.Value
    Text1.Text = HScroll1.Value
    Call DataTrain
    End Sub
    Private Sub HScroll2_Change()
    Text2.Text = HScroll2.Value
    Call DataTrain
    End Sub
    Private Sub HScroll3_Change()
    Text3.Text = HScroll3.Value
    Call DataTrain
    End Sub
    Private Sub HScroll4_Change()
    Pulse1 = HScroll4.Value
    Out &H378, 2 'Mode 2 - Pulse 1
    Out &H37A, 9
    Out &H37A, 1
    Out &H37C, Pulse1 'Pulse 1 duration
    Text4.Text = (HScroll4.Value + 1) * 0.5
    Out &H378, 64 'Run
    Out &H37A, 9
    Out &H37A, 1
    Call DataTrain
    End Sub
    Private Sub HScroll5_Change()
    Pulse2 = HScroll5.Value
    Out &H378, 4 'Mode 4 - Pulse 2
    Out &H37A, 9
    Out &H37A, 1
    Out &H37C, Pulse2 'Pulse 2 duration
    Text5.Text = (HScroll5.Value + 1) * 0.5
    Out &H378, 4 'Run
    Out &H37A, 9
    Out &H37A, 1
    Call DataTrain
    End Sub
    Private Sub HScroll6_Change()
    Out &H378, 20
    Out &H37A, 9
    Out &H37A, 1
    Out &H37C, HScroll6.Value
    Out &H378, 16
    Out &H37A, 9
    Out &H37A, 1
    Text6.Text = HScroll6.Value / 4
    End Sub
    Private Sub HScroll7_Change()
    Out &H378, 24
    Out &H37A, 9
    Out &H37A, 1
    Out &H37C, HScroll7.Value
    Out &H378, 16
    Out &H37A, 9
    Out &H37A, 1
    Text7.Text = 9.8 + HScroll7.Value / 255
    End Sub
    Private Sub HScroll8_Change()
    Text8.Text = HScroll8.Value
    NumberOfAcc = HScroll8.Value
    End Sub
    Private Sub HScroll9_Change()
    If Comp = 1 Then Picture2.Line (Picture2.Width * Position / HScroll2.Value, (Picture2.Height - 700 * Log(An(Position))))-Step(0, 200), RGB(0, 0, 0)
    If Comp = 2 Then Picture2.Line (Picture2.Width * Position / HScroll2.Value, Picture2.Height - 700 * Log(C(Position)))-Step(0, 200), RGB(0, 0, 0)
    Position = HScroll9.Value
    Text17.Text = HScroll9.Value
    For i = 1 To LastPoint
    If Comp = 1 Then Picture2.PSet (Picture2.Width * i / HScroll2.Value, (Picture2.Height - 700 * Log(An(i)))), RGB(0, 255, 255)
    If Comp = 2 Then Picture2.PSet (Picture2.Width * i / HScroll2.Value, (Picture2.Height - 700 * Log(C(i)))), RGB(0, 255, 255)
    Next i
    If Comp = 1 Then Picture2.Line (Picture2.Width * Position / HScroll2.Value, (Picture2.Height - 700 * Log(An(Position))))-Step(0, 200), RGB(255, 255, 255)
    If Comp = 2 Then Picture2.Line (Picture2.Width * Position / HScroll2.Value, Picture2.Height - 700 * Log(C(Position)))-Step(0, 200), RGB(255, 255, 255)
    End Sub
    Private Sub Timer1_Timer()
    Out &H378, 2 'Run
    Out &H37A, 9
    Out &H37A, 1
    Out &H378, 255
    Out &H379, 255
    i = 0
    Check1:
    If Inp(&H379) = 206 Then GoTo Check1
    check2:
    If Inp(&H379) <> 206 Then GoTo check2
    Out &H37A, 1
    i = i + 1
    If i > DataTrainLength + 44 Then GoTo Check3
    Out &H37C, d(i)
    If Inp(&H379) = 206 Then GoTo check2
    Out &H37A, 0
    If StartAcc = True And NumberOfAcc > 1 Then A(i) = A(i) + Inp(&H37C) Else A(i) = Inp(&H37C)
    Out &H37A, 1
    GoTo check2
    Check3:
    N = (HScroll2.Value + 1) * HScroll3.Value * 2 - 1
    m = 2 * HScroll3.Value * (Picture1.Width - 50) / N
    BaseLine1 = Picture1.Height - 100
    VScale1 = Picture1.Height / 255
    Picture1.Cls
    If Acc < 1 Then Acc = 1
    An(0) = A(36)
    Picture1.PSet (0, BaseLine1 - VScale1 * An(0) / Acc), RGB(0, 255, 255)
    For i = 1 To N
    An(i) = A(i + 36)
    Next i
    For i = 0 To HScroll2.Value
    An(i) = An(i * 2 * HScroll3.Value)
    Next i
    For i = 2 To HScroll2.Value
    If An(i) < (An(i - 1) + A(i + 1)) / 2 - 20 Then An(i) = (An(i - 1) + An(i + 1)) / 2
    Next i
    For i = 0 To HScroll2.Value - 1
    Picture1.PSet ((i) * m, BaseLine1 - VScale1 * An(i) / Acc), RGB(0, 255, 255)
    Next i
    If StartAcc = True Then Picture3.Line (0, 0)-Step(Picture3.Width * Acc / (HScroll8.Value), Picture3.Height), RGB(255, 255, 0), BF
    If StartAcc = True And NumberOfAcc > 1 Then Acc = Acc + 1
    If StartAcc = True And Acc = NumberOfAcc + 1 Then Timer1.Interval = 0
    Call DataTrain
    End Sub
    Sub DataTrain()
    Text1.Text = HScroll1.Value
    Text2.Text = HScroll2.Value
    Text3.Text = HScroll3.Value * 100
    DataTrainLength = 4 + 2 * (HScroll2.Value + 1) * HScroll3.Value
    For i = 1 To 100000
    d(i) = 0
    Next i
    For NP = 0 To HScroll2.Value - 1
    i = 20 + HScroll3.Value * (1 + 2 * NP)
    j = 20 + HScroll3.Value * (2 + 2 * NP)
    d(i) = 1 ' + 0
    d(j) = 4
    Next NP
    d(16) = 4
    d(18) = 4
    d(20) = 2 ' + 8
    End Sub

  • #2
    Đây là ngôn ngữ Visual Basic. Nội dung thì không biết do dài quá nên lười đọc cộng với cũng không thích ngôn ngữ này

    Comment


    • #3
      Đây là ngôn ngữ Visual basic ... Theo một số câu lệnh ở trong bài thì đây có thể là một bài về vẽ đồ thị hoặc xung điện ( dạng oscilloscope ) có các giá trị trục đứng, ngang theo hàm thời gian.
      Tín hiệu được đưa vào là cổng máy in LPT .

      ( Thời này sinh viên vẫn dùng visual basic à ? )
      Module RF chuyên dụng điều khiển, truyền dữ liệu, thiết kế đề tài, dự án điện tử - chuyển giao công nghệ... ĐT: 0904964977 - email: dientuqueduong@yahoo.com

      Comment


      • #4
        ngôn ngữ Visual basic nha ban......

        Comment

        Về tác giả

        Collapse

        tungnicol Tìm hiểu thêm về tungnicol

        Bài viết mới nhất

        Collapse

        Đang tải...
        X