| | |
mscomm program problem
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Sep 2006
Posts: 2
Reputation:
Solved Threads: 0
hi
i am a student. i am using vb6 to get an agv running. using mscomm to speak to a main micro which then addresses motor boards. at present i am just testing 2 motors to see if the program will work. in my foward command button the code is as follows:
1 mscomm.output = "MOT1SPF1000"
2 for icount = 1 to 10
3 icount = icount +1
4 next icount
5 mscomm.output = "MOT2SPF1000"
(the string basically tells motor 1 to turn forward at speed 1000)
the motors work fine when addressed indivually
but since i added lines 2-5 only 1 motor spins and it doesnt stop
please could someone advise me on how to correct the program
thank you
i am a student. i am using vb6 to get an agv running. using mscomm to speak to a main micro which then addresses motor boards. at present i am just testing 2 motors to see if the program will work. in my foward command button the code is as follows:
1 mscomm.output = "MOT1SPF1000"
2 for icount = 1 to 10
3 icount = icount +1
4 next icount
5 mscomm.output = "MOT2SPF1000"
(the string basically tells motor 1 to turn forward at speed 1000)
the motors work fine when addressed indivually
but since i added lines 2-5 only 1 motor spins and it doesnt stop
please could someone advise me on how to correct the program
thank you
U r incrementing the value twice. Once in the For (which will automatically increment by 1) and once inside the for loop. So ur icount values are 1,3,5,7... . Since it never reaches 10, it goes into an infinite loop.
Use
Use
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
for icount = 1 to 10 Next
Last edited by Comatose; Sep 6th, 2006 at 6:44 pm.
![]() |
Similar Threads
- problem relating to c program.... (IT Professionals' Lounge)
- Program Problem with a select statement to access Data base (C)
- how will i repeat my whole game program? (Java)
- Urgent - problem with links (Windows NT / 2000 / XP)
- *Pointer program problem. (C++)
- File processing problem (C++)
- It's Alive!! Program with a mind of it's own.... (Computer Science)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Problem with My Project (Missing Files)
- Next Thread: about vb forms
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





