![]()
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
Option Strict Off
Option Explicit On
Friend Class frmMain
Inherits System.Windows.Forms.Form
Private U(7) As Short
Private Sub btnQuit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles btnQuit.Click
HB627_Close()
End
End Sub
Private Sub BtnStart_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles BtnStart.Click
If HB627_Open(CByte(Val(txtComPort.Text)), 5000) Then
btnStart.Enabled = False
btnStop.Enabled = True
tmrPolling.Enabled = True
Else
MsgBox("Can't open comport!", MsgBoxStyle.OKOnly, "Error")
End If
End Sub
Private Sub btnStop_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles btnStop.Click
HB627_Close()
btnStart.Enabled = True
btnStop.Enabled = False
tmrPolling.Enabled = False
Init_ProgressBar()
End Sub
Private Sub Init_ProgressBar()
Dim i As Short
For i = 0 To 7
U(i) = 0
ProgressBar(i).Value = 0
txtChannel(i).Text = ""
Next
End Sub
Private Sub tmrPolling_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles tmrPolling.Tick
Dim ErrMsg As String
'UPGRADE_NOTE: Error wurde aktualisiert auf Error_Renamed. Klicken Sie hier für weitere Informationen: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
Dim Error_Renamed As Byte
Dim i As Short
If HB627_Read_All_Channel(U(0), Error_Renamed) Then
For i = 0 To 7
txtChannel(i).Text = Str(U(i))
ProgressBar(i).Value = U(i)
Next
Else
tmrPolling.Enabled = False
Select Case Error_Renamed
Case Err_No
ErrMsg = "No error"
Case ERR_TX
ErrMsg = "Tx error"
Case ERR_RX
ErrMsg = "Rx error"
Case ERR_CS
ErrMsg = "Control sum error"
Case ERR_PARAM
ErrMsg = "Parameters value error"
End Select
MsgBox(ErrMsg, MsgBoxStyle.OKOnly, "Error")
End
End If
End Sub
End Class
|
|
|
Quellcode |
1 2 |
frmMain = 44, 58, 825, 675, , 22, 29, 803, 646, C HB627_Module = 66, 87, 936, 646, |
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
Type=Exe
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\system32\stdole2.tlb#OLE Automation
Reference=*\G{00025E01-0000-0000-C000-000000000046}#5.0#0#C:\Program Files\Common Files\Microsoft Shared\DAO\dao360.dll#Microsoft DAO 3.6 Object Library
Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; mscomctl.ocx
Form=hb627.frm
Module=HB627_Module; hb627_module.bas
IconForm="frmMain"
Startup="frmMain"
HelpFile=""
Title="hb627"
ExeName32="hb627_demo.exe"
Command32=""
Name="hb627"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName="."
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1
DebugStartupOption=0
[MS Transaction Server]
AutoRefresh=1
|
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
Attribute VB_Name = "HB627_Module" Option Explicit ' Declare statements for all the functions in the HB627.dll ' NOTE: These statements assume that the DLL file is located in ' the same directory as this project. ' If you change the location of the DLL, be sure to change the location ' in the declare statements also. Public Declare Function HB627_Open Lib "hb627.dll" (ByVal ComPort As Byte, ByVal Timeout As Long) As Boolean Public Declare Function HB627_Close Lib "hb627.dll" () As Boolean Public Declare Function HB627_Read_Channel Lib "hb627.dll" (ByVal Channel As Byte, ByRef Result As Integer, ByRef Error As Byte) As Boolean Public Declare Function HB627_Read_All_Channel Lib "hb627.dll" (ByRef Result_Array As Integer, ByRef Error As Byte) As Boolean 'Errors Public Const Err_No = 0 'no error Public Const ERR_TX = 1 'Tx error Public Const ERR_RX = 2 'Rx error Public Const ERR_CS = 3 'control sum error Public Const ERR_PARAM = 4 'parameters value error |
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 |
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form frmMain
BorderStyle = 1 'Fixed Single
Caption = "HB627 - 12bit USB ADC"
ClientHeight = 4020
ClientLeft = 45
ClientTop = 435
ClientWidth = 10770
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4020
ScaleWidth = 10770
StartUpPosition = 3 'Windows Default
Begin VB.Timer tmrPolling
Enabled = 0 'False
Interval = 100
Left = 3840
Top = 120
End
Begin VB.CommandButton btnStop
Caption = "Stop"
Enabled = 0 'False
Height = 495
Left = 480
TabIndex = 28
Top = 2160
Width = 1575
End
Begin MSComctlLib.ProgressBar ProgressBar
Height = 255
Index = 0
Left = 4680
TabIndex = 20
Top = 720
Width = 5655
_ExtentX = 9975
_ExtentY = 450
_Version = 393216
Appearance = 1
Max = 4095
Scrolling = 1
End
Begin VB.TextBox txtChannel
Alignment = 1 'Right Justify
Height = 285
Index = 7
Left = 3600
TabIndex = 11
Top = 3240
Width = 855
End
Begin VB.TextBox txtChannel
Alignment = 1 'Right Justify
Height = 285
Index = 6
Left = 3600
TabIndex = 10
Top = 2880
Width = 855
End
Begin VB.TextBox txtChannel
Alignment = 1 'Right Justify
Height = 285
Index = 5
Left = 3600
TabIndex = 9
Top = 2520
Width = 855
End
Begin VB.TextBox txtChannel
Alignment = 1 'Right Justify
Height = 285
Index = 4
Left = 3600
TabIndex = 8
Top = 2160
Width = 855
End
Begin VB.TextBox txtChannel
Alignment = 1 'Right Justify
Height = 285
Index = 3
Left = 3600
TabIndex = 7
Top = 1800
Width = 855
End
Begin VB.TextBox txtChannel
Alignment = 1 'Right Justify
Height = 285
Index = 2
Left = 3600
TabIndex = 6
Top = 1440
Width = 855
End
Begin VB.TextBox txtChannel
Alignment = 1 'Right Justify
Height = 285
Index = 1
Left = 3600
TabIndex = 5
Top = 1080
Width = 855
End
Begin VB.TextBox txtChannel
Alignment = 1 'Right Justify
Height = 285
Index = 0
Left = 3600
TabIndex = 4
Top = 720
Width = 855
End
Begin VB.CommandButton btnQuit
Caption = "Quit"
Height = 495
Left = 480
TabIndex = 3
Top = 3000
Width = 1575
End
Begin VB.CommandButton btnStart
Caption = "Start"
Height = 495
Left = 480
TabIndex = 2
Top = 1320
Width = 1575
End
Begin VB.TextBox txtComPort
Height = 285
Left = 960
TabIndex = 0
Text = "1"
Top = 720
Width = 615
End
Begin MSComctlLib.ProgressBar ProgressBar
Height = 255
Index = 1
Left = 4680
TabIndex = 21
Top = 1080
Width = 5655
_ExtentX = 9975
_ExtentY = 450
_Version = 393216
Appearance = 1
Max = 4095
Scrolling = 1
End
Begin MSComctlLib.ProgressBar ProgressBar
Height = 255
Index = 2
Left = 4680
TabIndex = 22
Top = 1440
Width = 5655
_ExtentX = 9975
_ExtentY = 450
_Version = 393216
Appearance = 1
Max = 4095
Scrolling = 1
End
Begin MSComctlLib.ProgressBar ProgressBar
Height = 255
Index = 3
Left = 4680
TabIndex = 23
Top = 1800
Width = 5655
_ExtentX = 9975
_ExtentY = 450
_Version = 393216
Appearance = 1
Max = 4095
Scrolling = 1
End
Begin MSComctlLib.ProgressBar ProgressBar
Height = 255
Index = 4
Left = 4680
TabIndex = 24
Top = 2160
Width = 5655
_ExtentX = 9975
_ExtentY = 450
_Version = 393216
Appearance = 1
Max = 4095
Scrolling = 1
End
Begin MSComctlLib.ProgressBar ProgressBar
Height = 255
Index = 5
Left = 4680
TabIndex = 25
Top = 2520
Width = 5655
_ExtentX = 9975
_ExtentY = 450
_Version = 393216
Appearance = 1
Max = 4095
Scrolling = 1
End
Begin MSComctlLib.ProgressBar ProgressBar
Height = 255
Index = 6
Left = 4680
TabIndex = 26
Top = 2880
Width = 5655
_ExtentX = 9975
_ExtentY = 450
_Version = 393216
Appearance = 1
Max = 4095
Scrolling = 1
End
Begin MSComctlLib.ProgressBar ProgressBar
Height = 255
Index = 7
Left = 4680
TabIndex = 27
Top = 3240
Width = 5655
_ExtentX = 9975
_ExtentY = 450
_Version = 393216
Appearance = 1
Max = 4095
Scrolling = 1
End
Begin VB.Label lblChannel
Caption = "Channel N8, mV"
Height = 255
Index = 7
Left = 2280
TabIndex = 19
Top = 3240
Width = 1215
End
Begin VB.Label lblChannel
Caption = "Channel N7, mV"
Height = 255
Index = 6
Left = 2280
TabIndex = 18
Top = 2880
Width = 1215
End
Begin VB.Label lblChannel
Caption = "Channel N6, mV"
Height = 255
Index = 5
Left = 2280
TabIndex = 17
Top = 2520
Width = 1215
End
Begin VB.Label lblChannel
Caption = "Channel N5, mV"
Height = 255
Index = 4
Left = 2280
TabIndex = 16
Top = 2160
Width = 1215
End
Begin VB.Label lblChannel
Caption = "Channel N4, mV"
Height = 255
Index = 3
Left = 2280
TabIndex = 15
Top = 1800
Width = 1215
End
Begin VB.Label lblChannel
Caption = "Channel N3, mV"
Height = 255
Index = 2
Left = 2280
TabIndex = 14
Top = 1440
Width = 1215
End
Begin VB.Label lblChannel
Caption = "Channel N2, mV"
Height = 255
Index = 1
Left = 2280
TabIndex = 13
Top = 1080
Width = 1215
End
Begin VB.Label lblChannel
Caption = "Channel N1, mV"
Height = 255
Index = 0
Left = 2280
TabIndex = 12
Top = 720
Width = 1215
End
Begin VB.Label lblComPort
Caption = "ComPort Number"
Height = 255
Left = 720
TabIndex = 1
Top = 360
Width = 1335
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private U(7) As Integer
Private Sub btnQuit_Click()
HB627_Close
End
End Sub
Private Sub BtnStart_Click()
If HB627_Open(CByte(Val(txtComPort.Text)), 5000) Then
btnStart.Enabled = False
btnStop.Enabled = True
tmrPolling.Enabled = True
Else
MsgBox "Can't open comport!", vbOKOnly, "Error"
End If
End Sub
Private Sub btnStop_Click()
HB627_Close
btnStart.Enabled = True
btnStop.Enabled = False
tmrPolling.Enabled = False
Init_ProgressBar
End Sub
Private Sub Init_ProgressBar()
Dim i As Integer
For i = 0 To 7
U(i) = 0
ProgressBar(i).Value = 0
txtChannel(i).Text = ""
Next
End Sub
Private Sub tmrPolling_Timer()
Dim ErrMsg As String
Dim Error As Byte
Dim i As Integer
If HB627_Read_All_Channel(U(0), Error) Then
For i = 0 To 7
txtChannel(i).Text = Str(U(i))
ProgressBar(i).Value = U(i)
Next
Else
tmrPolling.Enabled = False
Select Case Error
Case Err_No
ErrMsg = "No error"
Case ERR_TX
ErrMsg = "Tx error"
Case ERR_RX
ErrMsg = "Rx error"
Case ERR_CS
ErrMsg = "Control sum error"
Case ERR_PARAM
ErrMsg = "Parameters value error"
End Select
MsgBox ErrMsg, vbOKOnly, "Error"
End
End If
End Sub
|
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 |
Private Sub BtnStart_Click()
If HB627_Open(CByte(Val(txtComPort.Text)), 5000) Then
BtnStart.Enabled = False
btnStop.Enabled = True
tmrPolling.Enabled = True
Else
MsgBox "Can't open comport!", vbOKOnly, "Error"
End If
End Sub
|
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 |
Private Sub btnStop_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles btnStop.Click HB627_Close() btnStart.Enabled = True btnStop.Enabled = False tmrPolling.Enabled = False Init_ProgressBar() End Sub |
|
|
Visual Basic Quellcode |
1 2 3 |
Private Sub BtnStart_Click() End Sub |
|
|
Visual Basic Quellcode |
1 2 3 4 5 6 7 8 |
If HB627_Open(CByte(Val(txtComPort.Text)), 5000) Then BtnStart.Enabled = False btnStop.Enabled = True tmrPolling.Enabled = True Else MsgBox "Can't open comport!", vbOKOnly, "Error" End If |
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
Private Sub tmrPolling_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles tmrPolling.Tick Dim ErrMsg As String 'UPGRADE_NOTE: Error wurde aktualisiert auf Error_Renamed. Klicken Sie hier für weitere Informationen: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"' Dim Error_Renamed As Byte Dim i As Short If HB627_Read_All_Channel(U(0), Error_Renamed) Then For i = 0 To 7 txtChannel(i).Text = Str(U(i)) ProgressBar(i).Value = U(i) Next Else tmrPolling.Enabled = False Select Case Error_Renamed Case Err_No ErrMsg = "No error" Case ERR_TX ErrMsg = "Tx error" Case ERR_RX ErrMsg = "Rx error" Case ERR_CS ErrMsg = "Control sum error" Case ERR_PARAM ErrMsg = "Parameters value error" End Select MsgBox(ErrMsg, MsgBoxStyle.OKOnly, "Error") End End If End Sub End Class |
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 |
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form frmMain
BorderStyle = 1 'Fixed Single
Caption = "HB627 - 12bit USB ADC"
ClientHeight = 4020
ClientLeft = 45
ClientTop = 435
ClientWidth = 10770
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4020
ScaleWidth = 10770
StartUpPosition = 3 'Windows Default
Begin VB.Timer tmrPolling
Enabled = 0 'False
Interval = 100
Left = 3840
Top = 120
End
Begin VB.CommandButton btnStop
Caption = "Stop"
Enabled = 0 'False
Height = 495
Left = 480
TabIndex = 28
Top = 2160
Width = 1575
End
Begin MSComctlLib.ProgressBar ProgressBar
Height = 255
Index = 0
Left = 4680
TabIndex = 20
Top = 720
Width = 5655
_ExtentX = 9975
_ExtentY = 450
_Version = 393216
Appearance = 1
Max = 4095
Scrolling = 1
End
Begin VB.TextBox txtChannel
Alignment = 1 'Right Justify
Height = 285
Index = 7
Left = 3600
TabIndex = 11
Top = 3240
Width = 855
End
Begin VB.TextBox txtChannel
Alignment = 1 'Right Justify
Height = 285
Index = 6
Left = 3600
TabIndex = 10
Top = 2880
Width = 855
End
Begin VB.TextBox txtChannel
Alignment = 1 'Right Justify
Height = 285
Index = 5
Left = 3600
TabIndex = 9
Top = 2520
Width = 855
End
Begin VB.TextBox txtChannel
Alignment = 1 'Right Justify
Height = 285
Index = 4
Left = 3600
TabIndex = 8
Top = 2160
Width = 855
End
Begin VB.TextBox txtChannel
Alignment = 1 'Right Justify
Height = 285
Index = 3
Left = 3600
TabIndex = 7
Top = 1800
Width = 855
End
Begin VB.TextBox txtChannel
Alignment = 1 'Right Justify
Height = 285
Index = 2
Left = 3600
TabIndex = 6
Top = 1440
Width = 855
End
Begin VB.TextBox txtChannel
Alignment = 1 'Right Justify
Height = 285
Index = 1
Left = 3600
TabIndex = 5
Top = 1080
Width = 855
End
Begin VB.TextBox txtChannel
Alignment = 1 'Right Justify
Height = 285
Index = 0
Left = 3600
TabIndex = 4
Top = 720
Width = 855
End
Begin VB.CommandButton btnQuit
Caption = "Quit"
Height = 495
Left = 480
TabIndex = 3
Top = 3000
Width = 1575
End
Begin VB.CommandButton btnStart
Caption = "Start"
Height = 495
Left = 480
TabIndex = 2
Top = 1320
Width = 1575
End
Begin VB.TextBox txtComPort
Height = 285
Left = 960
TabIndex = 0
Text = "1"
Top = 720
Width = 615
End
Begin MSComctlLib.ProgressBar ProgressBar
Height = 255
Index = 1
Left = 4680
TabIndex = 21
Top = 1080
Width = 5655
_ExtentX = 9975
_ExtentY = 450
_Version = 393216
Appearance = 1
Max = 4095
Scrolling = 1
End
Begin MSComctlLib.ProgressBar ProgressBar
Height = 255
Index = 2
Left = 4680
TabIndex = 22
Top = 1440
Width = 5655
_ExtentX = 9975
_ExtentY = 450
_Version = 393216
Appearance = 1
Max = 4095
Scrolling = 1
End
Begin MSComctlLib.ProgressBar ProgressBar
Height = 255
Index = 3
Left = 4680
TabIndex = 23
Top = 1800
Width = 5655
_ExtentX = 9975
_ExtentY = 450
_Version = 393216
Appearance = 1
Max = 4095
Scrolling = 1
End
Begin MSComctlLib.ProgressBar ProgressBar
Height = 255
Index = 4
Left = 4680
TabIndex = 24
Top = 2160
Width = 5655
_ExtentX = 9975
_ExtentY = 450
_Version = 393216
Appearance = 1
Max = 4095
Scrolling = 1
End
Begin MSComctlLib.ProgressBar ProgressBar
Height = 255
Index = 5
Left = 4680
TabIndex = 25
Top = 2520
Width = 5655
_ExtentX = 9975
_ExtentY = 450
_Version = 393216
Appearance = 1
Max = 4095
Scrolling = 1
End
Begin MSComctlLib.ProgressBar ProgressBar
Height = 255
Index = 6
Left = 4680
TabIndex = 26
Top = 2880
Width = 5655
_ExtentX = 9975
_ExtentY = 450
_Version = 393216
Appearance = 1
Max = 4095
Scrolling = 1
End
Begin MSComctlLib.ProgressBar ProgressBar
Height = 255
Index = 7
Left = 4680
TabIndex = 27
Top = 3240
Width = 5655
_ExtentX = 9975
_ExtentY = 450
_Version = 393216
Appearance = 1
Max = 4095
Scrolling = 1
End
Begin VB.Label lblChannel
Caption = "Channel N8, mV"
Height = 255
Index = 7
Left = 2280
TabIndex = 19
Top = 3240
Width = 1215
End
Begin VB.Label lblChannel
Caption = "Channel N7, mV"
Height = 255
Index = 6
Left = 2280
TabIndex = 18
Top = 2880
Width = 1215
End
Begin VB.Label lblChannel
Caption = "Channel N6, mV"
Height = 255
Index = 5
Left = 2280
TabIndex = 17
Top = 2520
Width = 1215
End
Begin VB.Label lblChannel
Caption = "Channel N5, mV"
Height = 255
Index = 4
Left = 2280
TabIndex = 16
Top = 2160
Width = 1215
End
Begin VB.Label lblChannel
Caption = "Channel N4, mV"
Height = 255
Index = 3
Left = 2280
TabIndex = 15
Top = 1800
Width = 1215
End
Begin VB.Label lblChannel
Caption = "Channel N3, mV"
Height = 255
Index = 2
Left = 2280
TabIndex = 14
Top = 1440
Width = 1215
End
Begin VB.Label lblChannel
Caption = "Channel N2, mV"
Height = 255
Index = 1
Left = 2280
TabIndex = 13
Top = 1080
Width = 1215
End
Begin VB.Label lblChannel
Caption = "Channel N1, mV"
Height = 255
Index = 0
Left = 2280
TabIndex = 12
Top = 720
Width = 1215
End
Begin VB.Label lblComPort
Caption = "ComPort Number"
Height = 255
Left = 720
TabIndex = 1
Top = 360
Width = 1335
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
|
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
Option Explicit
Private U(7) As Integer
Private Sub btnQuit_Click()
HB627_Close
End
End Sub
Private Sub BtnStart_Click()
If HB627_Open(CByte(Val(txtComPort.Text)), 5000) Then
btnStart.Enabled = False
btnStop.Enabled = True
tmrPolling.Enabled = True
Else
MsgBox "Can't open comport!", vbOKOnly, "Error"
End If
End Sub
Private Sub btnStop_Click()
HB627_Close
btnStart.Enabled = True
btnStop.Enabled = False
tmrPolling.Enabled = False
Init_ProgressBar
End Sub
|
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
Private Sub Init_ProgressBar()
Dim i As Integer
For i = 0 To 7
U(i) = 0
ProgressBar(i).value = 0
txtChannel(i).Text = ""
Next
End Sub
Private Sub tmrPolling_Timer()
Dim ErrMsg As String
Dim Error As Byte
Dim i As Integer
If HB627_Read_All_Channel(U(0), Error) Then
For i = 0 To 7
txtChannel(i).Text = Str(U(i))
ProgressBar(i).value = U(i)
Next
Else
tmrPolling.Enabled = False
Select Case Error
Case Err_No
ErrMsg = "No error"
Case ERR_TX
ErrMsg = "Tx error"
Case ERR_RX
ErrMsg = "Rx error"
Case ERR_CS
ErrMsg = "Control sum error"
Case ERR_PARAM
ErrMsg = "Parameters value error"
End Select
MsgBox ErrMsg, vbOKOnly, "Error"
End
End If
End Sub
|
FileSpy 1.2 - Herausfinden, wo Programme ihre Daten speichern! Zum Download |
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 |
Private Sub Init_ProgressBar()
Dim i As Integer
For i = 0 To 7
U(i) = 0
ProgressBar(i).value = 0
txtChannel(i).Text = ""
Next
End Sub
|