hjl4
Member
Please look over this bit of code, and tell me why LED will not flash on every pin, except of cours MCLR.
Thanks
Thanks
Code:
list p=16f88 ; list directive to define processor
#include <p16F88.inc> ; processor specific variable definitions
errorlevel -302 ; suppress message 302 from list file
__CONFIG _CONFIG1, _CP_OFF & _CCP1_RB0 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_OFF & _PWRTE_ON & _WDT_OFF & _INTRC_IO
__CONFIG _CONFIG2, _IESO_OFF & _FCMEN_OFF
; '__CONFIG' directive is used to embed configuration word within .asm file.
; The lables following the directive are located in the respective .inc file.
; See data sheet for additional information on configuration word settings.
;***** VARIABLE DEFINITIONS
D1 EQU 0x71 ; variable used for context saving
D2 EQU 0x72 ; variable used for context saving
pclath_temp EQU 0x73 ; variable used for context saving
;**********************************************************************
ORG 0x000 ; processor reset vector
goto INIT ; go to beginning of program
INIT
BANKSEL PORTA ;select bank of PORTA (BANK 0)
CLRF PORTA ;initialize PORTA by clearing output data latches
BANKSEL ANSEL ;select bank of ANSEL (BANK 1)
MOVLW 0X00 ; 1= analogue pins, 0= digital pins
MOVWF ANSEL ; configure all pins as digital I/O
MOVLW 0X20 ; value used to initialize data direction (RA5 is input only, thefore bit 6 is 1, or 20h).
MOVWF TRISA ; set RA0-RA4 as digital output, RA5 as MCLR input only, RA6 and RA7 as digital output.
BANKSEL PORTB ;select bank of PORTB (BANK 0)
CLRF PORTB ;clear PORTB data latches
BANKSEL TRISB ;select bank of TRISB (BANK 1)
MOVLW 0X00 ;value used to initialize data direction 1= input, 0= output.
MOVWF TRISB ;make all pins outputs
BANKSEL TRISB
MOVLW 0XFF
MOVWF PORTA
MOVWF PORTB
MAIN
NOP
NOP
NOP
NOP
NOP
XORWF PORTA,1
XORWF PORTB,1
CALL DELAY
GOTO MAIN
DELAY
DECFSZ D1,1
GOTO DELAY
DECFSZ D2,1
GOTO DELAY
RETURN
; remaining code goes here
; initialize eeprom locations
ORG 0x2100
DE 0x00, 0x01, 0x02, 0x03
END ; directive 'end of program'