내부 TMR0 설정하기
START_TMR0_2US
MOVLW B'00000000' ;TMR0 PRE(1:2)타이머0를2분주(4MHz=0.25US,*4CLK,*2분주=2US)
GOTO START_TMR0_INIT
START_TMR0_4US
MOVLW B'00000001' ;TMR0 PRE(1:4)타이머0를4분주(4MHz=0.25US,*4CLK,*4분주=4US)
GOTO START_TMR0_INIT
START_TMR0_8US
MOVLW B'00000010' ;TMR0 PRE(1:8)타이머0를8분주(4MHz=0.25US,*4CLK,*8분주=8US)
GOTO START_TMR0_INIT
START_TMR0_16US
MOVLW B'00000011' ;TMR0 PRE(1:16)타이머0를16분주(4MHz=0.25US,*4CLK,*16분주=16US)
GOTO START_TMR0_INIT
START_TMR0_32US
MOVLW B'00000100' ;TMR0 PRE(1:32)타이머0를32분주(4MHz=0.25US,*4CLK,*32분주=32US)
GOTO START_TMR0_INIT
START_TMR0_128US
MOVLW B'00000110' ;TMR0 PRE(1:128)타이머0를128분주(4MHz=0.25US,*4CLK,*128분주=128US)
GOTO START_TMR0_INIT
START_TMR0_256US
MOVLW B'00000111' ;TMR0 PRE(1:256)타이머0를256 분주(4MHz=0.25US,*4CLK,*256분주=256US)
START_TMR0_INIT
SELBANK1
MOVWF OPTIONR
SELBANK0
BCF INTCON,T0IF
CLRF TMR0
BCF INTCON,GIE;전체INT사용중지
BCF INTCON,T0IE;T0INT사용중지
RETURN
START_TMR0_2US
MOVLW B'00000000' ;TMR0 PRE(1:2)타이머0를2분주(4MHz=0.25US,*4CLK,*2분주=2US)
GOTO START_TMR0_INIT
START_TMR0_4US
MOVLW B'00000001' ;TMR0 PRE(1:4)타이머0를4분주(4MHz=0.25US,*4CLK,*4분주=4US)
GOTO START_TMR0_INIT
START_TMR0_8US
MOVLW B'00000010' ;TMR0 PRE(1:8)타이머0를8분주(4MHz=0.25US,*4CLK,*8분주=8US)
GOTO START_TMR0_INIT
START_TMR0_16US
MOVLW B'00000011' ;TMR0 PRE(1:16)타이머0를16분주(4MHz=0.25US,*4CLK,*16분주=16US)
GOTO START_TMR0_INIT
START_TMR0_32US
MOVLW B'00000100' ;TMR0 PRE(1:32)타이머0를32분주(4MHz=0.25US,*4CLK,*32분주=32US)
GOTO START_TMR0_INIT
START_TMR0_128US
MOVLW B'00000110' ;TMR0 PRE(1:128)타이머0를128분주(4MHz=0.25US,*4CLK,*128분주=128US)
GOTO START_TMR0_INIT
START_TMR0_256US
MOVLW B'00000111' ;TMR0 PRE(1:256)타이머0를256 분주(4MHz=0.25US,*4CLK,*256분주=256US)
START_TMR0_INIT
SELBANK1
MOVWF OPTIONR
SELBANK0
BCF INTCON,T0IF
CLRF TMR0
BCF INTCON,GIE;전체INT사용중지
BCF INTCON,T0IE;T0INT사용중지
RETURN
'초보의 아웅다웅 설계하기 > PIC' 카테고리의 다른 글
10. 레지스터 클리어 (0) | 2010.08.02 |
---|---|
9. 딜레이 설정 (0) | 2010.08.02 |
7. 내부 EEPROM 사용하기 (0) | 2010.08.02 |
6. 동기 엣지 검출하기 (0) | 2010.08.02 |
5. TMR 사용하기. (0) | 2010.08.02 |