mscomm program problem

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Sep 2006
Posts: 2
Reputation: adhi is an unknown quantity at this point 
Solved Threads: 0
adhi adhi is offline Offline
Newbie Poster

mscomm program problem

 
0
  #1
Sep 6th, 2006
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
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 187
Reputation: aparnesh is an unknown quantity at this point 
Solved Threads: 10
aparnesh's Avatar
aparnesh aparnesh is offline Offline
Junior Poster

Re: mscomm program problem

 
1
  #2
Sep 6th, 2006
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
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. for icount = 1 to 10
  2. Next
Last edited by Comatose; Sep 6th, 2006 at 6:44 pm.
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 2
Reputation: adhi is an unknown quantity at this point 
Solved Threads: 0
adhi adhi is offline Offline
Newbie Poster

Re: mscomm program problem

 
0
  #3
Sep 7th, 2006
thanks will try
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC