SREENATH P S
Newbie level 1
- Joined
- Aug 19, 2009
- Messages
- 1
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- Thrissur, Kerala
- Activity points
- 1,306
iam using pic16f877a to design a automatic turn off a device after 10 mins.
delay program for 50seconds is working well.
so i programmed in such a way to call this delay function of 50sc 6 times.
but then program is not working.this is the program:
List p=16f877A ; List directive mentioning the PIC
; Microcontroller part number
#include p16f877A.inc; file having standard definitions
org 0x00 ; The address 0x00 at which the next
; next instruction 'goto' will be stored
goto start ; Go to the beginning of main program
org 0x20 ; The address at which main program starts
start
bsf STATUS,RP0 ; Choose the memory bank by setting bits
; in STATUS register
movlw 0x00 ; Move 0x00 to working register
movwf TRISB ; Move working register contents 0x00 to
; TRISB register
bcf STATUS,RP0 ; Choose the memory bank by setting bits
begin ; in STATUS register
bsf PORTB,0;turnon relay/device
call delay ; Calling subroutine
call delay ; Calling subroutine
call delay ; Calling subroutine
call delay ; Calling subroutine
call delay ; Calling subroutine
call delay ; Calling subroutine
bcf PORTB,0;turnoff relay/device
sleep
delay
movlw 0xff ; Move 0x05 to Working Register
movwf 0x23 ; Move working register contents to 0x23
loop1
movlw 0xff ; Move 0xff to Working Register
movwf 0x22 ; Move working register contents to 0x22
loop2
movlw 0xff ; Move 0xff to Working Register
movwf 0x21 ; Move working register contents to 0x21
loop3
decfsz 0x21,1 ; Decrement value in 0x21 by 1 and store to 0x21 itself
goto loop3 ; Looping back to 'loop3'
decfsz 0x22,1 ; Decrement value in 0x22 by 1 and store to 0x22 itself
goto loop2 ; Looping back to 'loop2'
decfsz 0x23,1 ; Decrement value in 0x23 by 1 and store to 0x23 itself
goto loop1 ; Looping back to 'loop1'
return ; Returns to the next line after the call command
end
delay program for 50seconds is working well.
so i programmed in such a way to call this delay function of 50sc 6 times.
but then program is not working.this is the program:
List p=16f877A ; List directive mentioning the PIC
; Microcontroller part number
#include p16f877A.inc; file having standard definitions
org 0x00 ; The address 0x00 at which the next
; next instruction 'goto' will be stored
goto start ; Go to the beginning of main program
org 0x20 ; The address at which main program starts
start
bsf STATUS,RP0 ; Choose the memory bank by setting bits
; in STATUS register
movlw 0x00 ; Move 0x00 to working register
movwf TRISB ; Move working register contents 0x00 to
; TRISB register
bcf STATUS,RP0 ; Choose the memory bank by setting bits
begin ; in STATUS register
bsf PORTB,0;turnon relay/device
call delay ; Calling subroutine
call delay ; Calling subroutine
call delay ; Calling subroutine
call delay ; Calling subroutine
call delay ; Calling subroutine
call delay ; Calling subroutine
bcf PORTB,0;turnoff relay/device
sleep
delay
movlw 0xff ; Move 0x05 to Working Register
movwf 0x23 ; Move working register contents to 0x23
loop1
movlw 0xff ; Move 0xff to Working Register
movwf 0x22 ; Move working register contents to 0x22
loop2
movlw 0xff ; Move 0xff to Working Register
movwf 0x21 ; Move working register contents to 0x21
loop3
decfsz 0x21,1 ; Decrement value in 0x21 by 1 and store to 0x21 itself
goto loop3 ; Looping back to 'loop3'
decfsz 0x22,1 ; Decrement value in 0x22 by 1 and store to 0x22 itself
goto loop2 ; Looping back to 'loop2'
decfsz 0x23,1 ; Decrement value in 0x23 by 1 and store to 0x23 itself
goto loop1 ; Looping back to 'loop1'
return ; Returns to the next line after the call command
end