📄 formprincipal.frm
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "mscomm32.ocx"
Begin VB.Form FormPrincipal
BackColor = &H00400000&
BorderStyle = 0 'None
Caption = "DIGI"
ClientHeight = 4245
ClientLeft = 0
ClientTop = 0
ClientWidth = 4905
ControlBox = 0 'False
Icon = "FormPrincipal.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Moveable = 0 'False
ScaleHeight = 4245
ScaleWidth = 4905
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton cmdsalir
Caption = "Salir"
Height = 255
Left = 3600
TabIndex = 20
Top = 3960
Width = 1095
End
Begin VB.Frame Frame3
BackColor = &H00400000&
Caption = "PESO"
ForeColor = &H00FFFFFF&
Height = 1455
Left = 180
TabIndex = 18
Top = 2340
Width = 4515
Begin VB.Timer TimerGeneral
Enabled = 0 'False
Interval = 100
Left = 3840
Top = 360
End
Begin MSCommLib.MSComm MSComm1
Left = 3600
Top = 720
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
CommPort = 3
DTREnable = -1 'True
InputLen = 1
End
Begin VB.Label peso
BackColor = &H00400000&
Caption = "0,000 Kg"
BeginProperty Font
Name = "Arial"
Size = 36
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 915
Left = 360
TabIndex = 19
Top = 360
Width = 3075
End
End
Begin VB.Frame Frame2
BackColor = &H00400000&
Caption = "CONFIGURACION"
ForeColor = &H00FFFFFF&
Height = 1995
Left = 1440
TabIndex = 9
Top = 180
Width = 3255
Begin VB.ComboBox ComboBitsStop
Height = 315
ItemData = "FormPrincipal.frx":08CA
Left = 1560
List = "FormPrincipal.frx":08D4
Style = 2 'Dropdown List
TabIndex = 13
Top = 1440
Width = 1335
End
Begin VB.ComboBox ComboBitsDatos
Height = 315
ItemData = "FormPrincipal.frx":08DE
Left = 1560
List = "FormPrincipal.frx":08E8
Style = 2 'Dropdown List
TabIndex = 12
Top = 1080
Width = 1335
End
Begin VB.ComboBox ComboParidad
Height = 315
ItemData = "FormPrincipal.frx":08F2
Left = 1560
List = "FormPrincipal.frx":08FF
Style = 2 'Dropdown List
TabIndex = 11
Top = 720
Width = 1335
End
Begin VB.ComboBox ComboVelocidad
Height = 315
ItemData = "FormPrincipal.frx":090C
Left = 1560
List = "FormPrincipal.frx":091F
Style = 2 'Dropdown List
TabIndex = 10
Top = 360
Width = 1335
End
Begin VB.Label Label4
BackColor = &H00400000&
Caption = "Bits Stop:"
ForeColor = &H00FFFFFF&
Height = 255
Left = 720
TabIndex = 17
Top = 1440
Width = 855
End
Begin VB.Label Label3
BackColor = &H00400000&
Caption = "Bits Datos:"
ForeColor = &H00FFFFFF&
Height = 255
Left = 720
TabIndex = 16
Top = 1080
Width = 855
End
Begin VB.Label Label2
BackColor = &H00400000&
Caption = "Paridad:"
ForeColor = &H00FFFFFF&
Height = 255
Left = 720
TabIndex = 15
Top = 720
Width = 855
End
Begin VB.Label Label1
BackColor = &H00400000&
Caption = "Velocidad:"
ForeColor = &H00FFFFFF&
Height = 255
Index = 1
Left = 720
TabIndex = 14
Top = 360
Width = 855
End
End
Begin VB.Frame Frame1
BackColor = &H00400000&
Caption = "COM"
ForeColor = &H00FFFFFF&
Height = 1995
Left = 180
TabIndex = 0
Top = 180
Width = 1095
Begin VB.OptionButton com
BackColor = &H00400000&
Caption = "Com8"
ForeColor = &H00FFFFFF&
Height = 195
Index = 7
Left = 180
TabIndex = 8
Top = 1620
Width = 735
End
Begin VB.OptionButton com
BackColor = &H00400000&
Caption = "Com7"
ForeColor = &H00FFFFFF&
Height = 195
Index = 6
Left = 180
TabIndex = 7
Top = 1440
Width = 735
End
Begin VB.OptionButton com
BackColor = &H00400000&
Caption = "Com6"
ForeColor = &H00FFFFFF&
Height = 195
Index = 5
Left = 180
TabIndex = 6
Top = 1260
Width = 735
End
Begin VB.OptionButton com
BackColor = &H00400000&
Caption = "Com5"
ForeColor = &H00FFFFFF&
Height = 195
Index = 4
Left = 180
TabIndex = 5
Top = 1080
Width = 735
End
Begin VB.OptionButton com
BackColor = &H00400000&
Caption = "Com4"
ForeColor = &H00FFFFFF&
Height = 195
Index = 3
Left = 180
TabIndex = 4
Top = 900
Width = 735
End
Begin VB.OptionButton com
BackColor = &H00400000&
Caption = "Com3"
ForeColor = &H00FFFFFF&
Height = 195
Index = 2
Left = 180
TabIndex = 3
Top = 720
Width = 735
End
Begin VB.OptionButton com
BackColor = &H00400000&
Caption = "Com2"
ForeColor = &H00FFFFFF&
Height = 195
Index = 1
Left = 180
TabIndex = 2
Top = 540
Width = 735
End
Begin VB.OptionButton com
BackColor = &H00400000&
Caption = "Com1"
ForeColor = &H00FFFFFF&
Height = 195
Index = 0
Left = 180
TabIndex = 1
Top = 360
Value = -1 'True
Width = 735
End
End
End
Attribute VB_Name = "FormPrincipal"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdsalir_Click()
End
End Sub
Private Sub com_Click(Index As Integer)
On Error GoTo error
MSComm1.CommPort = Index + 1
PuertoComunicaciones MSComm1, True, 1
error:
If Err.Number = 8005 Then MsgBox "El puerto COM" & MSComm1.CommPort & " esta abierto por otro programa"
End Sub
Private Sub Form_Load()
'Parametrizacion puerto serie
ComboVelocidad.Text = ComboVelocidad.List(1)
ComboParidad.Text = ComboParidad.List(0)
ComboBitsDatos.Text = ComboBitsDatos.List(1)
ComboBitsStop.Text = ComboBitsStop.List(0)
'Inicializacion de Matrices de Entradas
bPesoRecibido(1) = False
bRecibiendoTrama(1) = False
sTramaRecibida(1) = ""
sTipoEntrada(1) = ""
'Parametros de bascula
PuertoComunicaciones MSComm1, True, 1
TimerGeneral.Enabled = True
FormPrincipal.Show
sTipoEntrada(1) = ""
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
'Cerramos los puertos
PuertoComunicaciones MSComm1, False
End Sub
Private Sub TimerGeneral_Timer()
TimerGeneral.Enabled = False
'Pool de entradas
ComprobarPuertoSinRespuesta MSComm1, 1
TimerGeneral.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -