Blame | Last modification | View Log | Download
#include 16C84.INCorg 0goto Start;--------------------org 4;--------------------Start:page1movlw 00000000B ; inicializace citace a prescalerumovwf TMR0movlw 00000000B ; konfigurace prerusenimovwf INTCONpage1movlw 11110111B ; nastaveni portu na vstup nebo vystupmovwf PORTA ; 1=vstup 0=vystupmovlw 11110001Bmovwf PORTBbsf TMR0, 7 ; vypni pull-up na PORTB (OPTION registr)page0clrw ; vynulovani portumovwf PORTAmovwf PORTBbsf PORTA, 3 ; Pull-Up na tlacitkabcf PORTB, 1 ; zhasnuti LEDbcf PORTB, 2bcf PORTB, 3MainLoop:movlw 2movwf volani ; Nastavi pocet volani procedury vibito;bsf PORT ; Nabiti kondenzatoru1;bsf PORT ; Nabiti kondenzatoru2dal:btfss PORTA, 1 ; Test kondenzatoru1call vibitobsf PORTB, 2call Delay10mscall Delay10mscall Delay10mscall Delay10mscall Delay10msbcf PORTB, 2call Delay10mscall Delay10mscall Delay10mscall Delay10mscall Delay10msbsf PORTB, 2call Delay10mscall Delay10mscall Delay10mscall Delay10mscall Delay10msbcf PORTB, 2btfss PORTB, 6 ; Test kondenzatoru2call vibitoincf Ramec, fgoto dal;---------------Delay10us: ; Prodleva (DELAY10 * 10us)+3usnopnopnopnopnopnopnopdecfsz CT1, 1goto Delay10usreturn;-------------------------Sinchro:bsf PORTB, 1call Delay10mscall Delay10mscall Delay10msbcf PORTB, 1 ; 1 impuls (30ms)call Delay10mscall Delay10mscall Delay10msbsf PORTB, 1call Delay10mscall Delay10msbcf PORTB, 1 ; 2 impuls (20ms)call Delay10mscall Delay10msbsf PORTB, 1call Delay10msbcf PORTB, 1 ; 3 impuls (10ms)call Delay10msreturn;-------------------------Delay10ms:movlw 100movwf CT2call Delay10usdecfsz CT2, fgoto Delay10msreturn;-------------------------Protokol:movlw 8movwf Bity ; nastaveni slovacall SinchroVysBit:btfss Ramec, 0call frek0call frek1rrf Ramec, fdecfsz Bity, fgoto VysBitreturn;-------------------------frek0:;-------------------------frek1:;-------------------------vibito:movlw 4movwf CT1 ; uvolneni mistazapis:rlf Ramec, fdecfsz CT1, fgoto zapisdecfsz volani, freturncall Protokolcall MainLoop;----------------------------; Definice promenych;----------------------------cblockCT1CT2BityRamecvolaniXXXendcend