mahesh likhe's Profile
Reputation: 0
Apprentice
- Group:
- Members
- Active Posts:
- 24 (0.02 per day)
- Joined:
- 21-March 10
- Profile Views:
- 790
- Last Active:
May 16 2013 10:14 AM- Currently:
- Offline
Previous Fields
- Country:
- IN
- OS Preference:
- Who Cares
- Favorite Browser:
- Who Cares
- Favorite Processor:
- Who Cares
- Favorite Gaming Platform:
- Who Cares
- Your Car:
- Who Cares
- Dream Kudos:
- 0
Latest Visitors
-
modi123_1 
16 May 2013 - 09:23 -
CodingSup3rna... 
01 Jul 2011 - 14:56 -
macosxnerd101 
13 Jun 2011 - 11:05 -
liliac 
22 Mar 2010 - 08:03
Posts I've Made
-
In Topic: IDENTIFY FINGER POSITION
Posted 16 May 2013
-
In Topic: Problem : Symultaneous function execution
Posted 3 Jul 2011
dbasnett, on 02 July 2011 - 07:43 AM, said:Are you using the MSComm Control or VB .Net's IO.Ports.SerialPort? It looks like MSComm. If you are moving to .Net then use IO.Ports.SerialPort and make sure you are using .Net 4.0.
I am using VB .Net's IO.Ports.SerialPort it just named as mscomm because trying to port code from vb6 to vb.net...
What does it make difference to my question... -
In Topic: Problem : Symultaneous function execution
Posted 1 Jul 2011
Following code is from frmMain to send command to hardware mscomm is class which write command to serial port and handle response from serial port
frmMain
Dim gresponse() As Byte [1]mscomm.fnReadHoldingRegisters(1, 58, 8, Val(txtTimeOut.Text)) [2]gresponse = mscomm.getResponse [3] Try [4] lblReference1.Text = mscomm.fnGet2Compliment(mscomm.fnGetHexVal(gresponse(0), gresponse(1)).ToString()) [5] lblReference2.Text = mscomm.fnGet2Compliment(mscomm.fnGetHexVal(gresponse(2), gresponse(3)).ToString()) [6] lblReference3.Text = mscomm.fnGet2Compliment(mscomm.fnGetHexVal(gresponse(4), gresponse(5)).ToString()) [7] lblReference4.Text = mscomm.fnGet2Compliment(mscomm.fnGetHexVal(gresponse(6), gresponse(7)).ToString()) [8] lblReference5.Text = mscomm.fnGet2Compliment(mscomm.fnGetHexVal(gresponse(8), gresponse(9)).ToString()) [9] lblReference6.Text = mscomm.fnGet2Compliment(mscomm.fnGetHexVal(gresponse(10), gresponse(11)).ToString()) [10] lblReference7.Text = mscomm.fnGet2Compliment(mscomm.fnGetHexVal(gresponse(12), gresponse(13)).ToString()) [11] lblReference8.Text = mscomm.fnGet2Compliment(mscomm.fnGetHexVal(gresponse(14), gresponse(15)).ToString()) [12] Catch ex As Exception [13] lblNote.Text = "Fail" [14] fail = fail + 1 [15] End Try
clsMscomm write command function
Private Function fnReadHoldingRegisters(ByVal SlaveNumber As Integer, ByVal fromAddr As Double, ByVal numberOfRegisters As Double, ByVal RegisterType As Integer, Optional ByVal timeOut As Double = 250) As Boolean fnInitCommunication(numberOfRegisters * 2 + PROTOCOL_CONST_PADDING, RegisterType, SlaveNumber, fromAddr, numberOfRegisters, timeOut) WriteToPort(fnFormCommand(""))
Once WriteToPort get executed following function handle response
Private Sub MSComm1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles MSComm1.DataReceived [1] Dim buff As String [2] buff = MSComm1.ReadExisting [3] 'Combine previous response and new response [4] inbuffor = inbuffor & buff [5] 'Calculate expected length [6] cnt = cnt - Len(buff) [7] 'If expected response reached then validate response [8] If cnt = 0 Then [9] If fnValidateResponse(inbuffor) = True Then flValidResponse = True [10] 'Latch help to come out response waiting loop. False means wait, True means come out. [11] flLatchOpen = True [12] End If [13] End Sub
OK.
now the problem is when WriteToPort complete its work we receive some bytes at MSComm1_DataReceived and two function first one from frmMain and other one MSComm1_DataReceived start executing statement one by one like statement no 2 from frmMain after that statement no 3 from MSComm1_DataReceived and so on until one of them finish in statements.
i dont understand this type of behavior frmMain should wait until MSComm1_DataReceived finish its work. -
In Topic: Problem : Symultaneous function execution
Posted 1 Jul 2011
-
In Topic: vb.net common instance between multiple project
Posted 28 Jun 2011
Thanks guys it really help....
My Information
- Member Title:
- New D.I.C Head
- Age:
- 17 years old
- Birthday:
- November 12, 1995
- Gender:
-
- Location:
- India
- Interests:
- Computer Programming and Gaming.....
- Full Name:
- Mahesh Likhe
- Years Programming:
- 3
- Programming Languages:
-
C#.Net, VB.Net, VB6
Sharepoint 2010, ASP.NET
Contact Information
- E-mail:
- Click here to e-mail me
Friends
mahesh likhe hasn't added any friends yet.
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
mahesh likhe has no profile comments yet. Why not say hello?