I am doing a project " Infant monitoring system using PIC16F877A". It uses 3 sensors LM35 temperature sensor, CO2 sensor and breath rate sensor. We are transmitting those signals through RS-232 to PC for displaying in VB application. I am new to the VB sessions.
I want to know these :
1. When transmitting the data to the PC through RS-232 cables, where will the data be stored?
2. In the following program, plz explain
I want to know these :
1. When transmitting the data to the PC through RS-232 cables, where will the data be stored?
2. In the following program, plz explain
Code:
Dim tempA As Variant
Dim tempB As Variant
Public AvaL, BvaL, CvaL As Integer
Public FlagA, FlagB, FlagC As Integer
Private Sub cmd_1_Click()
graphA.Show
End Sub
Private Sub cmd_2_Click()
graphB.Show
End Sub
Private Sub cmd_3_Click()
graphC.Show
End Sub
Private Sub Form_Load()
With MSComm1
[B].CommPort = 1
.InputLen = 1[/B]
[B].InputMode = comInputModeText
.SThreshold = 1
.RThreshold = 1[/B]
.Settings = "9600,n,8,1"
[B].Handshaking = comNone
.PortOpen = True[/B]
End With
FlagA = 0
FlagB = 0
FlagC = 0
End Sub
[B]Private Sub MSComm1_OnComm()
Dim Buffer As String
Select Case MSComm1.CommEvent
Case comEvReceive
Buffer = MSComm1.Input
Call HandleInpuT(Buffer)
End Select
End Sub[/B]
Function HandleInpuT(ByVal DataBuf As String)
If tempB = [B]CInt(&HAB)[/B] Then
Select Case tempA
Case [B]CInt(&HB1)[/B]
txtTemperature = ((Val(Asc(DataBuf) + 81 + Rnd)) / 10)
Case [B]CInt(&HB2)[/B]
txtBreath = Val(Asc(DataBuf) - 100)
Case [B]CInt(&HB3)[/B]
txtCO2 = (Val(Asc(DataBuf) + Rnd)) * 500
End Select
End If
tempB = tempA
tempA = Asc(DataBuf)
End Function
Private Sub Timer1_Timer()
AvaL = Val(txtTemperature)
BvaL = Val(txtCO2)
CvaL = Val(txtBreath)
If AvaL > 265 Then
'MSComm1.Output = "1"
FlagA = 1
Else
'MSComm1.Output = "2"
FlagA = 0
End If
If BvaL > 2000 And BvaL < 9000 Then
FlagB = 2
ElseIf BvaL > 8000 Then
'MSComm1.Output = "1"
FlagB = 1
Else
'MSComm1.Output = "2"
FlagB = 0
End If
If CvaL > 20 And CvaL < 40 Then
FlagC = 2
ElseIf CvaL > 39 Then
FlagC = 1
'MSComm1.Output = "1"
Else
'MSComm1.Output = "2"
FlagC = 0
End If
If AvaL > 265 Or BvaL > 8000 Or CvaL > 39 Then
MSComm1.Output = "1"
Else
MSComm1.Output = "2"
End If
End Sub
/CODE]
In these code the highlighted black portion is my problem....
I want to know these:
1. What is MSComm1 and what are COmmport and InputLen....why are they used..what purpose? Also tell about R threshold, S threshold, Handshaking and Port open(what port is open??)
2. WHat is the purpose of this function
Private Sub MSComm1_OnComm()
Dim Buffer As String
Select Case MSComm1.CommEvent
Case comEvReceive
Buffer = MSComm1.Input
Call HandleInpuT(Buffer)
End Select
End Sub
in the program??
3. WHat is this Case CInt(&HB2) ? what is done here?
Sorry for the inconvenience.... I dont know VB so after doing my programming in PIC16F877A i gave it to a project centre who designed the code....He didnt explain it properly...SO plz help....
Also if you have any ebooks or so where i can learn about these things plz post....
Last edited: