[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4149: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3027)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4149: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3027)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4149: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3027)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4149: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3027)
Pete's QBASIC Site • Serial Port
Page 1 of 1

Serial Port

Posted: Sun May 14, 2006 3:13 pm
by Brandon
I have 2 PCs and a cable to connect PCs through the serial port. The cable works with the PCs(It worked with File and setings transfer wizard. I would like to use it with QBasic to send variables back and forth. How do I do this?



--------------
http://brandoncornell.com

Posted: Mon May 15, 2006 4:48 pm
by Patz QuickBASIC Creations
Basically, you need to have a computer running a sending program, and the other running a recieving program.

Sending program (sends key strokes)

Code: Select all

'PQBC Serial Link Terminal
WHILE KEY$ <> CHR$(27)     'Terminates on ESC
KEY$ = ""
WHILE KEY$ = ""
KEY$=INKEY$
WEND
OUT(&037F,ASC(KEY$))
WEND
I *THINK*...
  • the syntax is OUT(ComPortAddress, ValueToSend)
    &037F is the normal COM1 address
Although I may be wrong.

Recieving program

Code: Select all

X=1:Y=1     'Used to display text with LOCATE
WHILE A <> 27
A=0
WHILE A = 0
A = INP(&037F)
WEND
LOCATE X,Y:PRINT CHR$(A)
X=X+1
IF X > 80 THEN:X=1:Y=Y+1
WEND
Also making another assumption here... (The NULL signal is 0?) If not, both lines that say A=0 needs to be changed to A=(nullsignal)




Also, shouldn't this be posted in QB Q&A?

Posted: Mon May 15, 2006 6:26 pm
by {Nathan}
Patz, I skimmed through your code and noticed your comment on X & Y varibles, and how they were used in the LOCATE statement. For some odd reason, in LOCATE the parameters are Y then X, so they should be swapped to:

Code: Select all

LOCATE Y, X
Heh...
(From the demented mind of a crazed 13 year old...)

0_0

Posted: Tue May 16, 2006 4:47 pm
by Patz QuickBASIC Creations
OMFG... That is such a NOOBish mistake... I am sorry. Nathan is right. QB always has row then column. So it should be LOCATE Y,X.
Guess I have been graphing on coordinate planes in Algebra too much...

Posted: Thu Jun 08, 2006 8:15 pm
by PipeRifle
Dear Patz,

Uh... can you really do that? Don't you need settings like baud rate and parity to make it work?

Posted: Fri Jun 23, 2006 4:35 pm
by Patz QuickBASIC Creations
Don't know... Test it and find out :wink: