⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 this is important file for vb
💻 FRM
📖 第 1 页 / 共 4 页
字号:
   End
   Begin VB.Label Label43 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      BorderStyle     =   1  'Fixed Single
      Caption         =   "Graphs"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   18
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   6120
      TabIndex        =   37
      Top             =   800
      Width           =   5085
   End
   Begin VB.Label Label4 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      BorderStyle     =   1  'Fixed Single
      Caption         =   "Variables "
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   18
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   390
      TabIndex        =   3
      Top             =   800
      Width           =   5085
   End
   Begin VB.Line Line3 
      BorderWidth     =   3
      X1              =   120
      X2              =   11760
      Y1              =   1320
      Y2              =   1320
   End
   Begin VB.Label Label3 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      BorderStyle     =   1  'Fixed Single
      Caption         =   "Solar Traction System"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   420
      Left            =   3600
      TabIndex        =   2
      Top             =   240
      Width           =   5025
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      BorderStyle     =   1  'Fixed Single
      Caption         =   "   "
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   420
      Left            =   9960
      TabIndex        =   1
      Top             =   240
      Width           =   345
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      BorderStyle     =   1  'Fixed Single
      Caption         =   "   "
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   420
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   705
   End
   Begin VB.Line Line2 
      BorderWidth     =   3
      X1              =   5640
      X2              =   5640
      Y1              =   720
      Y2              =   8040
   End
   Begin VB.Line Line1 
      BorderWidth     =   3
      X1              =   120
      X2              =   11760
      Y1              =   720
      Y2              =   720
   End
   Begin VB.Shape Shape1 
      BorderWidth     =   3
      Height          =   7935
      Left            =   120
      Top             =   120
      Width           =   11655
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
MSComm1.Output = "{5E00}"
Sleep 100
End
End Sub

Private Sub Command3_Click()
Me.Hide
Form2.Show
End Sub

Private Sub Form_Load()
Label1.Caption = Format(Date, "DD:MM:YYYY")
Label2.Caption = Format(Time, "HH:MM:SS Am/Pm")

InitEmb                 'Initialize Port
InitColor               ' Initialize Of Graph Color for 18 sensors

PCnt = 1
Step = 1000 / 17        ' No of pulses = Total Pulses / Total Sensors

Forward(1) = &HA
Forward(2) = &H6
Forward(3) = &H5
Forward(4) = &H9

Reverse(1) = &H9
Reverse(2) = &H5
Reverse(3) = &H6
Reverse(4) = &HA

PortC(1) = &H1
PortC(2) = &H2

For i = 1 To 15
    Sx(i) = 6360
    Sy(i) = 6600
    Lightv(i) = 0#
Next

Cnt = 0

End Sub

Private Sub Form_Unload(Cancel As Integer)
MSComm1.Output = "{5E00}"
Sleep 100
End
End Sub

Private Sub Main_Timer_Timer()
Label2.Caption = Format(Time, "HH:MM:SS Am/Pm")

MSComm1.Output = "{5C8" + CStr(Hex(PortC(2))) + "}"
'Sleep 30

For i = 0 To 7
    MSComm1.Output = "{5B0" + CStr(Hex(i)) + "}"
    Sleep 20

    MSComm1.Output = "{40}"
    Sleep 20
    Buf = MSComm1.Input
    Lightv(i + 1) = CharToVal(Buf)
Next


MSComm1.Output = "{5C8" + CStr(Hex(PortC(1))) + "}"
'Sleep 30

For i = 0 To 7
    MSComm1.Output = "{5B0" + CStr(Hex(8 + i)) + "}"
    Sleep 20

    MSComm1.Output = "{40}"
    Sleep 20
    Buf = MSComm1.Input
    Lightv(9 + i) = CharToVal(Buf)
Next


Temp = Lightv(1)
For i = 2 To 16
    If Lightv(i) > Temp Then
        Temp = Lightv(i)
        J = i
    End If
'    If i = 16 Then
'        If (Lightv(1) > Temp) Then
'            Temp = Lightv(1)
'            J = 1
'        End If
'    Else
'    If (Not (Lightv(1) <= Temp)) Then
'        Temp = Lightv(1)
'        J = i
'    End If
    
'    End If
Next
    MSComm1.Output = "{41}"
    Sleep 20
    Buf = MSComm1.Input
    Volt = CharToVal(Buf)

'Lightv(6) = Lightv(6) / 2.925

For i = 1 To 16
    Light(i).Caption = Format(Lightv(i), "0.00")
Next

Volt = Volt / 16.9
Light(17).Caption = Format(Volt, "0.00")

