Вот код: (по задумке когда выводы порта А некоторое время горят, выводы порта В погашены етоже время. И так далее (мигание)) В отладчике все работает а на практике почемуто все порты (А и В) все время горят.
list p=16F628A ; list directive to define processor #include <p16F628A.inc> ; processor specific variable definitions
errorlevel -302 ; suppress message 302 from list file
__CONFIG _CP_OFF & _DATA_CP_OFF & _LVP_OFF & _BOREN_OFF & _MCLRE_ON & _WDT_OFF & _PWRTE_ON & _INTOSC_OSC_NOCLKOUT
INT_VAR UDATA_SHR w_temp RES 1 ; variable used for context saving status_temp RES 1 ; variable used for context saving tre equ 0xc0
;********************************************************************** RESET_VECTOR CODE 0x0000 ; processor reset vector goto START ; go to beginning of program INT_VECTOR CODE 0x0004 ; interrupt vector location
INTERRUPT
movwf w_temp ; save off current W register contents movf STATUS,w ; move status register into W register movwf status_temp ; save off contents of STATUS register
; isr code can go here or be located as a call subroutine elsewhere
movf status_temp,w ; retrieve copy of STATUS register movwf STATUS ; restore pre-isr STATUS register contents swapf w_temp,f swapf w_temp,w ; restore pre-isr W register contents retfie ; return from interrupt
MAIN_PROG CODE
START clrf tre movlw 0x07 movwf CMCON BCF STATUS,RP1 BSF STATUS,RP0 movlw 0x00 movwf TRISA movwf TRISB
on: clrf tre on1: BcF STATUS,RP0 movlw b'00000000' movwf PORTA movlw b'11111111' movwf PORTB BSF STATUS,RP0 incf tre,1 BTFSC tre,4 goto off goto on1
off: clrf tre off1: BcF STATUS,RP0 movlw b'11111111' movwf PORTA movlw b'00000000' movwf PORTB BSF STATUS,RP0 incf tre,1 BTFSC tre,4 goto on goto off1
end
Подскажите где ошибка...
|