kalingajay
New Member
Hi all,
I have few numbers of PIC16F628 (not 16F628A) microcontrollers. I wrote a .asm code to test PICs like below.
;****************************************************************
LIST P=16F628
#include <P16F628.INC>
__CONFIG _PWRTE_ON & _WDT_OFF & _ER_OSC_NOCLKOUT & _BODEN_OFF & _LVP_OFF & _CP_OFF & _MCLRE_OFF
errorlevel -302
;****************************************************************
org 0x00
goto init
org 0x04
;****************************************************************
init
clrf PORTA
clrf PORTB
movlw 0x07 ; Turn comparators OFF and enable pins for I/O
movwf CMCON
bcf STATUS,RP1
bsf STATUS,RP0 ;switch to bank 1
clrf TRISA
clrf TRISB
bcf STATUS,RP0 ;switch back to bank 0
;****************************************************************
START MOVLW B'00000001' ;
MOVWF PORTB
CALL DELAY
MOVLW B'00000010' ;
MOVWF PORTB
CALL DELAY
MOVLW B'00000100' ;
MOVWF PORTB
CALL DELAY
MOVLW B'00001000' ;
MOVWF PORTB
CALL DELAY
MOVLW B'00010000' ;
MOVWF PORTB
CALL DELAY
MOVLW B'00100000' ;
MOVWF PORTB
CALL DELAY
MOVLW B'01000000' ;
MOVWF PORTB
CALL DELAY
MOVLW B'10000000' ;
MOVWF PORTB
CALL DELAY
GOTO START
;****************************************************************
DELAY MOVLW .75
MOVWF 2CH
STK DECFSZ 2AH,1
GOTO STK
DECFSZ 2CH,1
GOTO STK
RETURN
END
The code can compile and program PIC without any error. But with practical circuit any LED not light up. Please anyone can tell me what is the error of this code?
I have few numbers of PIC16F628 (not 16F628A) microcontrollers. I wrote a .asm code to test PICs like below.
;****************************************************************
LIST P=16F628
#include <P16F628.INC>
__CONFIG _PWRTE_ON & _WDT_OFF & _ER_OSC_NOCLKOUT & _BODEN_OFF & _LVP_OFF & _CP_OFF & _MCLRE_OFF
errorlevel -302
;****************************************************************
org 0x00
goto init
org 0x04
;****************************************************************
init
clrf PORTA
clrf PORTB
movlw 0x07 ; Turn comparators OFF and enable pins for I/O
movwf CMCON
bcf STATUS,RP1
bsf STATUS,RP0 ;switch to bank 1
clrf TRISA
clrf TRISB
bcf STATUS,RP0 ;switch back to bank 0
;****************************************************************
START MOVLW B'00000001' ;
MOVWF PORTB
CALL DELAY
MOVLW B'00000010' ;
MOVWF PORTB
CALL DELAY
MOVLW B'00000100' ;
MOVWF PORTB
CALL DELAY
MOVLW B'00001000' ;
MOVWF PORTB
CALL DELAY
MOVLW B'00010000' ;
MOVWF PORTB
CALL DELAY
MOVLW B'00100000' ;
MOVWF PORTB
CALL DELAY
MOVLW B'01000000' ;
MOVWF PORTB
CALL DELAY
MOVLW B'10000000' ;
MOVWF PORTB
CALL DELAY
GOTO START
;****************************************************************
DELAY MOVLW .75
MOVWF 2CH
STK DECFSZ 2AH,1
GOTO STK
DECFSZ 2CH,1
GOTO STK
RETURN
END
The code can compile and program PIC without any error. But with practical circuit any LED not light up. Please anyone can tell me what is the error of this code?