Discussion in "Project Doubts" started by    redzs08    Dec 13, 2010.
Mon Aug 22 2011, 09:06 pm
#81
you are welcome enjoy!
Thu Aug 25 2011, 12:15 am
#82
i need some explanation on vb command that been used in DAQ system

first one about this sub fillgrid
Sub fillGrid()
Dim T As Integer
Do While Not rs.EOF
T = T + 1
fg.TextMatrix(T, 0) = rs.Fields("Sr No")
fg.TextMatrix(T, 1) = rs.Fields("TimeAndDate")
fg.TextMatrix(T, 2) = rs.Fields("Temp1")
fg.TextMatrix(T, 3) = rs.Fields("Temp2")
fg.TextMatrix(T, 4) = rs.Fields("Temp3")
fg.TextMatrix(T, 5) = rs.Fields("Temp4")
totalrec.Caption = "Total Records: " + CStr(fg.Rows - 1)
If Not rs.EOF Then rs.MoveNext
If fg.TextMatrix(fg.Rows - 1, 2) <>
 "" Then
fg.Rows = fg.Rows + 1
End If
Loop
End Sub


next
Private Sub MSComm1_OnComm()
If (MSComm1.CommEvent = comEvReceive) Then
Text3.Text = MSComm1.Input
If (c = 1) Then
If (Text3.Text Like ",") Then
Label1(sensor).Caption = "  " + Text2.Text
sensor = sensor + 1
Text2.Text = ""
Else
Text2.Text = Text2.Text + (Text3.Text)
End If
End If
If (sensor = 4) Then
sensor = 0
c = 0
Text2.Text = ""
Text3.Text = ""
fg.TextMatrix(fg.Rows - 1, 0) = CStr(fg.Rows - 1)
fg.TextMatrix(fg.Rows - 1, 1) = CStr(Now)
fg.TextMatrix(fg.Rows - 1, 2) = Label1(0).Caption
fg.TextMatrix(fg.Rows - 1, 3) = Label1(1).Caption
fg.TextMatrix(fg.Rows - 1, 4) = Label1(2).Caption
fg.TextMatrix(fg.Rows - 1, 5) = Label1(3).Caption
totalrec.Caption = "Total Records: " + CStr(fg.Rows - 1)
rs.AddNew
rs.Fields("Sr No").Value = CStr(fg.Rows - 1)
rs.Fields("TimeAndDate").Value = Now
rs.Fields("Temp1").Value = Val(fg.TextMatrix(fg.Rows - 1, 2))
rs.Fields("Temp2").Value = Val(fg.TextMatrix(fg.Rows - 1, 3))
rs.Fields("Temp3").Value = Val(fg.TextMatrix(fg.Rows - 1, 4))
rs.Fields("Temp4").Value = Val(fg.TextMatrix(fg.Rows - 1, 5))
rs.Update
fg.Rows = fg.Rows + 1
End If
k = 0
For i = 0 To 3
k = i + 1
MSComm1.Output = Chr(97 + k)
Next
If (Text3.Text Like "N") Then
c = 1
End If
End If
End Sub


and lastly
Private Sub Form_Unload(Cancel As Integer)
If MSComm1.PortOpen = True Then
MSComm1.PortOpen = False
End If
End Sub



and this a basic question i need to know can microcontroller run on +4.85V
i hope someone can help me......


[ Edited Thu Aug 25 2011, 05:20 pm ]
Fri Aug 26 2011, 11:12 pm
#83
Sub fillGrid()
Dim T As Integer
Do While Not rs.EOF
T = T + 1
fg.TextMatrix(T, 0) = rs.Fields("Sr No")
fg.TextMatrix(T, 1) = rs.Fields("TimeAndDate")
fg.TextMatrix(T, 2) = rs.Fields("Temp1")
fg.TextMatrix(T, 3) = rs.Fields("Temp2")
fg.TextMatrix(T, 4) = rs.Fields("Temp3")
fg.TextMatrix(T, 5) = rs.Fields("Temp4")
totalrec.Caption = "Total Records: " + CStr(fg.Rows - 1)
If Not rs.EOF Then rs.MoveNext
If fg.TextMatrix(fg.Rows - 1, 2) <>
 "" Then
fg.Rows = fg.Rows + 1
End If
Loop
End Sub

He is filling grid here using rs recordset. from first look he seems to initialize the fg grid.

Private Sub MSComm1_OnComm()

This is an event sub in vb6 whenever you receive data on com port this function gets called. so he is adding data to grid.

Private Sub Form_Unload(Cancel As Integer)
If MSComm1.PortOpen = True Then
MSComm1.PortOpen = False
End If
End Sub

Form_Unload is called when you exit from software. so he is closing com port if its open.
Thu Nov 10 2011, 03:11 pm
#84

unsigned char aray[]={'0','1','2','3','4','5','6','7','8','9'};

void serialRoutine() interrupt 4
{
if(RI==1)
{
sens_1=SBUF;
switch(sens_1)
{
case('a'):
relay1=1;
break;
case('b'):
relay1=0;


please let me know obove code to explain.because i don't the code how to use.if i want use this code in greenbee v2 project is posible???i want to case ("a") is what??
Fri Nov 11 2011, 08:14 pm
#85
@ mingming1234
the above function is for serial interrupt when a data comes from PC
this function is called automatically
data byte is in SBUF
then use switch case statement to check what data is ?

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Darrellciz
Thu Apr 18 2024, 11:07 am
Charlessber
Thu Apr 18 2024, 09:29 am
BartonSem
Thu Apr 18 2024, 04:56 am
DonaldKnown
Thu Apr 18 2024, 12:24 am
utaletxcyw
Wed Apr 17 2024, 10:21 am
Anthonyvab
Wed Apr 17 2024, 08:48 am
RobertCix
Wed Apr 17 2024, 06:46 am
Astorne
Tue Apr 16 2024, 08:52 pm