Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include p16f88.inc
- __CONFIG _CONFIG1, _CP_OFF & _CCP1_RB0 & _DEBUG_OFF & _MCLR_OFF & _PWRTE_ON & _WDT_OFF & _INTRC_IO & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF
- __CONFIG _CONFIG2, _IESO_OFF & _FCMEN_OFF
- poc1 equ 20h
- poc2 equ 21h
- org 00h
- goto start
- org 04h
- goto preruseni
- start
- bcf INTCON,GIE ;vymazani bitu preruseni - GLOBAL INTERRUPT ENABLE
- bsf STATUS,RP0 ;str 1
- movlw 07h ;00000011
- movwf CMCON ;vypnuti komparatoru
- movlw 00h
- movwf ADCON0 ;vypnuti prevodniku
- movlw 00h
- movwf ANSEL ;vypnuti AD prevodniku
- movlw 00h ;vystup portB
- movwf TRISB
- movlw 82h
- movwf OPTION_REG
- movlw 0F2h
- movwf OSCCON ;osccon
- bcf STATUS,RP0 ;stranka 0
- bsf INTCON,TMR0IE ;intcon povoleni TMR0
- bsf INTCON,GIE ;povoleni preruseni GLOBALINTERRUPTENABLE
- movlw .244 ;244
- movwf poc1 ;toto budu ve smycce dekrementovat
- nic ;tady mi program cykli a ceka na preruseni
- nop
- nop
- nop
- goto nic
- preruseni ;preruseni
- decfsz poc1 ;dekrementuje a preskoci pokud je nula
- goto pokracuj ;pokud neni nula poc1, pokracuje na znova (a maze flag) jinak->
- call znova ;pokud uz je na nule, znova nacte a pricte do poc2
- pokracuj
- bcf INTCON,TMR0IF ;potreba vynulovat FLAG! tmr0
- retfie ;navrat z preruseni do cyklu
- znova ;
- incf poc2 ;poc2 +1 -> W
- movfw poc2 ;W->poc2
- movwf PORTB ;vypise bit navic na portB
- movlw .244 ;244 ->W
- movwf poc1 ;W->POC1 -> muzeme opet cyklit
- return ;navrat pod CALL
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement