I have write a counter program on arduino to test my stepping motor control program before I got the mechanical from the hardware team. I call it "Motor Emulator". The signals are stepA as the Stepping motor's colock pulse and dirA as the motor rotate direction. The program can track 2 motor at the same time and the pulse rate up to 25KHz (my system's max speed is 20K Step/seconds)
If I use Arduino Mega, maybe I can track 4 motor at the same time.
The right one is the old model use 7-segments , the left one use lcd.
Actually there are still some function need to extend like generate a output when count reach certain count.(Emulate the photo sensor's detection of the mechanical ruler or initial position).
Download MotoSignal.pde <- this generat the signal
Download LCDCounter.pde <- this is the counter code
PS.我這個人最大的問題就是腦袋跑得比手快 這個東西剛開始要做7-Segment版的 才把東西接好 7-Segment driver 測過後就發現其實可以 Track 2顆馬達 這樣用LCD比較方便 於是就今天就直接用LCD的版本 不過其實並不是很想寫 因為晚上就想到 那乾脆用Graphic LCD版的話還可以劃出真正機械的位置....不過這樣下去沒完為了 (直接上PC是不是更方便) 加上手邊也沒有Graphic LCD模組可以馬上給Arduino用 就老實的把Counter寫完了
Comments