| | |
Can anyone help me, please?
![]() |
•
•
Join Date: Feb 2004
Posts: 4
Reputation:
Solved Threads: 0
Can anyone help me to convert the following BASIC langauge into Visual Basic source code? Please help. I'm new in programming. Thanks alot.
-----------
NEW
10 REM Test Program Four - RG 9305.11
11 REM Walking Program for BORIS Connected to PC Parallel Port
12 REM Control from numeric keypad: UP arrow = Forward, etc.
13 REM
14 REM Send bits to the parallel port with LPRINT CHR$(Bits);
15 REM
16 REM Bits = 1*n + 2*n + 4*n + 8*n + 16*n + 32*n + 64*n + 128*n
17 REM
18 REM Bits equation sets bits ON if n = 1 or OFF if n = 0
19 REM First position (1*n) is bit 0
20 REM Last position (128*n) is bit 7
21 REM Calculate with each n to 1 or 0 for other output patterns
22 REM
23 REM Note: Ending semicolon (
on LPRINT command holds
24 REM bit pattern at parallel port until next LPRINT
25 REM
30 DELAY = 350: REM Increase for slower walk, decrease for faster
40 PRINT "Press keypad arrow keys for Fwd, Back, Left, Right"
50 PRINT "Press space bar for Stop"
60 PRINT "Press Q at any time to Quit"
100 REM Stop walking
110 LPRINT CHR$(0); : GOSUB 1000: REM Clear All Bits
120 GOTO 100
200 REM Walk Forward
210 LPRINT CHR$(65); : GOSUB 1000: REM Bit 6, 0 ON
220 LPRINT CHR$(4); : GOSUB 1000: REM Bit 2 ON
230 LPRINT CHR$(130); : GOSUB 1000: REM Bit 7, 1 ON
240 LPRINT CHR$(32); : GOSUB 1000: REM Bit 5 ON
250 GOTO 200 300 REM Walk Reverse
310 LPRINT CHR$(65); : GOSUB 1000: REM Bit 6, 0 ON
320 LPRINT CHR$(32); : GOSUB 1000: REM Bit 5 ON
330 LPRINT CHR$(130); : GOSUB 1000: REM Bit 7, 1 ON
340 LPRINT CHR$(4); : GOSUB 1000: REM Bit 2 ON
350 GOTO 300
400 REM Rotate Left 410 LPRINT CHR$(66); : GOSUB 1000: REM Bit 6, 1 ON
420 LPRINT CHR$(32); : GOSUB 1000: REM Bit 5 ON
430 LPRINT CHR$(129); : GOSUB 1000: REM Bit 7, 0 ON
440 LPRINT CHR$(4); : GOSUB 1000: REM Bit 2 ON
450 GOTO 400
500 REM Rotate Right
510 LPRINT CHR$(66); : GOSUB 1000: REM Bit 6, 1 ON
520 LPRINT CHR$(4); : GOSUB 1000: REM Bit 2 ON
530 LPRINT CHR$(129); : GOSUB 1000: REM Bit 7, 0 ON
540 LPRINT CHR$(32); : GOSUB 1000: REM Bit 5 ON
550 GOTO 500
1000 REM Check Key Press and Do Delay Loop
1010 A$ = INKEY$
1020 IF A$ = " " THEN PRINT "Stop": LPRINT CHR$(0); : GOTO 100
1030 IF A$ = CHR$(0) + "H" THEN PRINT "Forward": LPRINT CHR$(0); : GOTO 200
1050 IF A$ = CHR$(0) + "P" THEN PRINT "Reverse": LPRINT CHR$(0); : GOTO 300
1060 IF A$ = CHR$(0) + "K" THEN PRINT "Left" : LPRINT CHR$(0); : GOTO 400
1070 IF A$ = CHR$(0) + "M" THEN PRINT "Right" : LPRINT CHR$(0); : GOTO 500
1080 IF A$ = "Q" OR A$ = "q" THEN LPRINT CHR$(0); : END
1100 FOR I = 1 TO DELAY
1110 NEXT I
1120 RETURN
1900 END
RUN
----------
-----------
NEW
10 REM Test Program Four - RG 9305.11
11 REM Walking Program for BORIS Connected to PC Parallel Port
12 REM Control from numeric keypad: UP arrow = Forward, etc.
13 REM
14 REM Send bits to the parallel port with LPRINT CHR$(Bits);
15 REM
16 REM Bits = 1*n + 2*n + 4*n + 8*n + 16*n + 32*n + 64*n + 128*n
17 REM
18 REM Bits equation sets bits ON if n = 1 or OFF if n = 0
19 REM First position (1*n) is bit 0
20 REM Last position (128*n) is bit 7
21 REM Calculate with each n to 1 or 0 for other output patterns
22 REM
23 REM Note: Ending semicolon (
on LPRINT command holds 24 REM bit pattern at parallel port until next LPRINT
25 REM
30 DELAY = 350: REM Increase for slower walk, decrease for faster
40 PRINT "Press keypad arrow keys for Fwd, Back, Left, Right"
50 PRINT "Press space bar for Stop"
60 PRINT "Press Q at any time to Quit"
100 REM Stop walking
110 LPRINT CHR$(0); : GOSUB 1000: REM Clear All Bits
120 GOTO 100
200 REM Walk Forward
210 LPRINT CHR$(65); : GOSUB 1000: REM Bit 6, 0 ON
220 LPRINT CHR$(4); : GOSUB 1000: REM Bit 2 ON
230 LPRINT CHR$(130); : GOSUB 1000: REM Bit 7, 1 ON
240 LPRINT CHR$(32); : GOSUB 1000: REM Bit 5 ON
250 GOTO 200 300 REM Walk Reverse
310 LPRINT CHR$(65); : GOSUB 1000: REM Bit 6, 0 ON
320 LPRINT CHR$(32); : GOSUB 1000: REM Bit 5 ON
330 LPRINT CHR$(130); : GOSUB 1000: REM Bit 7, 1 ON
340 LPRINT CHR$(4); : GOSUB 1000: REM Bit 2 ON
350 GOTO 300
400 REM Rotate Left 410 LPRINT CHR$(66); : GOSUB 1000: REM Bit 6, 1 ON
420 LPRINT CHR$(32); : GOSUB 1000: REM Bit 5 ON
430 LPRINT CHR$(129); : GOSUB 1000: REM Bit 7, 0 ON
440 LPRINT CHR$(4); : GOSUB 1000: REM Bit 2 ON
450 GOTO 400
500 REM Rotate Right
510 LPRINT CHR$(66); : GOSUB 1000: REM Bit 6, 1 ON
520 LPRINT CHR$(4); : GOSUB 1000: REM Bit 2 ON
530 LPRINT CHR$(129); : GOSUB 1000: REM Bit 7, 0 ON
540 LPRINT CHR$(32); : GOSUB 1000: REM Bit 5 ON
550 GOTO 500
1000 REM Check Key Press and Do Delay Loop
1010 A$ = INKEY$
1020 IF A$ = " " THEN PRINT "Stop": LPRINT CHR$(0); : GOTO 100
1030 IF A$ = CHR$(0) + "H" THEN PRINT "Forward": LPRINT CHR$(0); : GOTO 200
1050 IF A$ = CHR$(0) + "P" THEN PRINT "Reverse": LPRINT CHR$(0); : GOTO 300
1060 IF A$ = CHR$(0) + "K" THEN PRINT "Left" : LPRINT CHR$(0); : GOTO 400
1070 IF A$ = CHR$(0) + "M" THEN PRINT "Right" : LPRINT CHR$(0); : GOTO 500
1080 IF A$ = "Q" OR A$ = "q" THEN LPRINT CHR$(0); : END
1100 FOR I = 1 TO DELAY
1110 NEXT I
1120 RETURN
1900 END
RUN
----------
so you want someone to convert this for you? Interesting request. Let me ask you what version on visual basic do you have right now?
where did you get he source code in BASIC from? Do you have the source files for it? If so post them. Makes it easier to convert.
where did you get he source code in BASIC from? Do you have the source files for it? If so post them. Makes it easier to convert.
•
•
Join Date: Feb 2004
Posts: 4
Reputation:
Solved Threads: 0
Actually, I'm 1st year student majoring in Robotic. This BASIC code is used as a program to control a six legged robot called BORIS using parallel port. The program is to send set of bits to parallel port. The original source code is here http://www.musclewires.com/mwpb.html . And I'm a beginner in Visual Basic. I'm using Visual Basic.net. Maybe you can just write an simple code like how to send bits to the parallel port using VB.net in windows XP to me. Highly appreciate your kindness. Thanks a lot.
•
•
Join Date: May 2004
Posts: 1
Reputation:
Solved Threads: 0
Sorry, Leon. It's going to take a lot more than a code translation to make this thing work. Direct access to the lprint chr$(number) command was last available in QBasic. Microsoft has taken away the ability to control the parallel port in VB. I hear there's some loopholes in the windows API so it's not impossible, but I haven't been able to make my parallel port work yet.
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Connection String
- Next Thread: Timed Blinking label caption
| Thread Tools | Search this Thread |
* 6 2007 access activex add age basic beginner birth bmp calculator cd cells.find click client code college connection connectionproblemusingvb6usingoledb creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit excel excelmacro file filename form header iamthwee image inboxinvb internetfiledownload listbox listview liveperson login looping microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading remotesqlserverdatabase report save search sendbyte sites sql sql2008 sqlserver subroutine tags time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web windows






