pic16f508步进电机程序

时间:2022-05-17 08:10:02来源:免费男人和女人牲交视频全黄作者:十堰市
>

;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
;

相关内容