Shop OBEX P1 Docs P2 Docs Learn Events
Comm. vb and bs2 when compiled to exe — Parallax Forums

Comm. vb and bs2 when compiled to exe

ArchiverArchiver Posts: 46,084
edited 2003-10-01 18:16 in General Discussion
For each character i use
MSComm_obj.Output = Chr$(Asc(character))
FlushTxBuf MSComm_obj

It works fine (100% ok) in vb but it doesn't run anymore when i create and run
the exe-program (25% ok)

Has someone an idea to resolved this.

Private Sub FlushTxBuf(MSComm_obj As MSComm)
' flush transmit buffer
Do
DoEvents
'Debug.Print "MSComm_obj.OutBufferCount" & MSComm_obj.OutBufferCount
Loop Until (MSComm_obj.OutBufferCount = 0)
End Sub

Thanks
Pieter


[noparse][[/noparse]Non-text portions of this message have been removed]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-10-01 18:16
    One of the big differences between the VB
    development environment and the EXE
    environment is that the VB env. is
    ALWAYS p-coded. The EXE env can be
    native-coded -- usually is. The
    native-code is about 10 times faster.

    Also, the native-code can take advantage
    of some optimizations.

    I don't know what you mean by
    "it doesn't run anymore"? Then you say
    it is 25% OK. If it's not running, how
    can it be more than 0% OK?

    I assume the native-code version runs
    so fast the stamp can't keep up. You
    may need the VB 'sleep' command:

    Declare Sub Sleep Lib "Kernel32" _
    (ByVal DelaymS As Long)

    Then, insert 'Sleep(1)' to sleep
    1 mSec in your VB program, when you want
    to give the BS2 some time to deal.

    Note you'll still need to call 'DoEvents',
    as I don't think 'Sleep' does that.

    --- In basicstamps@yahoogroups.com, "Pieter Souvereyns" <pso@t...>
    wrote:
    > For each character i use
    > MSComm_obj.Output = Chr$(Asc(character))
    > FlushTxBuf MSComm_obj
    >
    > It works fine (100% ok) in vb but it doesn't run anymore when i
    create and run the exe-program (25% ok)
    >
    > Has someone an idea to resolved this.
    >
    > Private Sub FlushTxBuf(MSComm_obj As MSComm)
    > ' flush transmit buffer
    > Do
    > DoEvents
    > 'Debug.Print "MSComm_obj.OutBufferCount" &
    MSComm_obj.OutBufferCount
    > Loop Until (MSComm_obj.OutBufferCount = 0)
    > End Sub
    >
    > Thanks
    > Pieter
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.