Olumide
Olumide

Reputation: 5819

Opening a COM port in QBasic on Windows 7

I'm having difficulty opening a COM port in QBasic (obtained from www.qbasic.net) like so

OPEN "COM4:9600,N,8,1,BIN" FOR OUTPUT AS #1

However when I execute this statement in QBasic the open keyword is highlighted and I get the error message Bad file name.

Upvotes: 1

Views: 4962

Answers (4)

user28853919
user28853919

Reputation: 1

to try to send signals out of ur pc via pin 3 and 5 of SR232: script: wire a led to pins 3 and 5

sbtest: rem on error goto whatever open "COM1:75,N,8,1,BIN,CD19,CS19,DS19" FOR OUTPUT AS #1 CLOSE #1 sleep (1) rem sleep or whatever delay goto sbtest

to try receive smthng from pin3 and 5 of SR232 open "COM1:300,N,8,1,BIN,CD0,CS356,DS0" FOR OUTPUT AS #1 PRINT "Your Face" CLOSE #1

Upvotes: 0

david
david

Reputation: 2638

"COM4:9600,N,8,1,BIN"

The semantics for opening files changed in Win2K. On NTFS, the colon indicates an Alternate Data Stream, and the DOS use of the colon when opening serial devices was not implemented.

So on Win7, "COM4:9600,N,8,1,BIN" is a bad filename.

Upvotes: 0

Olumide
Olumide

Reputation: 5819

The following works FreeBasic

Open Com "COM1:9600,N,8,1" As 1

I recommend the FreeBasic IDE FBIde.

Upvotes: 1

Jeff
Jeff

Reputation: 1362

Is Com4: one of the available serial ports? Look in control panel and make it is one of the available ports. Also, you must make sure no other programs have the port open.

Upvotes: 1

Related Questions