?? 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 + -