cyw1984 Posted September 27, 2005 Report Share Posted September 27, 2005 About Visual Basic6 and RS232 ASCII communicationIf I want to send the value (ASCII) to 8051 series portVB block input:0.010.020.030.040.050.060.070.080.090.10.110.120.130.140.150.160.170.18.......29.9329.9429.9529.9629.9729.9829.9930.00RS232 transmit :0000000100020003000400050006...2985298629872988298929902991299229932994299529962997299829993000If i want display 0-30 with 0.00 (ACSII).....How can I write the VB software , It need to write 3000 structure???? Quote Link to comment Share on other sites More sharing options...
ECET0purdue Posted September 28, 2005 Report Share Posted September 28, 2005 u can use an array. i have never used them in VB but i have in lots of other programming tools.or use a varable. like thisx=.00do( x=x+.01MSComm1.Output = Chr(x))while(x<3000)%this will display it all... is that what you wanted? if you need the other part in it too do this.t=1x=.00do( x=x+.01 %this will keep adding .01 to x t=t++ % this will keep adding 1 to tPrivate Sub Command(t)_Click() %this will sub t for what # it's atMSComm1.Output = Chr(x) %this will sub x for what ever # it's at.End Sub)while(x<3000) % it keeps doing this till x reaches 3000 or what ever % what ever number you put in here.like i said i never programmed in VB but this is how i would guess to do it... and this ishow i would do it in all other programming i have done..cheers,glen Quote Link to comment Share on other sites More sharing options...
cyw1984 Posted October 17, 2005 Author Report Share Posted October 17, 2005 THX~~~But it ;s don't work~~~someone can help?? Quote Link to comment Share on other sites More sharing options...
EdwardM Posted October 17, 2005 Report Share Posted October 17, 2005 Hi cyw1984first thoughts:I presume you don't want to send all 3000 at once to the 8051 but just a current value?You could do something like...Public Sub Send5Chars(Value as string)'The 5 characters have been previously made into a string which looks like "nnnn"MSComm1.Output = Left(Value,1)MSComm1.Output = Left(Value,2)MSComm1.Output = "."MSComm1.Output = Left(Value,3)MSComm1.Output = Left(Value,4)End Sub...and would be invoked like this:Send5Chars "0123"Does that help?Best of Luck Ed Quote Link to comment Share on other sites More sharing options...
ECET0purdue Posted October 18, 2005 Report Share Posted October 18, 2005 o ya add this .int x; to the top of mine and it should work? and make sure x=.00do( x=x+.01MSComm1.Output = Chr(x))while(x<3000)is between the privent sub click() part and the end sub part.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.