Results 1 to 5 of 5

Thread: need input !!!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 1999
    Location
    Belgium
    Posts
    98
    hi,

    I found this code:

    Dim iCOM1 As Integer
    iCOM1 = FreeFile
    Open "COM1" For Output As #iCOM1
    Print #iCOM1, "M" & Chr(13)
    Close #iCOM1

    When I do this command, I'll get a string back.
    Can somebody tell me how.

    thanks

  2. #2
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715

    all you need to do is this:
    Code:
    Open "C:\hello.dat" for Output as #1
    Print "Hello World"
    Close #1
    NXSupport - Your one-stop source for computer help

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 1999
    Location
    Belgium
    Posts
    98
    dear dimava,

    Thanks for your input, but ...

    I use the COM1 PORT to communicate with a other device.
    When I give the "M" & Chr(13) command, then 1 second later
    I get a string back. I need to capture this string through COM1.

    R@emdonck

  4. #4
    Guest
    I've added comments to the code that might help you:

    Code:
    Dim iCOM1 As Integer 
    
    'assigns iCOM1 to the next free file number
    iCOM1 = FreeFile 
    
    'opens the file COM1
    Open "COM1" For Output As #iCOM1  
    
    'the character M and carriage return are printed to the file
    Print #iCOM1, "M" & Chr(13)
    
    'file is closed
    Close #iCOM1

    Sunny

  5. #5
    Guest
    you should use the MSCOMM control to deal with com port stuff.

    plus, always use a variable to store the filenumber, never use '#1' or any other explicit number, because in some cases, one application can overwrite data used in another!

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