The problem that I am having with the prog below, I can not figure out how to capture the keypress on the other end. With the prog below, on the dos side, I get a 0 every half a second, even when I press a key on the other end. But I do get an "A" on the Hyperterminal side, so I have communication in one direction. I tried using a 'wait &h3f8, ByteIn', to see if I could get the prog to wait for the keypress from the other side, that did not work out.
I guess I need some ideas as to how this should be approached.
Thanks
Code: Select all
' Test2.bas
' MyTerminal.exe
' Grabs the exiting values of the command prompt window
locate ,,0
dim as integer oldcolor = color
dim as integer oldwidth = width
'New code goes here
dim ByteIn as byte
Open Com "COM1:9600,N,8,1" As 1
if Err <> 0 then
print "Error opening COM1:"
sleep
end
end if
do
input #1, ByteIn '
print ByteIn 'Print the char it received
print #1, "A" 'Test to see if the other end got it
sleep 500,0 'Slow the do loop down
' loop until Inkey$ = Chr$(27)
loop until inkey = "'" 'This char " ' " stops the program
close #1
' Restore the command prompt window to the old settings
width oldwidth and &hFFFF, oldwidth shr 16
color oldcolor and &hFFFF, oldcolor shr 16
view print 1 to oldwidth shr 16
' cls