Problem in manage the huge of data using mscomm
Problem in manage the huge of data using mscomm
Problem in manage the huge of data using mscomm
Problem in manage the huge of data using mscomm
Problem in manage the huge of data using mscomm
Problem in manage the huge of data using mscomm Problem in manage the huge of data using mscomm Problem in manage the huge of data using mscomm Problem in manage the huge of data using mscomm Problem in manage the huge of data using mscomm Problem in manage the huge of data using mscomm Problem in manage the huge of data using mscomm Problem in manage the huge of data using mscomm
Problem in manage the huge of data using mscomm Problem in manage the huge of data using mscomm
Problem in manage the huge of data using mscomm
Go Back  Xtreme Visual Basic Talk > > > Problem in manage the huge of data using mscomm


Reply
 
Thread Tools Display Modes
  #1  
Old 10-15-2010, 05:24 PM
zmuji zmuji is offline
Newcomer
 
Join Date: Aug 2010
Posts: 3
Default Problem in manage the huge of data using mscomm


Dear all.

I'm new in this area (VB6). My problem is i cannot arrange a huge of data that come from microcontroller (connect with 40 sensors) in a right text box. In the GUI, I have prepare 40 text box to be filled with the data come from microcontroller. And each text box is for special sensors means if it is sensor 1, the data must be located in text box 1, and if it is sensor 2 ---> text box 2,, and so on.

The next problem is i do not know how to transfer this data (text box) to the file like notepad.

Please help and any suggestion is really appreciate.


Thanks a lot.
Reply With Quote
  #2  
Old 11-09-2010, 09:13 AM
PaulP51 PaulP51 is offline
Newcomer
 
Join Date: Nov 2010
Posts: 5
Smile

Quote:
Originally Posted by zmuji View Post
Dear all.

I'm new in this area (VB6). My problem is i cannot arrange a huge of data that come from microcontroller (connect with 40 sensors) in a right text box. In the GUI, I have prepare 40 text box to be filled with the data come from microcontroller. And each text box is for special sensors means if it is sensor 1, the data must be located in text box 1, and if it is sensor 2 ---> text box 2,, and so on.

The next problem is i do not know how to transfer this data (text box) to the file like notepad.

Please help and any suggestion is really appreciate.


Thanks a lot.
Is data that come from microcontroller marked with other words can you see at the data that it is from sensor 1 or 2 or 25? , or is the whole stream send at once?? Is the data from each sensor equal to the other??

Paul
Reply With Quote
  #3  
Old 11-09-2010, 11:21 AM
ZaCkOX's Avatar
ZaCkOX ZaCkOX is offline
Contributor
 
Join Date: May 2006
Location: CA
Posts: 645
Default

Follow this link for creating and writting the text file: File I/O

Just as Paul is asking, we don't necessarily know your problem because you haven't given us all the information we need.

