線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1446
推到 Plurk!
推到 Facebook!

一個關於步進馬達控制的問題

缺席
49113018
一般會員


發表:1
回覆:0
積分:0
註冊:2005-03-25

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-03-25 11:34:36 IP:203.68.xxx.xxx 未訂閱
我照著一本書打了程式碼(用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

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-04-20 16:46:32 IP:140.127.xxx.xxx 未訂閱
出錯的地方: 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

發送簡訊給我
#3 引用回覆 回覆 發表時間:2005-04-23 00:10:27 IP:61.59.xxx.xxx 未訂閱
你應該是少了類似DIO.DLL的檔案及在模組裡少了一些 function,目前我也在玩VB.NET控制Print Port我目前 已經成功的做出來了..我所使用的參考書 "Visual Basic與串並列通訊控制實務"... 你可以參考看看... 若你要使用我的模組的話,需先安裝HwPortIO.exe 下面的圖片是我參考書上所寫的模組     發表人 - kane.ch 於 2005/04/23 00:31:23
系統時間:2024-05-02 18:56:07
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!