Home > Software engineering >  Graduation design. The microcontroller through the serial port in PC VB program temperature curve ca
Graduation design. The microcontroller through the serial port in PC VB program temperature curve ca

Time:10-08

Everybody is good, recently in a design, is a single-chip microcomputer by PC in VB showing temperature curve, but I'm not very will write programs, everyone a great god can help you

CodePudding user response:

Google vb mschart

CodePudding user response:

What do you mean??

CodePudding user response:

Google keyword I say, can find the answer,

CodePudding user response:

Pro, can you help me write a, should quickly, help me, I have most of the code, but I can't draw interface, you help me to paint, supplement?

CodePudding user response:

Dim x As the Variant
As the Variant Dim s

Private Sub Command1_Click ()
Timer1. Enabled=True
MSComm1. RThreshold=1
End Sub

Private Sub Command2_Click ()
Timer1. Enabled=False
MSComm1. RThreshold=0
End Sub

Private Sub Command3_Click ()
Dim b (1) the As Byte
B (0)=& amp; The H2
MSComm1. The Output=b

End Sub

Private Sub Command4_Click ()
Dim b (1) the As Byte
B (0)=& amp; H0
MSComm1. The Output=b

End Sub

Private Sub Command5_Click ()
End
End Sub

Private Sub open _Click ()
Dim b (1) the As Byte
B (0)=& amp; H3
MSComm1. The Output=b

End Sub

Private Sub Command7_Click ()
Dim b (1) the As Byte
B (0)=& amp; H1
MSComm1. The Output=b

End Sub

Private Sub Command8_Click ()
Picture1. Cls
End Sub

Private Sub Form_Load ()
With MSComm1
. The CommPort=1 'use COM1
. Settings="9600, N, 8, 1" 'set the communication port parameter
. InBufferSize=1 'set the receive buffer to 1 byte
Sets the send buffer. OutBufferSize=1 '1 byte
. An InputMode=comInputModeBinary 'Settings receive data model for binary form
. InputLen=1 'set the Input a number of bytes read from the receive buffer is 1
. SThreshold=1 'setting the Output a number of bytes read from the sending buffer to 1
. RThreshold=1 'is set to receive a byte produced OnComm events
. InBufferCount=0 'removal receive buffer

. OutBufferCount=0 'removal send buffer
. PortOpen=True 'open communication port
End With

End Sub





Private Sub MSComm1_OnComm ()
Select the current state of the Case MSComm1.Com mEvent 'judgment MSComm control
Dim temp As the Variant, buffer () As Byte
Case comEventOverrun
Text2. Text=""
Text2. SetFocus
The Exit Sub
Case comEventRxOver
Text2. Text=""
Text2. SetFocus3
The Exit Sub
Case comEventTxFull
Text2. Text=""
Text2. SetFocus
The Exit Sub
Case comEvReceive 'receiving event generated by the received Rthreshold bytes
'temp=MSComm1. Input
'buffer=temp
'For I=0 To UBound (buffer)
's=s & amp; (buffer (I))
'Next I
S=AscB (MSComm1. Input)
Text1. Text=s
MSComm1. InBufferCount=0
RThreshold=0 'close the OnComm event receive
End the Select
End Sub
Private Sub Picture1_Click ()
Picture1. Scale (0, 50) - (50, 0)
Picture1. Line (5, 5) - (5, 50)
Picture1. Line (5, 5) - (5) 50,
Picture1. CurrentX=3:
Picture1. CurrentY=50:
Picture1. Print "Y (C),"
Picture1. CurrentX=43:
Picture1. CurrentY=4:
Picture1. Print "X (ms)
"End Sub
Private Sub Timer1_Timer ()
X=x + 0.1
Picture1. PSet (x, s), RGB (24, 32, 5)
Picture1. Line (x - 0.5, s) - (x, s)
If x=20 Then x=0
End Sub
Private Sub Timer2_Timer ()
T.T ext=Format (Now, "on dd mm yyyy years") & amp; WeekdayName (Weekday (Now)) & amp; The Format (Now, "hh: mm: ss")
End Sub

CodePudding user response:

Mama ah! Laptop cool to have a control program
  • Related