Also with a lot of text boxes, I think you should look into control arrays (if you aren't using them).

And to manage the data properly, to be able to look through it, you might also want to use arrays. You can loop through the array looking for certain values and then have the text boxes = to that.
__________________
ZaCkO ... Who is your attitude?
Reply With Quote
  #4  
Old 11-12-2010, 02:08 AM
zmuji zmuji is offline
Newcomer
 
Join Date: Aug 2010
Posts: 3
Default

Thanks for the response Paul and ZaCkO. Sorry for a bit late replying this message. I have include a mark for every data. For example before send data from Sensor 1 ,char A will be sent first. I test for 2 data.

At Microcontroller i write like this:
Code:
if(PIR1bits.RCIF == 0)  //eusart receive buffer is not full
     goto ulang;
     else          //eusart receive buffer is full, rcreg 

	
next:		Check = RCREG;
       
		if (Check == 'A')
		{
			
			if(i<2)
			{
				TXREG = s;  //character will be send here
				SerTx();
           TXREG =store[i];     // data will be sent here
           SerTx();
           i=i+1;
           s=s+1;
            }
   
           else 
           i=0;
           s=65;


void SerTx(void)
{
wait:	
	if(PIR1bits.TXIF == 0)	//Wait for data to finish transmitting 
	{	goto wait;}
}
At VB i write like this:
Code:
Private Sub Form_Load()

MSComm1.CommPort = 5                   'use com port15
MSComm1.Settings = "9600,n,8,1"        '9600 baud, no parity, 8 bit data, 1 stop bit
MSComm1.InputLen = 0                    'read entire buffer
MSComm1.InputMode = comInputModeText    'read text format
MSComm1.RThreshold = 4                'Fire Rx event every two bytes
MSComm1.PortOpen = True                 'open port
MSComm1.NullDiscard = True

Timer1.Enabled = False
End Sub


If (MSComm1.CommEvent = comEvReceive) Then  'when data is received.
    stra = MSComm1.Input
    
AB = Asc(Mid$(stra, 1, 1))   
BB = Asc(Mid$(stra, 2, 1))  
CB = Asc(Mid$(stra, 3, 1))
DB = Asc(Mid$(stra, 4, 1))   


  If AB = 65 Then  'char A
  txtResult(0).Text = Format((BB / 255) * 5, "0.0000")
  'txtResult(0).Text = (BB / 255) * 5
  End If
  
  If CB = 66 Then   'char B
   txtResult(1).Text = Format((DB / 255) * 5, "0.0000")
   'txtResult(0).Text = (AB / 255) * 5
   End If
But , only the first text box is filled with data (it fill with both data one by one in the same text box). No data appear in the second text box.

Anybody have any idea about it. I really appreciate any idea for this problem.

TQ

Last edited by Flyguy; 11-12-2010 at 02:30 AM.
Reply With Quote
  #5  
Old 11-12-2010, 11:25 AM
Banjo's Avatar
BanjoProblem in manage the huge of data using mscomm Banjo is offline
Hell's Angel

Retired Moderator
* Guru *
 
Join Date: Jul 2001
Location: Yorkshire, UK
Posts: 10,394
Default

Give us a sample of stra values that you're receiving.
__________________
A wise one man once said "what you talking about dog breath"
Reply With Quote
  #6  
Old 11-12-2010, 03:45 PM
ZaCkOX's Avatar
ZaCkOX ZaCkOX is offline
Contributor
 
Join Date: May 2006
Location: CA
Posts: 645
Default My reply...

This is what you have:
Code:
If AB = 65 Then 'char A txtResult(0).Text = Format((BB / 255) * 5, "0.0000") 'txtResult(0).Text = (BB / 255) * 5 End If If CB = 66 Then 'char B txtResult(1).Text = Format((DB / 255) * 5, "0.0000") 'txtResult(0).Text = (AB / 255) * 5 End If
But notice where the comments are. txtResult(0) is still your first text box. This what you looking for? Just a simple fix you missed. txtResult(1).
Code:
If AB = 65 Then 'char A txtResult(0).Text = Format((BB / 255) * 5, "0.0000") txtResult(0).Text = (BB / 255) * 5 End If If CB = 66 Then 'char B txtResult(1).Text = Format((DB / 255) * 5, "0.0000") txtResult(1).Text = (AB / 255) * 5 End If
Remember to check your index values. A really good way is to read each line out-loud. Text Box Result 0 ah ok. Text Box Result 0 ah Noo I want 1. Fix.

If this is not what you are looking for, you need to msgbox the value and see what it is.
Code:
MsgBox Format((DB / 255) * 5, "0.0000") txtResult(0).Text = Format((DB / 255) * 5, "0.0000") 'Notice Index = 0 Here!
Now you can't miss putting the data into the text box. Then just remove the msg boxes. This process will help you catch the index value if you make a mistake but really not necessary. Just don't make a mistake

And if still not what you needed help with, tell us a sample of the stra value Banjo asked for.
__________________
ZaCkO ... Who is your attitude?

Last edited by ZaCkOX; 11-12-2010 at 03:51 PM.
Reply With Quote
  #7  
Old 11-13-2010, 09:10 PM
zmuji zmuji is offline
Newcomer
 
Join Date: Aug 2010
Posts: 3
Default

Hi ZaCKO,

Thanks for your respond.

I'm sorry because actually the second line of this source code is just a comment and not will be processed in my program.


If AB = 65 Then 'char A
txtResult(0).Text = Format((BB / 255) * 5, "0.0000")
'txtResult(0).Text = (BB / 255) * 5 --> THIS WILL NOT BEING PROCESS
End If


Thanks because response to my post. thanks a lot
Reply With Quote
Reply

Tags
microcontroller, mscomm, notepad, text box, vb6


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Problem in manage the huge of data using mscomm
Problem in manage the huge of data using mscomm
Problem in manage the huge of data using mscomm Problem in manage the huge of data using mscomm
Problem in manage the huge of data using mscomm
Problem in manage the huge of data using mscomm
Problem in manage the huge of data using mscomm Problem in manage the huge of data using mscomm Problem in manage the huge of data using mscomm Problem in manage the huge of data using mscomm Problem in manage the huge of data using mscomm Problem in manage the huge of data using mscomm Problem in manage the huge of data using mscomm
Problem in manage the huge of data using mscomm
Problem in manage the huge of data using mscomm
 
Problem in manage the huge of data using mscomm
Problem in manage the huge of data using mscomm
 
-->