科幻未来

pic16f508步进电机程序

时间:2010-12-5 17:23:32  作者:锦绣二重唱   来源:陈立靖  查看:  评论:0
内容摘要:>;FileSTEP508.ASM;...forPIC12C508Amicrocontroller;ProgramtousePICasastepanddirectioncontrollerforaun

>

;FileSTEP508.ASM
;...forPIC12C508Amicrocontroller
;ProgramtousePICasastepanddirectioncontrollerforaunipolar
;stepmotor.StepanddirectionPINsareGPIO-5,GPIO-3;GPIO_0,GPIO_1,GPIO_2,GPIO_4,are;thewindings;inorder(drivenbyNPNsmallsigtransistorsorMOSFETS)
;Stepsonnegativegoingedgeofsteppulse.

;CPUconfiguration
;(It’sa12C508A,InternalRCoscillator,
;watchdogtimeroff,power-uptimeron)
LISTP=12C508A
processor12c508A
include
;__config_IntRC_OSC&_WDT_OFF&_PWRTE_ON&_MCLRE_OFF

;Declarevariables

pattAequH’0D’;Currentsteppatternnumber(0-7)foraxisA
lastAequH’0E’;LaststateofsteppinonaxisA(1ishigh,0islow)
inportequH’11’;ValueofportAwhenread(storedforlateraCCess)
tempequH’12’

#DEFINESTEPinport,5;Steppulseinput
#DEFINEDIRinport,3;DirectionInput

OPMASKEQUB’11000000’
IOMASKEQUB’00101000’;allbitsoutput(exceptGP3andGP5)
;GP0,GP1,GP2,GP4controlsThestepperCoils
;GP3controlsdirection
;GP5ControlsStepPulses



ORG0

;startofmaincode
;

copyright © 2022 powered by 安塔拉哈被窝电影网午夜伦电影  sitemap