Times = (J * Step)

    If ((Volt >= 3.5) And (Volt <= 6.4)) Then
        Label27.BackColor = vbGreen
        Label32.BackColor = &HC0C0C0
        Label34.BackColor = &HC0C0C0
        Label29.Caption = ""
        MSComm1.Output = "{5E01}"
        Sleep 100
    ElseIf ((Volt >= 6.5) And (Volt <= 12.9)) Then
        Label27.BackColor = &HC0C0C0
        Label32.BackColor = vbGreen
        Label34.BackColor = &HC0C0C0
        Label29.Caption = ""
        MSComm1.Output = "{5E02}"
        Sleep 100
    ElseIf ((Volt >= 13)) Then
        Label27.BackColor = &HC0C0C0
        Label32.BackColor = &HC0C0C0
        Label34.BackColor = vbGreen
        Label29.Caption = ""
        MSComm1.Output = "{5E04}"
        Sleep 100
    Else
        Label27.BackColor = &HC0C0C0
        Label32.BackColor = &HC0C0C0
        Label34.BackColor = &HC0C0C0
        Label29.Caption = "LOW VOLTAGE"
        MSComm1.Output = "{5E00}"
        Sleep 100
    End If
    Label30.Caption = Label29.Caption
Check
Graph
End Sub

Private Sub Timer1_Timer()
Label2.Caption = Format(Time, "HH:MM:SS Am/Pm")
End Sub

Sub Check()
'    Me.Caption = Temp & "   " & Cnt & " " & Times & "    " & J
     
     MaxNo.Caption = J
     
     
     If (Cnt < Times) Then
             
             Data = Reverse(PCnt)
             Direction.Caption = "Reverse"
             If Len(CStr(Hex(Data))) <> 2 Then
             MSComm1.Output = "{5D0" + CStr(Hex(Data)) & "}"
             Else
             MSComm1.Output = "{5D" + CStr(Hex(Data)) & "}"
             End If
             Cnt = Cnt + 4
             PCnt = PCnt + 1
             If (PCnt > 4) Then PCnt = 1
    ElseIf (Cnt > Times) Then
             
             Data = Forward(PCnt)
             Direction.Caption = "Forward"
             If Len(CStr(Hex(Data))) <> 2 Then
             MSComm1.Output = "{5D0" + CStr(Hex(Data)) & "}"
             Else
             MSComm1.Output = "{5D" + CStr(Hex(Data)) & "}"
             End If
             Cnt = Cnt - 4
             PCnt = PCnt + 1
             If (PCnt > 4) Then PCnt = 1
    ElseIf (Cnt = Times) Then
            Direction.Caption = "Stopped"
            MSComm1.Output = "{5DFF}"
        End If

End Sub

Sub Graph()
For i = 1 To 16
Ex(i) = Sx(i) + 100
a = Lightv(i)       'Random Number
ip(i) = 6600 - (a / 500) * 4920 'End Point
If (ip(i) < 1700) Then ip(i) = 1700
Ey(i) = ip(i)
Line (Sx(i), Sy(i))-(Ex(i), Ey(i)), RGB(Col1(i), Col2(i), Col3(i))
Sx(i) = Ex(i)
Sy(i) = Ey(i)
If Sx(i) > 11400 Then
Grclr
End If
Next

End Sub

Sub Grclr()
'Line (6360, 1680)-(11520, 6600), Me.BackColor, BF
Me.Cls
Line6.Refresh
Line7.Refresh
Line9.Refresh
Line11.Refresh
For i = 1 To 16
    Sx(i) = 6360
Next

End Sub

Sub InitColor()
Col1(1) = 180
Col1(2) = 4
Col1(3) = 200
Col1(4) = 220
Col1(5) = 242
Col1(6) = 104
Col1(7) = 212
Col1(8) = 177
Col1(9) = 212
Col1(10) = 191
Col1(11) = 250
Col1(12) = 117
Col1(13) = 103
Col1(14) = 200
Col1(15) = 41
Col1(16) = 131

Col2(1) = 136
Col2(2) = 194
Col2(3) = 13
Col2(4) = 202
Col2(5) = 93
Col2(6) = 27
Col2(7) = 210
Col2(8) = 233
Col2(9) = 5
Col2(10) = 70
Col2(11) = 102
Col2(12) = 231
Col2(13) = 69
Col2(14) = 97
Col2(15) = 42
Col2(16) = 118

Col3(1) = 148
Col3(2) = 208
Col3(3) = 132
Col3(4) = 95
Col3(5) = 134
Col3(6) = 70
Col3(7) = 150
Col3(8) = 213
Col3(9) = 54
Col3(10) = 172
Col3(11) = 71
Col3(12) = 67
Col3(13) = 14
Col3(14) = 74
Col3(15) = 165
Col3(16) = 90

End Sub

Sub InitEmb()
MSComm1.PortOpen = True

MSComm1.Output = "{27}"
Sleep 100
MSComm1.Output = "{1C80}"
Sleep 100
MSComm1.Output = "{5C80}"
Sleep 100

MSComm1.Output = "{1E00}"
Sleep 100
MSComm1.Output = "{5E00}"
Sleep 100

MSComm1.Output = "{1B00}"
Sleep 100

MSComm1.Output = "{1D00}"
Sleep 100
MSComm1.Output = "{5D00}"
Sleep 100

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -