|
-
Jul 15th, 2000, 07:46 PM
#1
Thread Starter
Lively Member
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
-
Jul 15th, 2000, 07:57 PM
#2
Frenzied Member
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
-
Jul 15th, 2000, 08:04 PM
#3
Thread Starter
Lively Member
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
-
Jul 15th, 2000, 08:04 PM
#4
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
-
Jul 16th, 2000, 03:47 AM
#5
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|