Pic16f508 stepper motor program

Single-chip microcontroller STM32L151CCU6
Mobile phone crystal 3.2*2.5mm 3225 26M (26.000MHZ) 7.5PF 10PPM 20PPM 30PPM
Imported original MOSFET FET
Factory direct sales - SMD aluminum electrolytic capacitor - straight plug solid capacitors, imported from Japan, made with high-quality aluminum foil

File: STEP508.ASM ; This assembly code is designed for the PIC12C508A microcontroller. ; It functions as a step and direction controller for a unipolar stepper motor. ; The step and direction pins are connected to GPIO-5 and GPIO-3, while the windings are controlled via GPIO-0, GPIO-1, GPIO-2, and GPIO-4. ; These outputs are driven by NPN small signal transistors or MOSFETs. ; Steps are triggered on the negative edge of the step pulse. ; CPU Configuration ; It's a 12C508A with internal RC oscillator, watchdog timer off, power-up timer on. LISTP=12C508A processor 12c508A include ; Configuration bits ; __config IntRC_OSC & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF ; Variable declarations pattA equ H'0D' ; Current step pattern number (0-7) for axis A lastA equ H'0E' ; Last state of step pin on axis A (1 = high, 0 = low) inport equ H'11' ; Value of port A when read (stored for later access) Temp equ H'12' ; Define step and direction pins #DEFINE STEP inport, 5 ; Step pulse input #DEFINE DIR inport, 3 ; Direction input OPMASK EQU B'11000000' IOMASK EQU B'00101000' ; All bits output (except GP3 and GP5) ; GP0, GP1, GP2, GP4 control the stepper coils ; GP3 controls direction ; GP5 controls step pulses ORG 0 ; Start of main code ; ************************************************* ; ; START OF PIC12c508A CODE FOR STEP ; ; ************************************************* ; ;------------------------------------------ ;**** Power-on reset start point ;------------------------------------------ ;*** Initialization of program MOVWF OSCCAL MOVLW OPMASK OPTION ; Set GPIO for input & output MOVLW IOMASK TRIS GPIO ; Clear port and zero motors MOVlw B'00000001' MOVwf GPIO clrflastA clrf pattA ; Loop around for a while to let everything stabilize MOVlw D'255' MOVwf inport Loop: decfsz inport, f ; goto loop ;*** Basic program loop ; Main routine - check pin states and step on negative edge ; Get port data and store, then check axis A ; A10 checks if old is 0, new is 1 (update register) ; A01 checks if old is 1, new is 0 (step and update register) ; Similarly for axis B Main: MOVf GPIO, w MOVwf inport CLRWDT A10: btfsr lastA, 0 goto A01 btfss STEP goto A01 bsf lastA, 0 A01: btfss lastA, 0 goto B10 btfsc STEP goto B10 bcf lastA, 0 goto stepA B10: goto main ;------------------------------------------ ;*** stepA - sub to cycle axis A one full step ; Dir of 1 is increase, else decrease stepA: btfss DIR decf pattA, f btfsc DIR incf pattA, f ; Check for pattern overflow and fix MOVf pattA, w XORLW '255' MOVlw D'07' btfsc STATUS, Z MOVwf pattA MOVf pattA, w XORLW '08' btfsc STATUS, Z clrf pattA ; Get step pattern and send to GPIO on bits 0-1-2-4 MOVf pattA, w Call dcode MOVwf GPIO goto main ;------------------------------------------ ;*** stepcode - sub to generate bit pattern for number in W (!! MUST BE 0-7 !!) ; Pattern is stored in W register dcode: addwf PCL, f ; Use below column for half-step retlw B'00000001' ; 0 retlw B'00000010' ; 1 retlw B'00000100' ; 2 retlw B'00010000' ; 3 retlw B'00000001' ; 4 retlw B'00000010' ; 5 retlw B'00000100' ; 6 retlw B'00010000' ; 7 ; Mandatory end of program command End ; PIC16F508 Stepper Motor Program

80V DC Power Supply

APM 80V dc switching power supply is applicable to automobile electronics product testing sector. It also covers the 48v power supply. APM power supply is built-in 12V DIN4089 automobile starting voltage waveform, be able to simulate automobile engine electronic performance test;Meanwhile ,the built-in 12V ISO-16750-2 engine start test waveform enable simulation of voltage drop test waveform and restoration function test waveform.

Some features of the DC Power Supply as below:


  • Ultrafast respond time and high efficiency.
  • Accurate voltage and current measurement capability
  • Constant Power and wide range of voltage and current output
  • Equips with LIST waveform editing function
  • Compliant with SCPI communication protocol
  • Support RS232/RS485/LAN/USB (standard) ,GPIB (optional)
  • Master/Slave parallel and series operation mode for up to 10 units
  • Full protection: OVP/OCP/OPP/OTP/SCP
  • Voltage drop compensation by remote sense line.
  • Have obtained CE,UL,CSA,FCC.ROHS


80V DC Power Supply,Variable DC Power Supply,Laboratory Power Supply,Modular Power Supply

APM Technologies Ltd , https://www.apmpowersupply.com

This entry was posted in on