sporkman
01-25-2002, 02:11 PM
I have been sucked into a robotics program going to NY in a month. I am in desperate need to get my problem solved so any please help.
I am using a tool called an experimenter(it is old and outdated but all we have) www.fascinatingelectronics.com
It uses simple string communication to communicate with the computer. My QBasic program works (see below) for reading strings from the device but my VB Program does not.
My VB Program uses the Serial ActiveX control. (www.jspayne.com). The demo app in this ActiveX package works for input but my program does not. The demo code is in ActiveX Demo.txt.
Where is the port read in that mess? And how does it differ from just reading a string of characters from the serial port?
THANK YOU
backspace$ = Chr$(8)
linefeed$ = Chr$(10)
Cls
Do
INPUT "Which COM port will the Experimenter use (1 or 2)"; comPort%
Print
Loop Until comPort% = 1 Or comPort% = 2
LOCATE , , 0
Print USING; "Connecting to the Experimenter through COM#."; comPort%
Print
On Error GoTo ioError1
If comPort% = 1 Then
Open "com1: 9600,n,8,1" For Random As #1
Else
Open "com2: 9600,n,8,1" For Random As #1
End If
On Error GoTo ioError2
Cls
PLAY "MB L32 A B > C D E F G > A"
Print "Connected to the EXPERIMENTER!"
Print "------------------------------"
Print "Type Q to Quit and return to BASIC."
Print "Type ? for help with Experimenter commands."
Print
Print "To move stepper:"
Print "H 0 direction(1 or 2) steps speed(as low as 3) 8"
Print
LOCATE , , 1
Key$ = INKEY$
Do Until UCase$(Key$) = "Q"
If Len(Key$) > 0 Then Print #1, Key$;
If Not EOF(1) Then
expKey$ = Input$(1, #1)
If expKey$ = backspace$ Then
LOCATE , POS(0) - 1
Print " ";
LOCATE , POS(0) - 1
ElseIf Not espKey$ = linefeed$ Then Print expKey$;
End If
End If
Key$ = INKEY$
Loop
Cls
End
ioError1:
PLAY "MB L16 A B C"
Print "Be sure the Experimenter is powered-on, 9600 baud."
Print "Verify the experimenter is connected to the correct COM port."
Print
On Error GoTo ioError2
Resume
ioError2:
Resume
I am using a tool called an experimenter(it is old and outdated but all we have) www.fascinatingelectronics.com
It uses simple string communication to communicate with the computer. My QBasic program works (see below) for reading strings from the device but my VB Program does not.
My VB Program uses the Serial ActiveX control. (www.jspayne.com). The demo app in this ActiveX package works for input but my program does not. The demo code is in ActiveX Demo.txt.
Where is the port read in that mess? And how does it differ from just reading a string of characters from the serial port?
THANK YOU
backspace$ = Chr$(8)
linefeed$ = Chr$(10)
Cls
Do
INPUT "Which COM port will the Experimenter use (1 or 2)"; comPort%
Loop Until comPort% = 1 Or comPort% = 2
LOCATE , , 0
Print USING; "Connecting to the Experimenter through COM#."; comPort%
On Error GoTo ioError1
If comPort% = 1 Then
Open "com1: 9600,n,8,1" For Random As #1
Else
Open "com2: 9600,n,8,1" For Random As #1
End If
On Error GoTo ioError2
Cls
PLAY "MB L32 A B > C D E F G > A"
Print "Connected to the EXPERIMENTER!"
Print "------------------------------"
Print "Type Q to Quit and return to BASIC."
Print "Type ? for help with Experimenter commands."
Print "To move stepper:"
Print "H 0 direction(1 or 2) steps speed(as low as 3) 8"
LOCATE , , 1
Key$ = INKEY$
Do Until UCase$(Key$) = "Q"
If Len(Key$) > 0 Then Print #1, Key$;
If Not EOF(1) Then
expKey$ = Input$(1, #1)
If expKey$ = backspace$ Then
LOCATE , POS(0) - 1
Print " ";
LOCATE , POS(0) - 1
ElseIf Not espKey$ = linefeed$ Then Print expKey$;
End If
End If
Key$ = INKEY$
Loop
Cls
End
ioError1:
PLAY "MB L16 A B C"
Print "Be sure the Experimenter is powered-on, 9600 baud."
Print "Verify the experimenter is connected to the correct COM port."
On Error GoTo ioError2
Resume
ioError2:
Resume