TX buffer

Discussion in 'Questions (Windows Mobile)' started by micro, Sep 14, 2008.

  1. micro

    micro Well-Known Member Licensed User

    Hi,
    how can I know when the TX buffer is empty?
    It is very important for synchronize serial reading in rs485 mode.

    Thanks
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Please try the following code:
    obj is an Object from the Door library
    serial1 is the SerialPort object.
    Code:
    Sub App_Start
        serial1.New1
        obj.New1(
    False)
        ... 
    'open port
       obj.FromLibrary("serial1","sp",B4PObject(2))
        
    Msgbox(GetTX)
    End Sub

    Sub GetTX
        
    Return obj.GetProperty("BytesToWrite")
    End Sub
     
  3. micro

    micro Well-Known Member Licensed User

    Thanks :sign0188:
     
  4. micro

    micro Well-Known Member Licensed User

    Are you sure that the code work?
    serial is serial2.dll object
    objser is door.dll object

    Code:
    serial.RTSEnable = false
    serial.Output(dato)
    Do
        nbyte = objser.GetProperty(
    "BytesToWrite")
        
    DoEvents
    Loop While  nbyte > 0
    serial.RTSEnable = true
    nbyte is always 0 :confused:

    Thanks
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    According to Microsoft documentation it should return the number of bytes in the output buffer.
    Is it possible that the data was already sent?
    Maybe you should try to continuously send large data and see if the size is greater than zero.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice