Hi, i m a newbie in vb. I have this code which i have attached here. I have to use it to display live ECG signal using RS-232 cable. its my graduation project. I know the code is big , but please need help badlyyyy.

I have installed vb 6, now when i click on new project should i choose "Standard EXE" or "Visual Basic Application" icon ???? Please i m ready to learn this, i need a head start, please please help me.

Edited 7 Years Ago by sundy123456: n/a

Attachments
Form4.frm
Private Sub BTemptimer_Timer()
MSComm1.Output = "[45]"
Sleep (20)
Rtext = MSComm1.Input
Rtext = Mid$(Rtext, 2, 4)
Pt2 = T2
T2 = Val("&h" & Rtext)
T2 = T2 / 5
T2 = -T2+195
T2=Round(T2,1)
If T2 < 77 Then T2 = Pt2
End If
Text7.text =T2
Label4.Caption = "BodyTemp Vs Time"
DrawWidth = 2
Line (536, 184)-(536, 384), vbYellow
Line (536, 384)-(744, 384), vbYellow
Line (528, 192)-(536, 184), vbYellow
Line (544, 192)-(536, 184), vbYellow
Line (736, 376)-(744, 384), vbYellow
Line (736, 392)-(744, 384), vbYellow
DrawWidth = 2
Line (oldx, oldy)-(536 + k, 384 - (T2 / (200 / 200#))), vbGreen
DrawWidth = 1
oldx = 536 + k
oldy = 384 - (T2 / (200 / 200#))
k = k + 3
If k > 208 Then
Line (528, 182)-(744, 384), Form4.BackColor, BF
oldx = 536#
oldy = 384#
k = 0
End If
End Sub
'Private Sub btimer_Timer()
'btimer.Enabled = False
'out = out And &HCF
'End Sub
Private Sub Command1_Click()
MSComm1.Output = "[3ffffbfff]"
Sleep (50)
End
End Sub
Private Sub Command3_Click()
Form4.Hide
Form3.Show
End Sub
Private Sub Ecg1Timer_Timer()
MSComm1.Output = "[40]"
Sleep (50)
Rtext = MSComm1.Input
Rtext = Mid$(Rtext, 2, 4)
Ecg1 = Val("&h" & Rtext)
Ecg1 = Round(Ecg1, 1)
Text9.Text = Ecg1
End Sub
Private Sub Form_Load()
For i = 1 To 100
Egra1(i) = 50
Next
ptr = 19
MSComm1.PortOpen = True
MSComm1.Output = "[1ffffbfff]"
Sleep (30)
MSComm1.Output = "[3ffffbfff]"
Sarr(1) = 0
Sarr(2) = 0
Sarr(3) = 0
Sarr(4) = 0
Sarr(5) = 0
Sarr(6) = 0
Fnames(1) = "D:\PanimalarCBSS\hitemp.wav"
Fnames(2) = "D:\PanimalarCBSS\Patient1.wav" 'p1 call
Fnames(3) = "D:\PanimalarCBSS\Patient2.wav" 'p2 call
Fnames(4) = "D:\PanimalarCBSS\Patient3.wav " 'p3 call
Fnames(5) = "D:\PanimalarCBSS\Patient4.wav" 'p4 call
Fnames(6) = "D:\PanimalarCBSS\Saline1.wav" 'p4 call
Fcnt = 0
Label5.Caption = Format(Date, "dd/mm/yyyy)
Set db = OpenDatabase("D:\PanimalarCBSS\hos12.mdb")
Set rs = db.OpenRecordset("patient")
Set Srs = db.OpenRecordset("Digital")
Set Drs = db.OpenRecordset("Doc")
Pa = &H0
Sal = &H0
oldx = 536#
oldy = 384#
k = 0
x=0
a(0) = 5 a(1) = 5 a(2) = 5 a(3) = 6 a(4) = 5 a(5) = 5 a(6) = 5 a(7) = 5 a(8) = 3
a(9) = 10 a(10) = 1 a(11) = 5 a(12) = 5 a(13) = 5 a(14) = 7 a(15) = 5 a(16) = 6
a(17) = 5 a(18) = 5 a(19) = 5
Lg = Shell("C:\Program Files\Microsoft Office\Office\outlook.exe", vbNormalFocus)
End Sub
Private Sub Heartbeattimer_Timer()
MSComm1.Output = "[2]"
Sleep (20)
Rtext = MSComm1.Input
Rtext = Mid$(Rtext, 8, 1)
Beat = Val("&h" & Rtext)
If Beat = 0 And Bflg = 0 Then
Bcnt = Bcnt + 1
Bflg = 1
ElseIf Beat > 0 And Bflg = 1 Then
Bflg = 0
End If
Text1.Text = Round(Bcnt, 0)
End Sub
Private Sub Hrtcmd_Click()
hcnt = 0
Bcnt = 0
End Sub
Private Sub MMControl1_Done(NotifyCode As Integer)
MMControl1.Command = "Close"
Timer2.Enabled = True
End Sub
Private Sub Option1_Click()
Rtemptimer.Enabled = False
BTemptimer.Enabled = False
Ecg1Timer.Enabled = False
Heartbeattimer.Enabled = False
Rtemptimer.Enabled = True
Picture1.Cls
Text1.Text = Clear
Text5.Text = Clear
Text7.Text = Clear
Text9.Text = Clear
grval = 0
End Sub
Private Sub Option2_Click()
Rtemptimer.Enabled = False
BTemptimer.Enabled = False
Ecg1Timer.Enabled = False
Heartbeattimer.Enabled = False
BTemptimer.Enabled = True
Picture1.Cls
Text1.Text = Clear
Text5.Text = Clear
Text7.Text = Clear
Text9.Text = Clear
grval = 1
End Sub
Private Sub Option3_Click()
Rtemptimer.Enabled = False
BTemptimer.Enabled = False
Ecg1Timer.Enabled = False
Heartbeattimer.Enabled = False
Ecg1Timer.Enabled = True
Picture1.Cls
Text1.Text = Clear
Text5.Text = Clear
Text7.Text = Clear
Text9.Text = Clear
End Sub
Private Sub Option7_Click()
Rtemptimer.Enabled = False
BTemptimer.Enabled = False
Ecg1Timer.Enabled = False
Heartbeattimer.Enabled = False
Heartbeattimer.Enabled = True
Picture1.Cls
Text1.Text = Clear
Text5.Text = Clear
Text7.Text = Clear
Text9.Text = Clear
grval = 2
End Sub
Private Sub Rtemptimer_Timer()
MSComm1.Output = "[46]"
Sleep (20)
Rtext = MSComm1.Input
Rtext = Mid$(Rtext, 2, 4)
Pt1 = T1
T1 = Val("&h" & Rtext)
T1 = T1 / 5
T1 = -T1+195
T1 = Round(T1, 1)
If T1 < 77 Then T1 = Pt1
EndIf
Text5.Text = T1
Label4.Caption = "RespTemp Vs Time"
DrawWidth = 2
Line (536, 184)-(536, 384), vbYellow
Line (536, 384)-(744, 384), vbYellow
Line (528, 192)-(536, 184), vbYellow
Line (544, 192)-(536, 184), vbYellow
Line (736, 376)-(745, 385), vbYellow
Line (736, 392)-(744, 384), vbYellow
DrawWidth = 2
Line (oldx, oldy)-(536 + k, 384 - (T1 / (200 / 200#))), vbGreen
DrawWidth = 1
oldx = 536 + k
oldy = 384 - (T1 / (200 / 200#))
k = k + 3
If k > 208 Then
Line (528, 182)-(744, 384), Form4.BackColor, BF
oldx = 536#
oldy = 384#
k = 0
End If
End Sub
Private Sub Timer1_Timer()
Label6.Caption = Format(Time, "hh:mm:ss")
If Heartbeattimer.Enabled = True Then
Text2.Visible = True
Hrtcmd.Visible = True
Else
Text2.Visible = False
Hrtcmd.Visible = False
End If
If (Ecg1 > 100) And Strt = 0 Then
Strt = 1
End If
MSComm1.Output = "[2]"
Sleep (20)
Rtext = MSComm1.Input
Pa = Val("&h" & Mid$(Rtext, 8, 2))
If ((Pa And &H1) = &H0) Then
Label23.Visible = True
p1 = "Yes"
Sarr(2) = 1
If pflg1 = 0 Then
pflg1 = 1
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
.To = "9884169070@sms.sancharnet.in" ' The To Address Field
.Subject = "P1 Call" ' txtSubject - The Subject Field
.Body = "Patient 1 is calling"
.Importance = olImportanceHigh ' Priority. Mostly Not Required
.Send ' Send the Composed Message
End With
Set objOutlookMsg = Nothing
Else
Label23.Visible = False
p1 = "No"
Sarr(2) = 0
End If
If ((Pa And &H2) = &H0) Then
Label24.Visible = True
p2 = "Yes"
Sarr(3) = 1
Else
Label24.Visible = False
p2 = "No"
End If
If ((Pa And &H4) = &H0) Then
Label25.Visible = True
p3 = "Yes"
Sarr(4) = 1
Else
Label25.Visible = False
p3 = "No"
End If
If ((Pa And &H8) = &H0) Then
Label26.Visible = True
p4 = "Yes"
Sarr(5) = 1
Else
Label26.Visible = False
p4 = "No"
End If
MSComm1.Output = "[2]"
Sleep (20)
Rtext = MSComm1.Input
pb = Val("&h" & Mid$(Rtext, 6, 2))
If ((pb And &H10) = &H10) Then
Label8.Visible = False
Saline.Visible = True
Sal = Empty 
Sarr(6) = 1
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
.To = "9884169070@sms.sancharnet.in" ' The To Address Field
.Subject = "saline Emp" ' txtSubject - The Subject Field
.Body = "Saline bottle Empty"
.Importance = olImportanceHigh ' Priority. Mostly Not Required
.Send ' Send the Composed Message
End With
Set objOutlookMsg = Nothing
End If
Else
Saline.Visible = False
Label8.Visible = True
Sal =Not Empty
End If
If (T1 > 100) Or (T2 > 100) Then
Label22.Visible = True
Else
Label22.Visible = False
End If
MSComm1.Output = "[2]"
Sleep (50)
Rtext = MSComm1.Input
pc = Val("&h" & Mid$(Rtext, 6, 2))
pc = pc And &HF
Select Case (pc And &HF)
Case &HE
Atttxt(0) = "Rahul"
Atttxt(1) = "Doctor"
Atttxt(2) = Date
Image1.Picture = LoadPicture("D:\PanimalarCBSS\dr1.gif")
If vvv2 = 0 Then
Atttxt(3) = Time
Drs.AddNew
Drs.Fields(0) = Atttxt(0)
Drs.Fields(1) = Atttxt(1)
Drs.Fields(2) = Atttxt(2)
Drs.Fields(3) = Atttxt(3)
Drs.Update
vvv2 = 1
End If
Case &HD
Atttxt(0) = "Anita"
Atttxt(1) = "Nurse"
Atttxt(2) = Date
Image1.Picture = LoadPicture("D:\PanimalarCBSS\dr2.gif")
If vvv2 = 0 Then
Atttxt(3) = Time
Drs.AddNew
Drs.Fields(0) = Atttxt(0)
Drs.Fields(1) = Atttxt(1)
Drs.Fields(2) = Atttxt(2)
Drs.Fields(3) = Atttxt(3)
Drs.Update
vvv2 = 1
End If
Case &HC
Atttxt(0) = "Naresh"
Atttxt(1) = "Compounder"
Atttxt(2) = Date
Image1.Picture = LoadPicture("D:\PanimalarCBSS\dr3.gif")
If vvv2 = 0 Then
Atttxt(3) = Time
Drs.AddNew
Drs.Fields(0) = Atttxt(0)
Drs.Fields(1) = Atttxt(1)
Drs.Fields(2) = Atttxt(2)
Drs.Fields(3) = Atttxt(3)
Drs.Update
vvv2 = 1
End If
Case &HB
Atttxt(0) = "Bhuvan"
Atttxt(1) = "Doctor"
Atttxt(2) = Date
Image1.Picture = LoadPicture("D:\PanimalarCBSS\dr4.gif")
If vvv2 = 0 Then
Atttxt(3) = Time
Drs.AddNew
Drs.Fields(0) = Atttxt(0)
Drs.Fields(1) = Atttxt(1)
Drs.Fields(2) = Atttxt(2)
Drs.Fields(3) = Atttxt(3)
Drs.Update
vvv2 = 1
End If
Case &HA
Atttxt(0) = "Raghu"
Atttxt(1) = "Doctor"
Atttxt(2) = Date
Image1.Picture = LoadPicture("D:\PanimalarCBSS\dr1.gif")
If vvv2 = 0 Then
Atttxt(3) = Time
Drs.AddNew
Drs.Fields(0) = Atttxt(0)
Drs.Fields(1) = Atttxt(1)
Drs.Fields(2) = Atttxt(2)
Drs.Fields(3) = Atttxt(3)
Drs.Update
vvv2 = 1
End If
Case &H9
Atttxt(0) = "Kamala"
Atttxt(1) = "Doctor"
Atttxt(2) = Date
Image1.Picture = LoadPicture("D:\PanimalarCBSS\dr2.gif")
If vvv2 = 0 Then
Atttxt(3) = Time
Drs.AddNew
Drs.Fields(0) = Atttxt(0)
Drs.Fields(1) = Atttxt(1)
Drs.Fields(2) = Atttxt(2)
Drs.Fields(3) = Atttxt(3)
Drs.Update
vvv2 = 1
End If
Case &H8
Atttxt(0) = "Soman"
Atttxt(1) = "Doctor"
Atttxt(2) = Date
Image1.Picture = LoadPicture("D:\PanimalarCBSS\dr3.gif")
If vvv2 = 0 Then
Atttxt(3) = Time
Drs.AddNew
Drs.Fields(0) = Atttxt(0)
Drs.Fields(1) = Atttxt(1)
Drs.Fields(2) = Atttxt(2)
Drs.Fields(3) = Atttxt(3)
Drs.Update
vvv2 = 1
End If
Case &H7
Atttxt(0) = "Binu"
Atttxt(1) = "Doctor"
Atttxt(2) = Date
Image1.Picture = LoadPicture("D:\PanimalarCBSS\dr4.gif")
If vvv2 = 0 Then
Atttxt(3) = Time
Drs.AddNew
Drs.Fields(0) = Atttxt(0)
Drs.Fields(1) = Atttxt(1)
Drs.Fields(2) = Atttxt(2)
Drs.Fields(3) = Atttxt(3)
Drs.Update
vvv2 = 1
End If
Case &H6
Atttxt(0) = "Algates"
Atttxt(1) = "Doctor"
Atttxt(2) = Date
Image1.Picture = LoadPicture("D:\PanimalarCBSS\dr1.gif")
If vvv2 = 0 Then
Atttxt(3) = Time
Drs.AddNew
Drs.Fields(0) = Atttxt(0)
Drs.Fields(1) = Atttxt(1)
Drs.Fields(2) = Atttxt(2)
Drs.Fields(3) = Atttxt(3)
Drs.Update
vvv2 = 1
End If
Case &H5
Atttxt(0) = "Jagadeesh"
Atttxt(1) = "Doctor"
Atttxt(2) = Date
Image1.Picture = LoadPicture("D:\PanimalarCBSS\dr2.gif")
If vvv2 = 0 Then
Atttxt(3) = Time
Drs.AddNew
Drs.Fields(0) = Atttxt(0)
Drs.Fields(1) = Atttxt(1)
Drs.Fields(2) = Atttxt(2)
Drs.Fields(3) = Atttxt(3)
Drs.Update
vvv2 = 1
End If
Case &H4
Atttxt(0) = "Mohan"
Atttxt(1) = "Wardboy"
Atttxt(2) = Date
Image1.Picture = LoadPicture("D:\PanimalarCBSS\dr3.gif")
I

I have created Module1.

Public Declare Function Sleep Lib “kernel32” (ByVal dwMilliseconds As Long) As Long

The error here is highlighting "kernel32", it says "expected string constant", how do i get to fix this , really need help, i m stuck here.

Edited 7 Years Ago by sundy123456: n/a

When I copied your code into vb, your quotation marks is completely incorrect. Type the correct or normal quotation marks "" and your code will be 100%.

Good luck.

Thanks alot. it worked.
I want to use outlook application in vb.

Public objOutlook As New Outlook.Application
Public objOutlookMsg As Outlook.MailItem

when i run the code it gives me error saying "user-defined type not defined" , how do i solve the problem ? please help

I got that working, i had to select the outlook libraries from the references

I got that working. I had to choose outlook libraries from the references menu.

I am uploading updated forms and module files. Please help if any error is there. I have to buy the RS-232 cable now, so i cant proceed till i buy it, meanwhile please have a look at them and guide me please. You can ask me if u have any questions as to what this code is about or anything related to it.

Attachments
Private Sub Command1_Click()
Form3.Hide
Form5.Show
Form5.Data1.RecordSource = Doc
Form5.Data1.Refresh
Form5.DBGrid1.ClearFields
Form5.DBGrid1.ReBind
End Sub
Private Sub Command2_Click()
Form3.Hide
Form5.Show
Form5.Data1.RecordSource = patient
Form5.Data1.Refresh
Form5.DBGrid1.ClearFields
Form5.DBGrid1.ReBind
End Sub
Private Sub Command3_Click()
Form3.Hide
Form5.Show
Form5.Data1.RecordSource = Digital
Form5.Data1.Refresh
Form5.DBGrid1.ClearFields
Form5.DBGrid1.ReBind
End Sub
Private Sub Command5_Click()
Form3.Hide
Form5.Show
End Sub
Private Sub Command6_Click()
End
End Sub
Private Sub Form_DblCliclk()
Me.PrintForm
End Sub
Private Sub BTemptimer_Timer()
MSComm1.Output = "[45]"
Sleep (20)
Rtext = MSComm1.Input
Rtext = Mid$(Rtext, 2, 4)
pt2 = t2
t2 = Val("&h" & Rtext)
t2 = t2 / 5
t2 = -t2 + 195
t2 = Round(t2, 1)
If t2 < 77 Then t2 = pt2
End If
Text7.Text = t2
Label4.Caption = "BodyTemp Vs Time"
DrawWidth = 2
Line (536, 184)-(536, 384), vbYellow
Line (536, 384)-(744, 384), vbYellow
Line (528, 192)-(536, 184), vbYellow
Line (544, 192)-(536, 184), vbYellow
Line (736, 376)-(744, 384), vbYellow
Line (736, 392)-(744, 384), vbYellow
DrawWidth = 2
Line (oldx, oldy)-(536 + k, 384 - (t2 / (200 / 200#))), vbGreen
DrawWidth = 1
oldx = 536 + k
oldy = 384 - (t2 / (200 / 200#))
k = k + 3
If k > 208 Then
Line (528, 182)-(744, 384), Form4.BackColor, BF
oldx = 536#
oldy = 384#
k = 0
End If
End Sub

Private Sub btimer_Timer()
btimer.Enabled = False
out = out And &HCF
End Sub

Private Sub Command1_Click()
MSComm1.Output = "[3ffffbfff]"
Sleep (50)
End
End Sub

Private Sub Command3_Click()
Form4.Hide
Form3.Show
End Sub

Private Sub Ecg1Timer_Timer()
MSComm1.Output = "[40]"
Sleep (50)
Rtext = MSComm1.Input
Rtext = Mid$(Rtext, 2, 4)
Ecg1 = Val("&h" & Rtext)
Ecg1 = Round(Ecg1, 1)
Text9.Text = Ecg1
End Sub
Private Sub Form_Load()
For i = 1 To 100
Egra1(i) = 50
Next
ptr = 19
MSComm1.PortOpen = True
MSComm1.Output = "[1ffffbfff]"
Sleep (30)
MSComm1.Output = "[3ffffbfff]"
Sarr(1) = 0
Sarr(2) = 0
Sarr(3) = 0
Sarr(4) = 0
Sarr(5) = 0
Sarr(6) = 0
Fnames(1) = "C:\project\hitemp.wav"
Fnames(2) = "C:\project\Patient1.wav" 'p1 call
Fnames(3) = "C:\project\Patient2.wav" 'p2 call
Fnames(4) = "C:\project\Patient3.wav " 'p3 call
Fnames(5) = "C:\project\Patient4.wav" 'p4 call
Fnames(6) = "C:\project\Saline1.wav" 'p4 call
Fcnt = 0
Label5.Caption = Format(Date, "dd/mm/yyyy")
Set db = OpenDatabase("D:\PanimalarCBSS\hos12.mdb")
Set rs = db.OpenRecordset("patient")
Set Srs = db.OpenRecordset("Digital")
Set Drs = db.OpenRecordset("Doc")
pa = &H0
Sal = &H0
oldx = 536#
oldy = 384#
k = 0
X = 0
a(0) = 5
a(1) = 5
a(2) = 5
a(3) = 6
a(4) = 5
a(5) = 5
a(6) = 5
a(7) = 5
a(8) = 3
a(9) = 10
a(10) = 1
a(11) = 5
a(12) = 5
a(13) = 5
a(14) = 7
a(15) = 5
a(16) = 6
a(17) = 5
a(18) = 5
a(19) = 5
Lg = Shell("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.exe", vbNormalFocus)
End Sub
Private Sub Heartbeattimer_Timer()
MSComm1.Output = "[2]"
Sleep (20)
Rtext = MSComm1.Input
Rtext = Mid$(Rtext, 8, 1)
Beat = Val("&h" & Rtext)
If Beat = 0 And Bflg = 0 Then
Bcnt = Bcnt + 1
Bflg = 1
ElseIf Beat > 0 And Bflg = 1 Then
Bflg = 0
End If
Text1.Text = Round(Bcnt, 0)
End Sub
Private Sub Hrtcmd_Click()
hcnt = 0
Bcnt = 0
End Sub
Private Sub MMControl1_Done(NotifyCode As Integer)
MMControl1.Command = "Close"
Timer2.Enabled = True
End Sub
Private Sub Option1_Click()
Rtemptimer.Enabled = False
BTemptimer.Enabled = False
Ecg1Timer.Enabled = False
Heartbeattimer.Enabled = False
Rtemptimer.Enabled = True
Picture1.Cls
Text1.Text = Clear
Text5.Text = Clear
Text7.Text = Clear
Text9.Text = Clear
grval = 0
End Sub
Private Sub Option2_Click()
Rtemptimer.Enabled = False
BTemptimer.Enabled = False
Ecg1Timer.Enabled = False
Heartbeattimer.Enabled = False
BTemptimer.Enabled = True
Picture1.Cls
Text1.Text = Clear
Text5.Text = Clear
Text7.Text = Clear
Text9.Text = Clear
grval = 1
End Sub
Private Sub Option3_Click()
Rtemptimer.Enabled = False
BTemptimer.Enabled = False
Ecg1Timer.Enabled = False
Heartbeattimer.Enabled = False
Ecg1Timer.Enabled = True
Picture1.Cls
Text1.Text = Clear
Text5.Text = Clear
Text7.Text = Clear
Text9.Text = Clear
End Sub
Private Sub Option7_Click()
Rtemptimer.Enabled = False
BTemptimer.Enabled = False
Ecg1Timer.Enabled = False
Heartbeattimer.Enabled = False
Heartbeattimer.Enabled = True
Picture1.Cls
Text1.Text = Clear
Text5.Text = Clear
Text7.Text = Clear
Text9.Text = Clear
grval = 2
End Sub
Private Sub Rtemptimer_Timer()
MSComm1.Output = "[46]"
Sleep (20)
Rtext = MSComm1.Input
Rtext = Mid$(Rtext, 2, 4)
pt1 = t1
t1 = Val("&h" & Rtext)
t1 = t1 / 5
t1 = -t1 + 195
t1 = Round(t1, 1)
If t1 < 77 Then t1 = pt1
End If
Text5.Text = t1
Label4.Caption = "RespTemp Vs Time"
DrawWidth = 2
Line (536, 184)-(536, 384), vbYellow
Line (536, 384)-(744, 384), vbYellow
Line (528, 192)-(536, 184), vbYellow
Line (544, 192)-(536, 184), vbYellow
Line (736, 376)-(745, 385), vbYellow
Line (736, 392)-(744, 384), vbYellow
DrawWidth = 2
Line (oldx, oldy)-(536 + k, 384 - (t1 / (200 / 200#))), vbGreen
DrawWidth = 1
oldx = 536 + k
oldy = 384 - (t1 / (200 / 200#))
k = k + 3
If k > 208 Then
Line (528, 182)-(744, 384), Form4.BackColor, BF
oldx = 536#
oldy = 384#
k = 0
End If
End Sub
Private Sub Timer1_Timer()
Label6.Caption = Format(Time, "hh:mm:ss")
If Heartbeattimer.Enabled = True Then
Text2.Visible = True
Hrtcmd.Visible = True
Else
Text2.Visible = False
Hrtcmd.Visible = False
End If
If (Ecg1 > 100) And Strt = 0 Then
Strt = 1
End If
MSComm1.Output = "[2]"
Sleep (20)
Rtext = MSComm1.Input
pa = Val("&h" & Mid$(Rtext, 8, 2))
If ((pa And &H1) = &H0) Then
Label23.Visible = True
p1 = "Yes"
Sarr(2) = 1
If pflg1 = 0 Then
pflg1 = 1
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
.To = "971507769579@sms.etisalat.ae" ' The To Address Field
.Subject = "P1 Call" ' txtSubject - The Subject Field
.Body = "Patient 1 is calling"
.Importance = olImportanceHigh ' Priority. Mostly Not Required
.Send ' Send the Composed Message
End With
Set objOutlookMsg = Nothing
Else
Label23.Visible = False
p1 = "No"
Sarr(2) = 0
End If
If ((pa And &H2) = &H0) Then
Label24.Visible = True
p2 = "Yes"
Sarr(3) = 1
Else
Label24.Visible = False
p2 = "No"
End If
If ((pa And &H4) = &H0) Then
Label25.Visible = True
p3 = "Yes"
Sarr(4) = 1
Else
Label25.Visible = False
p3 = "No"
End If
If ((pa And &H8) = &H0) Then
Label26.Visible = True
p4 = "Yes"
Sarr(5) = 1
Else
Label26.Visible = False
p4 = "No"
End If
MSComm1.Output = "[2]"
Sleep (20)
Rtext = MSComm1.Input
pb = Val("&h" & Mid$(Rtext, 6, 2))
If ((pb And &H10) = &H10) Then
Label8.Visible = False
Saline.Visible = True
Sal = "Empty"
Sarr(6) = 1
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
.To = "971507769579@sms.etisalat.ae" ' The To Address Field
.Subject = "saline Emp" ' txtSubject - The Subject Field
.Body = "Saline bottle Empty"
.Importance = olImportanceHigh ' Priority. Mostly Not Required
.Send ' Send the Composed Message
End With
Set objOutlookMsg = Nothing
End If
Else
Saline.Visible = False
Label8.Visible = True
Sal = "Not Empty"
End If
If (t1 > 100) Or (t2 > 100) Then
Label22.Visible = True
Else
Label22.Visible = False
End If
MSComm1.Output = "[2]"
Sleep (50)
Rtext = MSComm1.Input
pc = Val("&h" & Mid$(Rtext, 6, 2))
pc = pc And &HF
Select Case (pc And &HF)
Case &HE
Atttxt(0) = "Shahid"
Atttxt(1) = "Doctor"
Atttxt(2) = Date
Image1.Picture = LoadPicture("C:\project\dr1.gif")
If vvv2 = 0 Then
Atttxt(3) = Time
Drs.AddNew
Drs.Fields(0) = Atttxt(0)
Drs.Fields(1) = Atttxt(1)
Drs.Fields(2) = Atttxt(2)
Drs.Fields(3) = Atttxt(3)
Drs.Update
vvv2 = 1
End If
Case &HD
Atttxt(0) = "Chamel"
Atttxt(1) = "Nurse"
Atttxt(2) = Date
Image1.Picture = LoadPicture("C:\project\dr2.gif")
If vvv2 = 0 Then
Atttxt(3) = Time
Drs.AddNew
Drs.Fields(0) = Atttxt(0)
Drs.Fields(1) = Atttxt(1)
Drs.Fields(2) = Atttxt(2)
Drs.Fields(3) = Atttxt(3)
Drs.Update
vvv2 = 1
End If
Case &HC
Atttxt(0) = "Naresh"
Atttxt(1) = "Pune"
Atttxt(2) = Date
Image1.Picture = LoadPicture("C:\project\dr3.gif")
If vvv2 = 0 Then
Atttxt(3) = Time
Drs.AddNew
Drs.Fields(0) = Atttxt(0)
Drs.Fields(1) = Atttxt(1)
Drs.Fields(2) = Atttxt(2)
Drs.Fields(3) = Atttxt(3)
Drs.Update
vvv2 = 1
End If
Case &HB
Atttxt(0) = "Abdullah"
Atttxt(1) = "Doctor"
Atttxt(2) = Date
Image1.Picture = LoadPicture("C:\project\dr4.gif")
If vvv2 = 0 Then
Atttxt(3) = Time
Drs.AddNew
Drs.Fields(0) = Atttxt(0)
Drs.Fields(1) = Atttxt(1)
Drs.Fields(2) = Atttxt(2)
Drs.Fields(3) = Atttxt(3)
Drs.Update
vvv2 = 1
End If
Case &HA
Atttxt(0) = "Mohammad"
Atttxt(1) = "Doctor"
Atttxt(2) = Date
Image1.Picture = LoadPicture("C:\project\dr1.gif")
If vvv2 = 0 Then
Atttxt(3) = Time
Drs.AddNew
Drs.Fields(0) = Atttxt(0)
Drs.Fields(1) = Atttxt(1)
Drs.Fields(2) = Atttxt(2)
Drs.Fields(3) = Atttxt(3)
Drs.Update
vvv2 = 1
End If
Case &H9
Atttxt(0) = "Hassan"
Atttxt(1) = "Doctor"
Atttxt(2) = Date
Image1.Picture = LoadPicture("C:\project\dr2.gif")
If vvv2 = 0 Then
Atttxt(3) = Time
Drs.AddNew
Drs.Fields(0) = Atttxt(0)
Drs.Fields(1) = Atttxt(1)
Drs.Fields(2) = Atttxt(2)
Drs.Fields(3) = Atttxt(3)
Drs.Update
vvv2 = 1
End If
Case &H8
Atttxt(0) = "Waleed"
Atttxt(1) = "Doctor"
Atttxt(2) = Date
Image1.Picture = LoadPicture("C:\project\dr3.gif")
If vvv2 = 0 Then
Atttxt(3) = Time
Drs.AddNew
Drs.Fields(0) = Atttxt(0)
Drs.Fields(1) = Atttxt(1)
Drs.Fields(2) = Atttxt(2)
Drs.Fields(3) = Atttxt(3)
Drs.Update
vvv2 = 1
End If
Case &H7
Atttxt(0) = "Salman"
Atttxt(1) = "Doctor"
Atttxt(2) = Date
Image1.Picture = LoadPicture("C:\project\dr4.gif")
If vvv2 = 0 Then
Atttxt(3) = Time
Drs.AddNew
Drs.Fields(0) = Atttxt(0)
Drs.Fields(1) = Atttxt(1)
Drs.Fields(2) = Atttxt(2)
Drs.Fields(3) = Atttxt(3)
Drs.Update
vvv2 = 1
End If
Case &H6
Atttxt(0) = "Ahmed"
Atttxt(1) = "Doctor"
Atttxt(2) = Date
Image1.Picture = LoadPicture("C:\project\dr1.gif")
If vvv2 = 0 Then
Atttxt(3) = Time
Drs.AddNew
Drs.Fields(0) = Atttxt(0)
Drs.Fields(1) = Atttxt(1)
Drs.Fields(2) = Atttxt(2)
Drs.Fields(3) = Atttxt(3)
Drs.Update
vvv2 = 1
End If
Case &H5
Atttxt(0) = "Abdul"
Atttxt(1) = "Doctor"
Atttxt(2) = Date
Image1.Picture = LoadPicture("C:\project\dr2.gif")
If vvv2 = 0 Then
Atttxt(3) = Time
Drs.AddNew
Drs.Fields(0) = Atttxt(0)
Drs.Fields(1) = Atttxt(1)
Drs.Fields(2) = Atttxt(2)
Drs.Fields(3) = Atttxt(3)
Drs.Update
vvv2 = 1
End If
Case &H4
Atttxt(0) = "Mohan"
Atttxt(1) = "Wardboy"
Atttxt(2) = Date
Image1.Picture = LoadPicture("C:\project\dr3.gif")
If vvv2 = 0 Then
Atttxt(3) = Time
Drs.AddNew
Drs.Fields(0) = Atttxt(0)
Drs.Field
Private Sub Command1_Click()
Data1.Recordset.MoveFirst
While Not (Data1.Recordset.EOF)
Data1.Recordset.Delete
Data1.Recordset.MoveNext
Wend
DBGrid1.ClearFields
End Sub
Private Sub Command2_Click()
Form5.Hide
Form4.Show
Line (528, 182)-(744, 384), Form4.BackColor, BF
oldx = 536
oldy = 384
k = 0
End Sub
Private Sub Command3_Click()
Form4.MSComm1.Output =[3ffff80ff]
Sleep (50)
End
End Sub
Option Explicit
Public db As Database
Public textval As String, dtext As String, SString As String, Sendstr As String, Rtext As String
Public trs, rps, prs, Srs, Drs As Recordset
Public X As Integer, Eout1, bout1, out, Timeout1 As Integer
Public pch, pa, pb, attin, pc As Integer
Public oldx, oldy, Maxv As Single
Public k, grval As Integer
Public t1 As Double, tt0 As Double, tt1 As Double, t2 As Double, t3 As Double, t4 As Double, tt2 As Double, Ecg1 As Double
Public p1, p2, p3, p4, Sal As String
Public Strt As Integer
Public Fnames(1 To 7) As String
Public Egra1(1 To 100) As Single
Public Fcnt As Integer
Public a(0 To 19) As Single
Public pt1, pt2 As Single
Public Sarr(1 To 7) As Integer
Public ptr As Integer
Public vvv As Integer
Public vvv2  As Integer
Public Beat, Bcnt, Bflg, Tcount As Single
Public hcnt, hout As Integer
Public Declare Function Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) As Long
Public objOutlook As New Outlook.Application
Public objOutlookMsg As Outlook.MailItem
Public pflg, sale, t1flg, t2flg, hflg1, finflg, myflg As Integer
Public Lg As Long

This is going to take some time. I promise I'll look at the code and try and add comments so you can understand it much better. Unfortunately, only when I can squeeze this in between my normal work. Keep your eye on a reply later on.

That OK?

That would very helpful. Thankyou soo much. Meanwhile i will try to search and buy the RS232 cable and start to study about serial cabling. Thank you sooo much. I will be checking up regularly. Appreciate it, thank you

Hey Sundy. I've checked your code and replicated into vb6. I must say, i'm quite confused. Can you let me know exactly what you plan to do with your app, and I'll see if I can help out. I'm going off line now. Will be back over the weekend and set you up with something decent.

Nice weekend

I am making a patient monitoring system. I am using PIC16F877 microcontroller. Then interfacing it with RS232 serial communication to visual basic. In the visual basic, the I want to display the temperature of the patient, respiratory temperature, ecg signal, patient callign system which is like an swtich, when pressed gives alarm in VB, heart beat monitor, also a messaging technique which sends messages to cellphone of the doctor through vb (which i m confused if it would work or not). Finally it has a card reader system, i m using sensors that detect different inputs in the PIC and sends the info to the VB that so and so doctor or nurse is attending the patient. Its a Biomedical project.

I really appreciate ur help, i m stuck. When i m compiling it says about port connection. So, i am going to buy RS232 cable and continue to work on it. Also, i m a bit concerned about serial port communication. I would be really grateful if you can help me at this. Thank you.

I have got the RS232 cable 9 pin (male and female type). I would like to know that can I use Female-USB type of RS232, because my laptop doesnt have the port of 9 pins. I had initially designed my project for comunicating between male and female pins, now if I use usb type of cable, what will i have to change ? Please need help.

This article has been dead for over six months. Start a new discussion instead.