CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 4 of 8 FirstFirst 1234567 ... LastLast
Results 46 to 60 of 107
  1. #46
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: recieving 3 value in uart

    He did say that he just wanted to receive and display these values. No need to have anything other than the buffer declared as form level var or static.
    Always use [code][/code] tags when posting code.

  2. #47
    Join Date
    Jun 2010
    Posts
    41

    Re: recieving 3 value in uart

    so there is nothing missing in the code, like "If Len(RLine) > 1"?

    Your right I will manipulate the data later into an equation and output the result of that equation, but for now I will test the data first by displaying it.
    Last edited by feitanx; June 18th, 2010 at 10:49 PM.

  3. #48
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: recieving 3 value in uart

    Quote Originally Posted by feitanx View Post
    so there is nothing missing in the code, like "If Len(RLine) > 1"?
    That line is not needed in this case.

    Have you tried it yet?
    Always use [code][/code] tags when posting code.

  4. #49
    Join Date
    Jun 2010
    Posts
    41

    Re: recieving 3 value in uart

    I tried it but there is no output in the text box. WHat could be wrong? is it the settings of the com or the code it self?

  5. #50
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: recieving 3 value in uart

    place a break point in the on comm event and see if you get there
    Always use [code][/code] tags when posting code.

  6. #51
    Join Date
    Jun 2010
    Posts
    41

    Re: recieving 3 value in uart

    what do you mean by break point?

    can you show me the codes

  7. #52
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: recieving 3 value in uart

    It is not code it is a basic debugging method. Click off to the left of a line of code or position your cursor on a line of code and hit F9. This will set a break point on that line. When the program is ran an comes to that line it will stop and you can see what the value of your vars are as well as confirm the code is being executed.

    It is starting to seem like you have 0 experience writing and testing code. You really need to play around with it a bit rather than try to get someone to give you 100% working code as you will never learn anything that way.
    Always use [code][/code] tags when posting code.

  8. #53
    Join Date
    Jun 2010
    Posts
    41

    Re: recieving 3 value in uart

    I thought its a code because there is a break in c programming. anyway in the code a(0) is directly equated to a textbox, should I equate it to a variable first like num1?.
    I did it, I break point the line, how to see the value? will it just popup?

  9. #54
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: recieving 3 value in uart

    place you mouse cursor over the var that you would like to check

    keep in mind it has to be one where that was set prior to the current line
    Always use [code][/code] tags when posting code.

  10. #55
    Join Date
    Jun 2010
    Posts
    41

    Re: recieving 3 value in uart

    what do you mean? I just placed the mouse cursor on the line after I break point but nothing happens

  11. #56
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: recieving 3 value in uart

    Clearly you did not try very much or you would have saw what I mean.
    Run the projram, when it hits the break point the program will stop and the current line will be highlighted. move your mouse over a var in the current line or one of the previous lines and you will see the value of the var.

    Again this is basic debugging and you need to play around with this stuff in order to fully understand it. Same is true for the code you have been given here in this thread you need to play around make changes and see what happens so you actually understand how to do it yourself.
    Always use [code][/code] tags when posting code.

  12. #57
    Join Date
    Jun 2010
    Posts
    41

    Re: recieving 3 value in uart

    Still I did not any value when I place the mouse cursor in the var.
    How the the comport by the way should I just leave it open?

  13. #58
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: recieving 3 value in uart

    Did the code hit the break point?
    Which var(s) did you try to test?

    Not sure what you mean by just leave it open. Clearly you can not receive any data via a closed port. Still you need to close the port when you are done with it. In many cases this would be when you close the program. In others it would be when you are done receiving data.
    Last edited by DataMiser; June 22nd, 2010 at 07:51 AM.
    Always use [code][/code] tags when posting code.

  14. #59
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: recieving 3 value in uart

    Show us the code you are using.
    Show us where you put the break point.

    What is your RThreshold setting on your MSComm control?
    Always use [code][/code] tags when posting code.

  15. #60
    Join Date
    Jun 2010
    Posts
    41

    Re: recieving 3 value in uart

    I did not set the RThreshold yet. What should be its setting?

    I put the breakpoint in this part:
    "Text1.Text = a(0) 'get first number" of the code.

    from this code
    Private Sub MSComm1_OnComm()
    Dim p%
    Static RLine$
    RLine = RLine + MSComm1.Input
    p = Instr(RLine, vbCr)
    If p Then ' a complete record with three numbers has been received now
    dim a$()
    a = Split(Left$(RLine,p-1), "/") 'split the line into the three numbers
    If UBound(a) = 2 Then
    Text1.Text = a(0) 'get first number
    Text2.Text = a(1) 'get second number
    Text3.Text = a(2) 'get third number
    End If
    RLine = Mid$(RLine,p+1) 'reset the receiver variable for the next line
    End If
    End Sub
    Last edited by feitanx; June 22nd, 2010 at 09:20 AM.

Page 4 of 8 FirstFirst 1234567 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured