📄 init2.asm
字号:
list p=16f690
#include p16f690.inc
#include<t2.inc>
CODE
;init---------------------------------------------------------------------------
init
;clock frequency =8MHz
BANKSEL 0x80
movlw 0xF1
movwf OSCCON
;time 100ms*10=1s
;timer1
BANKSEL 0x00
movlw t1low
movwf TMR1L
movlw t1hi
movwf TMR1H
movlw 0x30 ;timer frequency =1:8 Fosc =1MHz
movwf T1CON
BANKSEL 0x80
clrf PIE1
bsf PIE1,TMR1IE
BANKSEL 0x00
clrf INTCON
bsf INTCON,PEIE
bsf INTCON,GIE
movlw 0x0A
movwf t_count
;serial interface
BANKSEL 0x80
clrf BAUDCTL
movlw 0x18
movwf TXSTA
BANKSEL 0x00
movlw 0x80
movwf RCSTA
movlw 0xCF
movwf SPBRG
clrf SPBRGH
;ADC
BANKSEL 0x80
movlw 0x07
movwf TRISA
movlw 0xCF
movwf TRISC
BANKSEL 0x00
clrf PORTA
clrf PORTB
clrf PORTC
BANKSEL 0x80
movlw 0x50
movwf ADCON1
;others
bcf TRISB,6
BANKSEL 0x00
bcf PORTB,6
clrf ad_count
clrf t_flag
return
;init end----------------------------------------------------------------------
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -