Home Parallel Port Serial Port USB Webboard API Project Link FAQ Contact Us About Us

 Interfacing Hardware Project

Interfacing Step Moter Driver --> IM483IE project
Thai version Click here

You can get Source Code Project go to Download this page for your development next step -->

Picture 1 : manage lay out for all control layout in this program

Picture 2 : Show detail in create menu

Picture 3 : Setting parameter for communicate with Comm Port that we can put value in this

 

Picture 4 : Setting interval value of timer in polling to Comm port .

Programming Code with explanation each step and event
Private Sub Command1_Click()  
' Send character "+" and value for defind step quantity of motor
MSComm1.Output = "+" & Text8.Text
End Sub
Private Sub Command2_Click()
' Send character "-" and value for defind step quantity of motor
MSComm1.Output = "-" & Text8.Text
End Sub
Private Sub Command3_Click()
' Send Character "M" and value for defind step quantity in movement
MSComm1.Output = "M" & Text1.Text
End Sub
Private Sub Command4_Click()
' Send Character "F"and value for defind step quantity in seeking to home position.
MSComm1.Output = "F" & Text2.Text
End Sub
Private Sub Command5_Click()
Call SettingValue sub program
Form1.Height = 3030
Frame1.Visible = False
Frame2.Visible = False
End Sub
Private Sub Command6_Click()
' Set Default value toText and Combo for communicate between Comm port and Driver
Text3.Text = "10"
Text4.Text = "10"
Text5.Text = "20"
Text7.Text = "20"
Combo1.Text = "0"
Combo2.Text = "Com1"
Text6(0).Text = "9600"
Text6(1).Text = "N"
Text6(2).Text = "8"
Text6(3).Text = "1"
End Sub
Private Sub Form_Activate()
' Message box caution to set all parameter before running program.
MsgBox " You must setting value for Comm Port and Defaulte Driver IM483IE before running program", vbInformation, " Before running program caution"
End Sub
Private Sub Form_Load()
Form1.Height = 7650
End Sub
Private Sub mnuCom_Click()
Frame1.Visible = True
Frame2.Visible = True
Form1.Height = 7650
End Sub
Private Sub mnuDrive_Click()
Frame1.Visible = True
Frame2.Visible = False
Form1.Height = 5790
End Sub
Private Sub mnuExit_Click()
Unload Me
End Sub
Private Sub Timer1_Timer()
MSComm1.Output = "z 0" ' Send Charecter to ask Driver IM483IE in polling
End Sub
Private Function GetInputData(ByVal SndData As String)

' In case we are going to receive value from microcontroller, We have get garbage in some time,
So,We should be method programming in intercept the garbage which can get only Charecter,Function below can help you in this thing .

Dim VbspLen As Integer, VbspInd As Integer
Dim VbspCode As Byte
Dim VbspPrev As String, VbspCur As String
Dim VbspData As String
VbspLen = Len(SndData)
VbspPrev = " "
If VbspLen > 0 Then
For VbspInd = VbspLen To 1 Step -1
VbspCur = Mid$(SndData, VbspInd, 1)
If (Asc(VbspCur) > 32) And (Asc(VbspPrev) < 32) Then
VbspCode = VbspCode + 1
If VbspCode > 1 Then
Exit For
End If
End If
If (VbspCode = 1) And (Asc(VbspCur) > 32) Then
VbspData = VbspCur & VbspData
End If
VbspPrev = VbspCur
Next VbspInd
GetInputData = VbspData
Else
GetInputData = SndData
End If
End Function

Public Sub SettingValue()
' Setting value for communicate between Comm Port and Driver IM483IE
MSComm1.RThreshold = 1
MSComm1.Settings = Text6(0).Text & "," & Text6(1).Text & _
"," & Text6(2).Text & Text6(3).Text
MSComm1.CommPort = Right(Combo2.Text, 1)
MSComm1.PortOpen = True
MSComm1.PortOpen = True
MSComm1.Output = "K" & Text3.Text & Space(1) & Text4.Text & Space(1) & _
"I" & Text5.Text & Space(1) & "V" & Text7.Text & Space(1) & _
"D" & Combo1.Text
End Sub

 

Picture 5 : When you run program which show caution box in setting value for Interface Hardware before you continue.

Picture 6 : Windows form of this program for define value for interface Hardware

Picture 7 : When you pressed "Done" button the program will be show dialog form thus picture above but if you want to set the new value that you can click menu bar above after that select" Setting Defaulte"



Copyright (c) 2000 thaiio.com all rights reserved.  Contact webmaster :webmaster@thaiio.com