資源描述:
《步進電機程序》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在工程資料-天天文庫。
1、步進電機程序Thestepmotor,28byj-48,andthedriverandprogramming(2010-02-2813:28)reprintthelabel:thestepmotorcategory:McS-51singlechip28byj-48steppingintothemachine:Steppingmotorisanactuatorthatconvertselectricalimpulsesintoangulardisplacement.Popularpoint:whenthestepperdriverreceive
2、sapulsesignal,itisdrivingasteppermotoraccordingtosetthedirectionofafixedAngle(andthestepAngle).Youcancontroltheamountofangulardisplacementbycontrollingthepulse,soastoachieveaccuratepositioning.Atthesametime,youcancontrolthespeedandaccelerationofthemotorbycontrollingthepulse
3、frequency.Thestepmotoris28BYJ48andthevoltageisDC5V-DC12V.Whenaseriesofcontinuouscontrolpulsesareappliedtothestepmotor,itcancontinuouslyrotate?Eachpulsesignalcorrespondingtothesteppermotorofaphaseortwophasewindingcurrentstatuschangeonce,alsocorrespondstotherotorturnedacertai
4、nAngle(Angle)whereastep?Whenthechangeinthecurrentstateiscompletedacycle,therotorturnsatoothspace?Thefour-phasestepmotorcanberunindifferentmodesofcommunication,andthecommonelectricmodehasAsingle(singlephasewinding)fourbeats(a-b-c-d-a???)?Double(doublephasewinding)fourbeats(A
5、B-be-cd-da-AB一???)Eightbeats(a-b-b-b-c-cd-d-d-da-a???)Theredlineiscormectedtothepower5V,theorangewiretothePl.3,theyellowwiretothePl.2,thepinkwiretothePl.1,bluetothePl.0.Sincethesingle-chipinterfacesignalisnotsufficientlylargeenoughtobeamplifiedbytheULN2003andconnectedtothec
6、orrespondingmotorinterface,hereisthefollowing:Orangepowderblue16(Pl)10000x08One,one,zero,zero,zero,zero,c0,1,0,0,0x040,1,1,0,0x060,0,1,0,0x020,0,1,1,1,0x030,0,0,1,0x011,o,0,1,0x09InreverseorderSoyoucandefinetherotationphasesequenceUcharcodeCCW[8]二{0x08,0x0c,0x04,0x06,0x02,0
7、x03,0x09};//reverseclockrotationphasesequenceUcharcodeCW[8]二{0x09,0x01,0x03,0x02,0x06,0x0c,0x08}//theclockisrotatingthephasesequencetableClanguagecode:#include#include#defineucharunsignedchar#defineuintunsignedintUcharcodeCCW[8]二{0x08,0x0c,0x04,0x06,0x
8、02,0x03,0x09};//reverseclockrotationphasesequenceUcharcodeCW[8]二{0x09,0x01,0x03,0x