Hello everyone,
I am new to the world of PIC programming. I bought a book "PIC in Practice" by D W Smith 1st edition
While trying to recreate the task 1 there are some problems I can not sole for the past 3 days. I really want to progress and carry on being better however at this stage I do not understand enough to solve it.
Program says that the LED supposed to blink - I can not make this LED to blink, basically nothing happens. I do not know why
So, the language is ASSEMBLY, I use PICkit 2, and MPLAB X 5.10, I tried this on 16F84 and 16F628A, 2-3 each. I use MPLAB breadboard.
I have attached schematics for this.
Programm from the book tells me:
; Header84.ASM for 16F84. This sets PORTA as an INPUT(NB 1
; means input) and PORTB as an OUTPUT
; (NB 0 means output). The OPTION
; register is set to /256 to give timing pulses
; of 1/32 of a second.
; 1 second and 0.5 second delays are
; included in the subroutine section.
;*****************************************************************************
; EQUATES SECTION
TMR0 EQU 1 ; means TMR0 is file 1
STATUS EQU 3 ; means STATUS is file 3
PORTA EQU 5 ; means PORTA is file 5
PORTB EQU 6 ; means PORTB is file 6
ZEROBIT EQU 2 ; means ZEROBIT is bit 2
COUNT EQU 0CH ; means COUNT is file 0C
; a register to count events
;*****************************************************************************
LIST P=16F84 ; we are using 16F84
ORG 0 ; the start address in memory is 0
GOTO START ; goto start
;*****************************************************************************
;*****************************************************************************
; SUBROUTINE SECTION
; 1 second delay
DELAY1 CLRF TMR0 ; start TMR0
LOOPA MOVF TMR0,W ; read TMR0 into W
SUBLW .32 ; TIME -32
BTFSS STATUS,ZEROBIT ; check TIME-W = 0
GOTO LOOPA ; time is not = 32
RETLW 0 ; time is 32, return
; 0.5 second delay
DELAYP5 CLRF TMR0 ; start TMR0
LOOPB MOVF TMR0, W ; read TMR0 into W
SUBLW .16 ; TIME -16
BTFSS STATUS,ZEROBIT ; check TIME-W = 0
GOTO LOOPB ; time is not = 16
RETLW 0 ; time is 16, return
; CONFIGURATION SECTION
START BSF STATUS,5 ; Turns to BANK1
MOVLW B'00011111'
TRIS PORTA
MOVLW B'00000000'
TRIS PORTB ; PORTB is OUTPUT
MOVLW B'00000111' ; prescaler is /256
OPTION ; TIMER is 1/32 secs.
BCF STATUS,5 ; return to BANK0
CLRF PORTA ; clears PORTA
CLRF PORTB ; c;ears PORTB
;*****************************************************************************
; PROGRAM STARTS NOW
BEGIN BSF PORTB,0 ; turn ON B0
CALL DELAY1 ; wait 1 second
BCF PORTB,0 ; turn OFF B0
CALL DELAY1 ; wait 1 second
GOTO BEGIN ; repeat
END ; you must end !!!
Please help !!! Thank you very much in advance.