fs789
Junior Member level 2
help me, 2 seconds time error in along delay time
hi,
i have written this program in assembly language, having two delays:
(5 seconds and 3595 seconds) , the sum of them equals 1 hour.
the program must turn on ALED for five seconds,then turning it off for 3595 seconds
then repeating the process.in other words,(( the led must turn on every 1 hour exactly)).
the problem is as follows: when connecting the circuit actually, the program goes well for the first 6 hours , but after that , the LED turns on 2 seconds before the expected time!!!!!!!!!!! having errors.
The tow delayshave been made by PIC_Delay program. and the crystal frequency 4MHZ,
with tow capacitors 22PF.
PLEASE EXPLAIN FOR ME WHAT IS THE REASON OF ERRORS?? I HAVE CALCULATED NUMBER OF MACHINE CYCLES WITH MPLAB STOP WATCH AND EVERY THING IS OK.
PROCESSOR 16f84a ; Defining processor
#include "p16f84a.inc" ; Microchip INC database
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
; frequency 4MHZ
CBLOCK 0X0C
COUNT,D1,D2,D3,D4
ENDC
org 0x00
goto first
first
bsf STATUS,5
CLRF TRISB
BCF STATUS,5
CLRF PORTB
DELAY BSF PORTB,0
movlw .1
movwf D1
movlw .86
movwf D2
movlw .26
movwf D3
decfsz D1,F
goto $-1
clrwdt
decfsz D2,F
goto $-4
decfsz D3,F
goto $-6
nop
nop
BCF PORTB,0
movlw .153
movwf D1
movlw .112
movwf D2
movlw .62
movwf D3
movlw .72
movwf D4
decfsz D1,F
goto $-1
decfsz D2,F
goto $-3
decfsz D3,F
goto $-5
decfsz D4,F
goto $-7
nop
nop
GOTO DELAY
END
---------- Post added at 13:51 ---------- Previous post was at 13:03 ----------
please ,can any one help me???
hi,
i have written this program in assembly language, having two delays:
(5 seconds and 3595 seconds) , the sum of them equals 1 hour.
the program must turn on ALED for five seconds,then turning it off for 3595 seconds
then repeating the process.in other words,(( the led must turn on every 1 hour exactly)).
the problem is as follows: when connecting the circuit actually, the program goes well for the first 6 hours , but after that , the LED turns on 2 seconds before the expected time!!!!!!!!!!! having errors.
The tow delayshave been made by PIC_Delay program. and the crystal frequency 4MHZ,
with tow capacitors 22PF.
PLEASE EXPLAIN FOR ME WHAT IS THE REASON OF ERRORS?? I HAVE CALCULATED NUMBER OF MACHINE CYCLES WITH MPLAB STOP WATCH AND EVERY THING IS OK.
PROCESSOR 16f84a ; Defining processor
#include "p16f84a.inc" ; Microchip INC database
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
; frequency 4MHZ
CBLOCK 0X0C
COUNT,D1,D2,D3,D4
ENDC
org 0x00
goto first
first
bsf STATUS,5
CLRF TRISB
BCF STATUS,5
CLRF PORTB
DELAY BSF PORTB,0
movlw .1
movwf D1
movlw .86
movwf D2
movlw .26
movwf D3
decfsz D1,F
goto $-1
clrwdt
decfsz D2,F
goto $-4
decfsz D3,F
goto $-6
nop
nop
BCF PORTB,0
movlw .153
movwf D1
movlw .112
movwf D2
movlw .62
movwf D3
movlw .72
movwf D4
decfsz D1,F
goto $-1
decfsz D2,F
goto $-3
decfsz D3,F
goto $-5
decfsz D4,F
goto $-7
nop
nop
GOTO DELAY
END
---------- Post added at 13:51 ---------- Previous post was at 13:03 ----------
please ,can any one help me???