list p=16F1847A
#include<p16f1847.inc>
;**************************
Temp equ 0x20
outer equ 0x21
inner equ 0x22
;***************************
org 0x00
banksel TRISB ;select bank1
movlw 0x00 ; set PORTB as ouput
movwf TRISB
movlw 0xff ; set PORTA as input
movwf TRISA
banksel PORTB ;select bank0
movlw 0x00 ;turn off display
movwf PORTB
main btfsc PORTA,0 ;Is RA0 pressed?
call delay ;no
goto begin
btfsc PORTA,1 ;is RA1 pressed?
goto main ;no
clrf PORTB ;turn off display
begin bsf PORTB,0 ;turn on b0
call delay ; wait 100ms
bcf PORTB,0 ;turn off b0
bsf PORTB,1 ;turn on b1
call delay ; wait 100ms
bcf PORTB,1 ;turn off b1
bsf PORTB,2 ;turn on b2
call delay ; wait 100ms
bcf PORTB,2 ;turn off b2
bsf PORTB,3 ;turn on b3
call delay ; wait 100ms
bcf PORTB,3 ;turn off b3
bsf PORTB,4 ;turn on b4
call delay ; wait 100ms
bcf PORTB,4 ;turn off b4
bsf PORTB,5 ;turn on b5
call delay ; wait 100ms
bcf PORTB,5 ;turn off b5
bsf PORTB,6 ;turn on b6
call delay ; wait 100ms
bcf PORTB,6 ;turn off b6
bsf PORTB,7 ;turn on b7
call delay ; wait 100ms
bcf PORTB,7 ;turn off b7
call delay ;wait 100ms
goto begin
;********100ms time delay*********
delay movlw 0x82
movwf outer
del1 movlw 0xff
movwf inner
del2 decfsz inner
goto del2
decfsz outer
goto del1
return
end
我自己编写的流水灯程序,运行时出现Error - section '.org_0' type is non-overlay and absolute but occurs in more than one input file.
Errors : 1 这是什么意思,是org 0x00出现错误了么,请高手指教
此帖出自
小平头技术问答
这个前面有句跳转, 执行不到RA1了,
你可以用MPLAB-SIM软件仿真一步一步运行,就可看到! 不知你的时钟是多少?我4M测试delay延时99.97ms,太快了看不到流水灯效果--应该只是闪亮吧,
SIM软件仿真PORTB 1 2 4 输不出高电平,可能芯片这几个引脚有其它第二功能(如AD..),可看一下数据手册!
一周热门 更多>