📄 picstepr.lst
字号:
MPASM 02.30 Released PICSTEPR.ASM 6-3-2001 17:35:56 PAGE 1
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00001 LIST p=16F84 ; PIC16F844 is the target processor
00002
00003 #include "P16F84.INC" ; Include header file
00001 LIST
00002 ; P16F84.INC Standard Header File, Version 2.00 Microchip Technology, Inc.
00136 LIST
00004
00005 CBLOCK 0x10 ; Temporary storage
00000010 00006 pos
00000011 00007 dc1
00000012 00008 dc2
00009 ENDC
Warning[223]: Redefining processor.
00010 LIST p=16F84 ; PIC16F844 is the target processor
00011
00012 #include "P16F84.INC" ; Include header file
00137 LIST
00138 ; P16F84.INC Standard Header File, Version 2.00 Microchip Technology, Inc.
Message[310]: Superceding current maximum RAM and RAM map.
00272 LIST
00013
00014 CBLOCK 0x10 ; Temporary storage
00015 ENDC
00016
0000 00017 ORG 0
0000 2805 00018 entrypoint goto start
00019
0004 00020 ORG 4
0004 2804 00021 intvector goto intvector
00022
0005 0103 00023 start clrw ; Zero.
00024
0006 0086 00025 movwf PORTB ; Ensure PORTB is zero before we enable it.
0007 1683 00026 bsf STATUS,RP0 ; Select Bank 1
0008 30F0 00027 movlw 0xF0 ; Set port B bits 0-3 as outputs
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
0009 0086 00028 movwf TRISB ; Set TRISB register.
00029
000A 1283 00030 bcf STATUS,RP0 ; Select Bank 0
00031
000B 3003 00032 movlw 3 ; Initialize the motor position
000C 0090 00033 movwf pos
000D 0086 00034 movwf PORTB
000E 2029 00035 call delay
000F 0186 00036 clrf PORTB ; Motor drive off
00037
00038 ;Main loop
0010 1C05 00039 loop btfss PORTA,0 ; Test clockwise button
0011 2015 00040 call stepcw
0012 1C85 00041 btfss PORTA,1 ; Test anti-clockwise button
0013 201F 00042 call stepccw
0014 2810 00043 goto loop
00044
MPASM 02.30 Released PICSTEPR.ASM 6-3-2001 17:35:56 PAGE 2
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00045 ;Rotate one step clockwise
0015 1003 00046 stepcw bcf STATUS,C ; Clear the carry flag
0016 1990 00047 btfsc pos,3 ; Set carry if this bit set
0017 1403 00048 bsf STATUS,C
0018 0D10 00049 rlf pos,W ; Pick up and rotate the motor's current position
0019 390F 00050 andlw 0x0F ; Mask to lower nibble
001A 0090 00051 movwf pos
001B 0086 00052 movwf PORTB ; Drive the outputs
001C 2029 00053 call delay ; Wait
001D 0186 00054 clrf PORTB ; Clear the output
001E 0008 00055 return
00056
00057 ;Rotate one step counter clockwise
001F 1003 00058 stepccw bcf STATUS,C ; Clear the carry flag
0020 1810 00059 btfsc pos,0
0021 1610 00060 bsf pos,4
0022 0C10 00061 rrf pos,W ; Pick up and rotate the motor's current position
0023 390F 00062 andlw 0x0F ; Mask to lower nibble
0024 0090 00063 movwf pos
0025 0086 00064 movwf PORTB ; Drive the outputs
0026 2029 00065 call delay ; Wait
0027 0186 00066 clrf PORTB ; Clear the output
0028 0008 00067 return
00068
00069 ; This routine implements the delay between steps,
00070 ; and thus controls the motor speed.
0029 3018 00071 delay movlw 18 ; Outer loop iteration count
002A 0091 00072 movwf dc1
002B 0192 00073 dl1 clrf dc2 ; Initialize inner loop
002C 0000 00074 dl2 nop
002D 0000 00075 nop
002E 0B92 00076 decfsz dc2,F
002F 282C 00077 goto dl2
0030 0B91 00078 decfsz dc1,F
0031 282B 00079 goto dl1
0032 0008 00080 return
00081
00082 END
MPASM 02.30 Released PICSTEPR.ASM 6-3-2001 17:35:56 PAGE 3
SYMBOL TABLE
LABEL VALUE
C 00000000
DC 00000001
EEADR 00000009
EECON1 00000088
EECON2 00000089
EEDATA 00000008
EEIE 00000006
EEIF 00000004
F 00000001
FSR 00000004
GIE 00000007
INDF 00000000
INTCON 0000000B
INTE 00000004
INTEDG 00000006
INTF 00000001
IRP 00000007
NOT_PD 00000003
NOT_RBPU 00000007
NOT_TO 00000004
OPTION_REG 00000081
PCL 00000002
PCLATH 0000000A
PORTA 00000005
PORTB 00000006
PS0 00000000
PS1 00000001
PS2 00000002
PSA 00000003
RBIE 00000003
RBIF 00000000
RD 00000000
RP0 00000005
RP1 00000006
STATUS 00000003
T0CS 00000005
T0IE 00000005
T0IF 00000002
T0SE 00000004
TMR0 00000001
TRISA 00000085
TRISB 00000086
W 00000000
WR 00000001
WREN 00000002
WRERR 00000003
Z 00000002
_CP_OFF 00003FFF
_CP_ON 0000000F
_HS_OSC 00003FFE
_LP_OSC 00003FFC
_PWRTE_OFF 00003FFF
_PWRTE_ON 00003FF7
MPASM 02.30 Released PICSTEPR.ASM 6-3-2001 17:35:56 PAGE 4
SYMBOL TABLE
LABEL VALUE
_RC_OSC 00003FFF
_WDT_OFF 00003FFB
_WDT_ON 00003FFF
_XT_OSC 00003FFD
__16F84 00000001
dc1 00000011
dc2 00000012
delay 00000029
dl1 0000002B
dl2 0000002C
entrypoint 00000000
intvector 00000004
loop 00000010
pos 00000010
start 00000005
stepccw 0000001F
stepcw 00000015
MEMORY USAGE MAP ('X' = Used, '-' = Unused)
0000 : X---XXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXX-------------
All other memory blocks unused.
Program Memory Words Used: 48
Program Memory Words Free: 976
Errors : 0
Warnings : 1 reported, 0 suppressed
Messages : 2 reported, 0 suppressed
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -