Jump to content

RS232 Commg problem.


Recommended Posts

I want to use com1 to com2 at the same time in same computer. 
 
  1.com1 send string abcde to com2 (At this time will receive com2 message)
  2.com2 send string abcde to com1 (At this time will receive com1 message)
 
I try to use the code.
 
while 1
    $a = "abcdefhhijklmnopqrstuvwxyz1234567890abcdefhhijklmnopqrstuvwxyz1234567890"
    _CommSwitch(1)
    _CommSendString($a)
    _CommSwitch(2)
    _CommSendString($a)
 
    _CommSwitch(1)
    $test1 = _Commgetstring()
    _CommSwitch(2)
    $test2 = _Commgetstring()
wend
 
But it seems that there is a delay time. 
 
_Commgetstring() always not receive the full message.(Only received abcdefg)
 
What do I do wrong? 
 
If want to send message with delay time.(Use $a Send message,press a then sleep (100) ) .
 
How should I do?
 
Or with only the following methods ..
   _CommSendString("a")
  sleep(100)
  _CommSendString("b")
  sleep(100)
   _CommSendString("c")
 
Please help.
Thank.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...