Hi Mike,
I tried this another code for macro in which I want 5 second delay and for that I used macro of 1 second delay for five times, I know why this is not working because when a macro comes the whole code in macro actually get copied so as I have used the same macro for five times all the label overlaps five times but, if I required to write the macro with different label for FIVE TIMES then what is the use of macro ?, Is there any way that I can repeat the same macro many times without overlapping it's label...
I tried this another code for macro in which I want 5 second delay and for that I used macro of 1 second delay for five times, I know why this is not working because when a macro comes the whole code in macro actually get copied so as I have used the same macro for five times all the label overlaps five times but, if I required to write the macro with different label for FIVE TIMES then what is the use of macro ?, Is there any way that I can repeat the same macro many times without overlapping it's label...
Code:
List p=16f690
#include <p16f690.inc>
__CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF & _INTRC_OSC_NOCLKOUT
ERRORLEVEL-302
;**********************************************************************
cblock 0x20
temp
d1
d2
d3
d4
d5
endc
;******************************MACRO************************************
[COLOR="Red"]seconddelay macro
movlw d'2'
movwf d3
delay:
decfsz d1 ; (256 x 1) X
goto delay ; (2 x 1) X
decfsz d2 ; (256 x 1) X
goto delay ; (2 x 1) = 262144 uSec = 0.262 Sec
=262mSec X
decfsz d3 ; (2 x 1) X
goto delay ; (2 x 1) = 1048mSec = 1.04Sec
endm[/COLOR]
;***********************************************************************
org 0x00
goto main
;***********************************************************************
main:
portset:
bsf STATUS,RP0
clrf TRISC
clrf TRISA
clrf TRISB
bcf STATUS,RP0
begain:
movlw b'00000001'
movwf PORTC
seconddelay
seconddelay
seconddelay
seconddelay
seconddelay
movlw b'00000000'
movwf PORTC
seconddelay
seconddelay
seconddelay
seconddelay
seconddelay
delayx:
decfsz d4
goto delayx
decfsz d5
goto delayx
goto begain
end