一個關於步進馬達控制的問題 |
缺席
|
49113018
一般會員 發表:1 回覆:0 積分:0 註冊:2005-03-25 發送簡訊給我 |
我照著一本書打了程式碼(用PRINTER PORT 去控制步進馬達的書)
但是程式無法RUN 我是新手也不曉得該如何修改
Public step_con As Integer
Dim code(3) As Integer
Public x As Integer
Public direction As Byte Private Sub cmd_for_Click()
direction = 1
End Sub Private Sub cmd_rew_Click()
direction = 0
End Sub Private Sub cmd_start_Click()
Timer1.Enabled = True
Timer1.Interval = (310 - Slider1.Value)
End Sub Private Sub cmd_stop_Click()
Timer1.Enabled = False
lptout datp, &H0
End Sub
Private Sub Cmd_exit_Click()
lptout datap, &H0
End
End Sub Private Sub Form_load()
Timer1.Enabled = False
code(0) = &H1
code(1) = &H2
code(2) = &H4
code(3) = &H8
lptout datp, &H0
x = 0
End Sub Private Sub Slider1_Click()
Timer1.Interval = (310 - Slider1.Value)
End Sub Private Sub Text1_Change()
step_con = Val(Text1.Text)
End Sub Private Sub Timer1_Timer()
If step_con = 0 Then Call delay(10000): lptout datp, &H0: GoTo endt
^^^^^^^^^^^^^....RUN的時候顯示沒有定義這個SUB或FUNCTION 請教各位高手
我該如何修改呢
If direction = 1 Then
If x = 3 Then
x = 0
Else
x = x + 1
End If
Else
If x = 0 Then
x = 3
Else
x = x - 1
End If
End If
lptout datp, code(x)
step_con = step_con - 1
Text1.Text = step_con
endt:
End Sub
|
cashyy
高階會員 發表:117 回覆:322 積分:212 註冊:2004-04-30 發送簡訊給我 |
出錯的地方:
Private Sub Form_load()
Timer1.Enabled = False
code(0) = &H1
code(1) = &H2
code(2) = &H4
code(3) = &H8
lptout datp, &H0 //應該有一函式為lptout
x = 0
End Sub
還有call delay(1000000) //應該要有一函式為delay(Integer)
看書裡面有沒有一段函式為lptout(),或光碟裡面有沒有lptout模組 發表人 - cashyy 於 2005/04/20 17:21:25
|
kane.ch
一般會員 發表:2 回覆:3 積分:1 註冊:2005-04-22 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |