|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Step Motor Control Command
I have very little programming experience but I would like to learn to use visual basic. I iave VB6 I guess I could also try the new express edition. I'm trying to control movement of a Step motor. with rs232 communication, some commands shown. I can configure most items via it’s gui, but I can’t perform run cycles, just one for one travel commands, so I need to perform a loop cycle. I would like to at least configure the serial port and make the motor move for now, I'd be thrilled!
Very basic for now, I’ll learn other implementations later… All I need for now • Configure • Move • Write • Loop Each comand has to end with a carriage return chr$(13) but I'm not sure how to contruct with VB, they had a breif example but do not know how to configure port ect. any help will be greatly appreciated. See Below ****************************************** I. configure serial port • Baud Rate: 38400 • Parity: None • Data Bits: 8 • Stop Bits: 1 • Flow Control: none II. Send index to motor: "@0N1_500” & Chr$(13) III. loop ‘where 0=address,N=Index Command 500=IndexTravel chr$(13)=carriage rtn For count = 0 to 4449 ‘Set Direct = cw "@0+” & Chr$(13) ‘Move Motor * Index Number - move motor up position "@0G1” & Chr$(13) ‘Set Direct = ccw‘ "@0+” & Chr$(13) ‘Move Motor * Index Number – move motor down position "@0G1” & Chr$(13) Count = count+1 write (count, pc date & time) stamp to text file Next Count Brief overview: N - Index Number Format: N#_[value] - where # is the motion profile number 1 or 2 Sample: N1_10000 Index number of profile 1 equals 10000 Description: This command sets the number of pulses to index for the motion profile. This value must be set before motion begins. These values are saved in the EEProm for stand-alone use. Range: 0 - 8,388,607 Unit Selection In order to select a unit the @ command followed by 0 (address of the unit) must be sent. NOTE: There should be no spaces between the @ and the 0. How to select the unit: @0 (Unit is selected) How to get a response from the unit: @0$ (Carriage Return) After the $ command, the pulse generator will return a SMSI30 + the current version number. Note: In direct talk mode each command is followed by a carriage return. The unit communicates in half duplex mode, therefore proper setup of hyper terminal is necessary to view characters, if characters are to be echoed back to the screen. Instructions All instructions require that no spaces be sent between the command and the parameter followed by a carriage return. The commands are also case sensitive and are all sent as capitals. Command Summary: A - Acceleration/Deceleration B - Base Speed G - Go (Index) H - Hard Limit M - Max Speed N - Index Number R - Microstep Resolution S - Soft Limit T - Complete Time V - Verify + - Clockwise Direction - - Counterclockwise Direction $ - Version Number Register ! - Error Codes Register % - Verify Controller Address ~ - Set Controller Address *** The only Programming Example They Have ********* This Example is for Axis=0, and Profile=1 DimConst DefaultTimeout As Single = 0.5 frmMain.MSComm1.Output = "@0A1_100000. & Chr$(13) .Set Acceleration Pause DefaultTimeout frmMain.MSComm1.Output = "@0B1_1000. & Chr$(13) .Set Base Speed Pause DefaultTimeout frmMain.MSComm1.Output = "@0M1_4000. & Chr$(13) .Set Maximum Speed Pause DefaultTimeout frmMain.MSComm1.Output = "@0N1_500. & Chr$(13) .Set Index Number Pause DefaultTimeout frmMain.MSComm1.Output = "@0T1_100. & Chr$(13) .Set Complete Time Pause DefaultTimeout frmMain.MSComm1.Output = "@0R8. & Chr$(13) .Set Microstep Resolution Pause DefaultTimeout frmMain.MSComm1.Output = "@0+. & Chr$(13) .Set Direction CW Pause DefaultTimeout frmMain.MSComm1.Output = "@0G1. & Chr$(13) .Start the Index Pause DefaultTimeout |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Step Motor Control Command |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|