Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Serial Port Communications - Aghh!

Status
Not open for further replies.

mingo7707

Programmer
Jun 4, 2002
5
US
I am trying to interface two computers together via their 9 pin serial ports (with a null-modem cable or something). I am doing a project in which one computer (the slower one) is constantly running a tight loop of code upon bootup. However, each time it loops, it would check the serial port to see if there is any data present. If there is, it would change some variables (with the replacement data it recieves), and restart the loop.

I have looked on the internet and I can't find a way to easily have the "master" computer send a command via the serial port to the "mindless" computer and have it recieved.

Can someone please help me out? any help would be appreciated. I am a rather newbie, and don't have too much experience in Qbasic.

Thanks a lot you guys,
Mingo
mingo7707@yahoo.com.ar
 
You can start with file IO. In BASIC, serial port can be opened as file. Look for OPEN COM in manual or internal help:
----TRANSMITTER
OPEN "COM1:300,N,8,1,CD0,CS0,DS0,OP0,RS,TB2048,RB2048" FOR RANDOM AS #1
PRINT #1, "HELLO!"
----RECEIVER
OPEN "COM1:300,N,8,1,CD0,CS0,DS0,OP0,RS,TB2048,RB2048" FOR RANDOM AS #1
WHILE LOC(1) = 0: WEND'WAITING FOR DATA
R$ = INPUT$(LOC(1), #1)'READ DATA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top