;********************************************************************** ; * ; Filename: farol.asm * ; Date: Novembro 2004 * ; File Version: * ; * ; Author: Mario Luzeiro - a25408 at alunos.det.ua.pt * ; Company: Azeiteiro Team * ; http://sweet.ua.pt/~a25408/ * ; * ; Notes: Codigo para implementar um farol para o concurso * ; MicroRato de acordo com as regras de 2004 * ; 36.8Khz modulados a 600hz com duty cyle de 30% * ; * ; * ;********************************************************************** list p=16f628 ; list directive to define processor #include ; processor specific variable definitions __CONFIG _INTRC_OSC_NOCLKOUT & _CP_OFF & _WDT_OFF & _BODEN_ON & _PWRTE_ON & _MCLRE_OFF & _LVP_OFF CBLOCK 0x20 ; Declare variable addresses starting at 0x20 Loop1,Loop2 ENDC ;********************************************************************** ORG 0x000 ; processor reset vector goto main ; go to beginning of program main ; ; ----------- ; INITIALIZE ; ----------- ; CLRF PORTA ; Initialize port A CLRF PORTB ; Initialize port B BSF STATUS,RP0 ; RAM bank 1 CLRF TRISA ; All pins port A output CLRF TRISB ; All pins port B output BCF STATUS,RP0 ; RAM bank 0 ; ; ------------------------ ; FUNCTION OF PORT A PINS ; ------------------------ ; MOVLW 7 MOVWF CMCON ; Comparators off, all pins digital I/O ; ; ---------- ; MAIN LOOP ; ---------- ; LOOP MOVLW 13 MOVWF Loop1 OSCL40khz ; on all MOVLW b'11111111' MOVWF PORTA MOVWF PORTB NOP NOP NOP NOP NOP NOP NOP NOP NOP ;= 0.0000011 s ;off all MOVLW b'00000000' ;+ 0.0000001 MOVWF PORTA MOVWF PORTB NOP NOP NOP NOP NOP NOP NOP NOP ;= 0.0000010 s DECFSZ Loop1,F ;+ 0.0000001 GOTO OSCL40khz ;+ 0.0000002 MOVLW 64 MOVWF Loop2 wait1ms NOP NOP NOP NOP NOP NOP NOP NOP DECFSZ Loop2,F GOTO wait1ms GOTO LOOP END ; directive 'end of program'