4-27-2002
; ============================================================= ; INCLUDE FILE FOR CNC-1 ; ============================================================= CBLOCK 20H ;------------------------------------------------------- temp temp2 var1 var2 countx county countz flash ;------------------------------------------------------- ENDC PORTA_SET = b'00000000' ; all output PORTB_SET = b'11100000' ; high bits are step input, rest output OPTION_SET = b'11111111' ;don't really care INTCON_SET = b'00000000' ;no interrupts INDR = 00h ;Indirect addressing register porta EQU 5 portb EQU 6 ; enable lines #define EX porta,2 #define EY porta,0 #define EZ porta,3 ; step lines #define SX portb,5 #define SY portb,6 #define StepZ portb,7 #define RED porta,1 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ; ; CNC-1 test ; 2-16-2003 ; ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= list p=16f628 ; list directive to define processor include p16f628.inc ; processor specific variable definitions __CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _INTRC_OSC_CLKOUT & _MCLRE_OFF & _LVP_OFF INCLUDE cnc-1.h include macros.h ;--------------------------------------------------------------------------------------------- ORG 0x000 ; processor reset vector Main bsf status,rp0 ;select correct bank bcf status,rp1 movlw PORTA_SET movwf TRISA movlw PORTB_SET movwf TRISB movlw OPTION_SET movwf OPTION_REG movlw INTCON_SET movwf INTCON bcf status,rp0 ;select correct bank bcf status,rp1 movlf CMCON,#7 ;-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- ; ; Setup Variables clrf var1 clrf var2 bsf EX bsf EY bsf EZ bsf RED setred call wait decfsz var1,F goto setred bcf RED bcf EX bcf EY bcf EZ clrf countx clrf county clrf countz ;-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- ;--------------------------------------------------------------- ; Main program ; a) variables: countx,county,countz ; b) check step lines x,y,z ; if step is low, zero corresponding variable and clr enable ; ; c) loop 255 times ; d) increment countx,y,z if zero, set enablex,y,z ; e) loop 4ever mainloop btfsc SX ;is X-step low? goto xhigh ;no bcf EX ;enable clrf countx ;-------------- xhigh btfsc SY ;is Y-step low? goto yhigh ;no bcf EY ;enable clrf county ;-------------- yhigh btfsc StepZ ;is Z-step low? goto zhigh ;no bcf EZ ;enable clrf countz ;-------------- zhigh decfsz var1,F ;loop thru 256 times goto mainloop goto bottomloop ;-------------------------------------------------------------- bottomloop incfsz countx,F goto xactive bsf EX ;disable xactive incfsz county,F goto yactive bsf EY ;disable yactive incfsz countz,F goto zactive bsf EZ ;disable zactive incf flash,F btfss flash,7 bsf RED btfsc flash,7 bcf RED goto mainloop ;--*--*--*--*- -*--*- -*--*- -*--*- -*--*- -*--*- -*--*- -*--*- END [ Home
|
| Sherline Pages Home
] |
|||