; Lumina Dimamica v1.0 ; Copyright (C) 2005 Radu Igret ; BobTech - Home Automation www.bobtech.home.ro ; program de test pentru sistemul BobDemo 628 ; programul a fost testat pe sistemul BobDemo 628, ; programul se distribuie gratuit si nu imi asum nici o raspundere pentru evenutale daune provocate de acesta list p=16F628 #include __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _MCLRE_ON & _BODEN_OFF & _LVP_OFF & _HS_OSC ;definire FLAGURI ;--------------------------------------------------------------------------- #define ZERO STATUS,Z #define CARRY STATUS,C #define DCARRY STATUS,DC ;--------------------------------------------------------------------------- ;definire variabile ;--------------------------------------------------------------------------- cblock 0x20 Waux0 Waux1 Waux2 endc ;--------------------------------------------------------------------------- ;definire pini I/O ;--------------------------------------------------------------------------- #define OUT1 PORTA,00 ;OUT #define OUT2 PORTA,01 ;OUT #define OUT3 PORTA,02 ;OUT #define OUT4 PORTA,03 ;OUT #define OUT5 PORTA,04 ;OUT #define LED PORTB,00 ;OUT #define OUT6 PORTB,01 ;OUT #define OUT7 PORTB,02 ;OUT #define OUT8 PORTB,03 ;OUT #define OUT9 PORTB,04 ;OUT #define OUT10 PORTB,05 ;OUT #define OUT11 PORTB,06 ;OUT #define OUT12 PORTB,07 ;OUT ;--------------------------------------------------------------------------- ;definire macrouri ;--------------------------------------------------------------------------- bank0 macro bcf STATUS,RP0 bcf STATUS,RP0 endm bank1 macro bcf STATUS,RP0 bsf STATUS,RP0 endm ;--------------------------------------------------------------------------- ;--------------------------------------------------------------------------- ORG 0x000 PROGRAM_START ; Configurare porturi I/O movlw b'00000111' ;Comparators OFF (vezi pag. 58) movwf CMCON bank1 movlw b'11100000' movwf TRISA movlw b'00000000' movwf TRISB ; Configurare Option register movlw b'10000101' movwf OPTION_REG bank0 movlw 0x0FF movwf PORTA movwf PORTB Loop bcf LED call Pauza bsf LED call Pauza bcf OUT1 call Pauza bsf OUT1 call Pauza bcf OUT2 call Pauza bsf OUT2 call Pauza bcf OUT3 call Pauza bsf OUT3 call Pauza bcf OUT4 call Pauza bsf OUT4 call Pauza bcf OUT5 call Pauza bsf OUT5 call Pauza bcf OUT6 call Pauza bsf OUT6 call Pauza bcf OUT7 call Pauza bsf OUT7 call Pauza bcf OUT8 call Pauza bsf OUT8 call Pauza bcf OUT9 call Pauza bsf OUT9 call Pauza bcf OUT10 call Pauza bsf OUT10 call Pauza bcf OUT11 call Pauza bsf OUT11 call Pauza bcf OUT12 call Pauza bsf OUT12 call Pauza goto Loop ;--------------------------------------------------------------------------- ;--------------------------------------------------------------------------- Pauza ;--------------------------------------------------------------------------- call WAIT_100ms return ;--------------------------------------------------------------------------- ;--------------------------------------------------------------------------- WAIT_100ms ;--------------------------------------------------------------------------- ;intarziere de 100 ms movlw .129 movwf Waux2 _SYS_LOOP6 movlw 0 movwf Waux1 _SYS_LOOP7 decfsz Waux1,f goto _SYS_LOOP7 decfsz Waux2,f goto _SYS_LOOP6 ;2+1+1+129*(2+256*3+1+2)=99,721 ms movlw .93 movwf Waux1 _SYS_LOOP8 decfsz Waux1,f goto _SYS_LOOP8 decfsz Waux2,f ;+2+93*3=100,002 ms return ;+2=100,004 ms ;--------------------------------------------------------------------------- ;--------------------------------------------------------------------------- WAIT_200ms ;--------------------------------------------------------------------------- ;intarziere de 200 ms 200,010 ms call WAIT_100ms call WAIT_100ms return ;--------------------------------------------------------------------------- ;--------------------------------------------------------------------------- WAIT_500ms ;--------------------------------------------------------------------------- ;intarziere de 500 ms 500,022 ms call WAIT_100ms call WAIT_100ms call WAIT_100ms call WAIT_100ms call WAIT_100ms return ;--------------------------------------------------------------------------- END